Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SceneManager.h
Go to the documentation of this file.
1 //
2 // C++ Interface: Audio::SceneManager
3 //
4 #ifndef __AUDIO_SCENEMANAGER_H__INCLUDED__
5 #define __AUDIO_SCENEMANAGER_H__INCLUDED__
6 
7 #include <string>
8 #include <map>
9 #include <set>
10 #include "Exceptions.h"
11 #include "Singleton.h"
12 #include "Types.h"
13 #include "VirtualIterator.h"
14 
15 
16 namespace Audio {
17 
18  // Some forwards, we don't need to know the details of those classes
19  class Renderer;
20  class Scene;
21  class SourceTemplate;
22  class Source;
23  class Sound;
24  class Listener;
25 
26  namespace __impl {
27 
28  // Forward declaration of internal scene manager data
29  struct SceneManagerData;
30 
31  };
32 
59  class SceneManager : public Singleton<SceneManager>
60  {
61  private:
62  AutoPtr<__impl::SceneManagerData> data;
63 
64  public:
66 
67  protected:
71  const SharedPtr<Renderer>& internalRenderer() const;
72 
73  public:
79  SceneManager() throw();
80 
81  virtual ~SceneManager();
82 
88  virtual SharedPtr<Source> createSource(SharedPtr<Sound> sound, bool looping = false) throw(Exception);
89 
93  SharedPtr<Source> createSource(SharedPtr<SourceTemplate> tpl) throw(Exception);
94 
101  SharedPtr<Source> createSource(SharedPtr<SourceTemplate> tpl, const std::string &name) throw(Exception);
102 
104  virtual void destroySource(SharedPtr<Source> source) throw();
105 
106 
107 
117  void playSource(
119  const std::string &sceneName,
120  LVector3 position,
121  Vector3 direction,
122  Vector3 velocity,
123  Scalar radius) throw(Exception);
124 
135  void playSource(
137  const std::string &soundName,
138  const std::string &sceneName,
139  LVector3 position,
140  Vector3 direction,
141  Vector3 velocity,
142  Scalar radius) throw(Exception);
143 
145  virtual SharedPtr<Scene> createScene(const std::string &name) throw(DuplicateObjectException);
146 
148  virtual SharedPtr<Scene> getScene(const std::string &name) const throw(NotFoundException);
149 
151  virtual void destroyScene(const std::string &name) throw(NotFoundException);
152 
154  virtual void setSceneActive(const std::string &name, bool active) throw(NotFoundException);
155 
157  virtual bool getSceneActive(const std::string &name) throw(NotFoundException);
158 
171  virtual SharedPtr<Listener> getRootListener() const throw();
172 
174  virtual SharedPtr<SceneIterator> getSceneIterator() const throw();
175 
177  virtual SharedPtr<SceneIterator> getActiveSceneIterator() const throw();
178 
188  virtual void setRenderer(SharedPtr<Renderer> renderer) throw(Exception);
189 
191  SharedPtr<Renderer> getRenderer() const throw();
192 
193 
194  /********* Scene cycle **********/
195 
205  virtual void commit() throw(Exception);
206 
213  Duration getPositionUpdateFrequency() const throw();
214 
223  Duration getListenerUpdateFrequency() const throw();
224 
232  Duration getAttributeUpdateFrequency() const throw();
233 
243  Duration getActivationFrequency() const throw();
244 
246  virtual void setPositionUpdateFrequency(Duration interval) const throw();
247 
249  virtual void setListenerUpdateFrequency(Duration interval) const throw();
250 
252  virtual void setAttributeUpdateFrequency(Duration interval) const throw();
253 
255  virtual void setActivationFrequency(Duration interval) const throw();
256 
257 
258  /********* Culling parameters **********/
259 
260 
269  virtual unsigned int getMaxSources() const throw();
270 
278  virtual void setMaxSources(unsigned int n) throw(Exception);
279 
291  virtual float getMinGain() const throw();
292 
297  virtual void setMinGain(float gain) throw(Exception);
298 
305  virtual double getMaxDistance() const throw();
306 
311  virtual void setMaxDistance(double distance) throw(Exception);
312 
313 
314  /*********** Notification events ************/
315 
317  virtual void notifySourcePlaying(SharedPtr<Source> source, SharedPtr<Scene> scene, bool playing) throw(Exception);
318 
319  protected:
321  void addScene(SharedPtr<Scene> scene) throw(DuplicateObjectException);
322 
324  virtual void activationPhaseImpl() throw(Exception);
325 
327  virtual void updateSourcesImpl(bool withAttributes) throw(Exception);
328 
333  virtual void updateListenerImpl(bool withAttributes) throw(Exception);
334  };
335 
336 };
337 
338 #endif//__AUDIO_SCENEMANAGER_H__INCLUDED__