00001 /* Crown and Cutlass 00002 * SoundSystem Header 00003 */ 00004 00005 #if !defined( _SOUNDSYSTEM_H_ ) 00006 00007 #define _SOUNDSYSTEM_H_ 00008 00009 #include <vector> 00010 #include <list> 00011 #include "ISubSystem.h" 00012 00013 using namespace std; 00014 00015 class ISound; 00016 class OpenALSource; 00017 00018 class SoundSystem: public ISubSystem { 00019 public: 00020 SoundSystem(unsigned int numSources); 00021 00022 ~SoundSystem(); 00023 00024 void LogDebugInfo(); 00025 00026 void SetListener(); 00027 00028 void Update(unsigned int ticks); 00029 00030 void Play(ISound *sound); 00031 00032 void PauseAll(); 00033 void StopAll(); 00034 00035 // Lock a sound, preventing its source from getting replaced 00036 // Use this feature carefully. It should probably only be used for background music 00037 void LockSound(ISound *sound); 00038 00039 OpenALSource* AquireSource(); 00040 void ReleaseSound(ISound *sound); 00041 00042 static void Initialize(unsigned int numSources); 00043 static void Shutdown(); 00044 00045 static SoundSystem *s_soundSystem; 00046 00047 private: 00048 vector< OpenALSource* > m_sources; 00049 vector< OpenALSource* > m_availSources; 00050 list< ISound* > m_playingSounds; 00051 00052 void MoveToFrontOfQueue(ISound *sound); 00053 }; 00054 00055 #endif
1.4.7