Cafu Engine
MixerTrackMan.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_SOUNDSYS_MIXER_TRACK_MAN_HPP_INCLUDED
8 #define CAFU_SOUNDSYS_MIXER_TRACK_MAN_HPP_INCLUDED
9 
10 #include "Templates/Array.hpp"
11 
12 
13 class MixerTrackT;
14 
15 
16 /// The mixer track manager manages the limited mixer tracks that are needed to playback a sound object.
18 {
19  public:
20 
21  /// Returns an instance to the global mixer track manager.
22  static MixerTrackManT* GetInstance();
23 
24  /// Interface to get a free mixer track that can be used to playback a sound object.
25  /// The method checks all currently available mixer tracks for one that is no longer used (sound object
26  /// attached to it is no longer playing) and returns it. If no "free" mixer track is found it attempts
27  /// to create a new one and returns it.
28  /// @param Priority The priority of this request for a mixer track. Usually one should use the priority of the
29  /// sound object this mixer track is intended for.
30  /// @return The mixer track that can be used for playback or NULL if no mixer track could be optained.
31  MixerTrackT* GetMixerTrack(unsigned int Priority=0);
32 
33  /// Deletes all mixer tracks that are currently unused (have no playing sound file attached to them).
34  void CleanUp();
35 
36  /// Calls Update() for all mixer tracks.
37  void UpdateAll();
38 
39  /// Releases all mixer tracks.
40  void ReleaseAll();
41 
42 
43 
44 
45  private:
46 
47  ArrayT<MixerTrackT*> MixerTracks; ///< The mixer tracks managed by this mixer track manager.
48 
49  /// Private constructor for singleton pattern.
51 
52  /// Destructor. Deletes all mixer tracks that are managed by this manager.
53  ~MixerTrackManT();
54 };
55 
56 #endif
MixerTrackT * GetMixerTrack(unsigned int Priority=0)
Interface to get a free mixer track that can be used to playback a sound object.
Definition: MixerTrackMan.cpp:33
A mixer track represents/encapsulates/abstracs an OpenAL sound source.
Definition: MixerTrack.hpp:22
void ReleaseAll()
Releases all mixer tracks.
Definition: MixerTrackMan.cpp:105
void CleanUp()
Deletes all mixer tracks that are currently unused (have no playing sound file attached to them)...
Definition: MixerTrackMan.cpp:81
The mixer track manager manages the limited mixer tracks that are needed to playback a sound object...
Definition: MixerTrackMan.hpp:17
void UpdateAll()
Calls Update() for all mixer tracks.
Definition: MixerTrackMan.cpp:98
static MixerTrackManT * GetInstance()
Returns an instance to the global mixer track manager.
Definition: MixerTrackMan.cpp:14