1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2010-2011 Dzmitry KAMIAHIN (dnk-88) <dnk-88@tut.by>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef SOUND_SYSTEM_H
22 #define SOUND_SYSTEM_H
24 #include <nel/misc/types_nl.h>
27 #include <nel/misc/vector.h>
28 #include <nel/misc/matrix.h>
29 #include <nel/misc/path.h>
30 #include <nel/sound/sound_anim_manager.h>
52 @brief This class init the sound system used by the object viewer
58 virtual ~CSoundSystem();
60 /// Set the name of the file containing the sample bank
61 void addSampleBank(const std::string
&sampleBankFileName
)
63 _SampleBanksFileName
.insert(sampleBankFileName
);
66 /// Sets the path which contains samples
67 void setSamplePath(std::string
&path
)
69 _SamplePath
= NLMISC::CPath::standardizePath(path
, true);
72 /// Sets the path which contains packed sheet
73 void setPackedSheetPath(std::string
&path
)
75 _PackedSheetPath
= NLMISC::CPath::standardizePath(path
, true);
78 /// Init the sound system this also load the sound bank. See setSoundBank
81 /// Release the sound system
84 /// Set the listener matrix.
85 void setListenerMatrix(const NLMISC::CMatrix
&m
);
87 /// Spawn a sound at the user position
88 void play(const std::string
&soundName
);
90 /// Create a sound at the user position (don't spawn it)
91 NLSOUND::USource
*create(const std::string
&soundName
);
93 /// Load the sound animation with the specified name
94 void loadAnimation(std::string
&name
)
96 _AnimManager
->loadAnimation(name
);
99 /// Start playing a sound animation.
100 void playAnimation(std::string
&name
, float lastTime
, float curTime
, NLSOUND::CSoundContext
&context
);
102 // Update the sound animations.
103 //static void updateAnimations(float lastTime, float curTime) { _AnimManager->update(lastTime, curTime); };
105 /// Get the audio mixer, or null if init failed
106 NLSOUND::UAudioMixer
*getAudioMixer(void)
111 /// Returns a reference to the animation manager
112 NLSOUND::CSoundAnimManager
*getSoundAnimManager()
117 /// Init the particle system sound with the given AudioMixer
120 /// Release the particle system sound with the given AudioMixer
121 void releaseGraphics();
123 /// Update sound. Must be called periodically
127 NLSOUND::UAudioMixer
*_AudioMixer
;
128 std::set
<std::string
> _SampleBanksFileName
;
129 NLSOUND::CSoundAnimManager
*_AnimManager
;
130 NLMISC::CVector _Zero
;
131 std::string _SamplePath
;
132 std::string _PackedSheetPath
;
133 NLMISC::CMatrix oldMatrix
;
134 }; /* class CSoundSystem */
136 } /* namespace NLQT */
138 #endif // SOUND_SYSTEM_H