Linux multi-monitor fullscreen support
[ryzomcore.git] / studio / src / plugins / object_viewer / sound_system.h
blobedbf82403eb5212ae80e9c1501d52db7af1c113c
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2010-2011 Dzmitry KAMIAHIN (dnk-88) <dnk-88@tut.by>
6 //
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>
26 // NeL includes
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>
32 // STL includes
33 #include <string>
34 #include <set>
36 namespace NLSOUND
38 class UAudioMixer;
39 class USource;
42 namespace NLMISC
44 class CMatrix;
47 namespace NLQT
50 /**
51 @class CSoundSystem
52 @brief This class init the sound system used by the object viewer
54 class CSoundSystem
56 public:
57 CSoundSystem();
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
79 void init(void);
81 /// Release the sound system
82 void release(void);
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)
108 return _AudioMixer;
111 /// Returns a reference to the animation manager
112 NLSOUND::CSoundAnimManager *getSoundAnimManager()
114 return _AnimManager;
117 /// Init the particle system sound with the given AudioMixer
118 void initGraphics();
120 /// Release the particle system sound with the given AudioMixer
121 void releaseGraphics();
123 /// Update sound. Must be called periodically
124 void update();
126 private:
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