00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef ISOUND_H__
00012 #define ISOUND_H__
00013
00014 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00015 namespace Audio
00016 {
00017 #endif
00018
00020
00022 struct BackgroundInit
00023 {
00025 BackgroundInit() { Clear(); }
00027 void Clear()
00028 {
00029 m_pSound = 0;
00030 m_fMinVolume = 1.0f;
00031 m_fMaxVolume = 1.0f;
00032 m_fMinVolumeTime = 0.0f;
00033 m_fMaxVolumeTime = 0.0f;
00034 m_fMinPitch = 1.0f;
00035 m_fMaxPitch = 1.0f;
00036 m_fMinPitchTime = 0.0f;
00037 m_fMaxPitchTime = 0.0f;
00038 };
00039
00041 ISound* m_pSound;
00043 float m_fMinVolume;
00045 float m_fMaxVolume;
00047 float m_fMinVolumeTime;
00049 float m_fMaxVolumeTime;
00051 float m_fMinPitch;
00053 float m_fMaxPitch;
00055 float m_fMinPitchTime;
00057 float m_fMaxPitchTime;
00058 };
00059
00061 struct PeriodicInit
00062 {
00064 PeriodicInit() { Clear(); }
00066 void Clear()
00067 {
00068 m_pSound3D = 0;
00069 m_fMinPitch = 1.0f;
00070 m_fMaxPitch = 1.0f;
00071 m_fMinDelay = 0.0f;
00072 m_fMaxDelay = 0.0f;
00073 m_fXRange = 25.0f;
00074 m_fYRange = 25.0f;
00075 m_fZRange = 25.0f;
00076 m_fMinDistance = 0.0f;
00077 };
00079 ISound3D* m_pSound3D;
00081 float m_fMinPitch;
00083 float m_fMaxPitch;
00085 float m_fMinDelay;
00087 float m_fMaxDelay;
00089 float m_fXRange;
00091 float m_fYRange;
00093 float m_fZRange;
00095 float m_fMinDistance;
00096 };
00097
00098
00100
00105 class ISoundScape : public IPlayable
00106 {
00107 public:
00108 virtual bool Init() = 0;
00109
00115 virtual bool AddElement(const BackgroundInit& init) = 0;
00121 virtual bool AddElement(const PeriodicInit& init) = 0;
00122
00131 virtual bool SetVolume(float fVolume) = 0;
00138 virtual bool GetVolume(float& fVolume) const = 0;
00139
00140 };
00141
00143
00149 class ISoundManager
00150 {
00151 public:
00152
00160 virtual bool Init() = 0;
00168 virtual void Term() = 0;
00175 virtual bool IsInitialized() = 0;
00176
00184 virtual bool LoadScript(std::string sFileName) = 0;
00193 virtual bool RemoveAll() = 0;
00194
00204 virtual bool GetSound(std::string sSoundName, ISound*& pSound) = 0;
00211 virtual bool GetSoundInit(std::string sSoundName, SoundInit& init) = 0;
00212 virtual bool ReleaseSound(std::string sSoundName, ISound* pSound) = 0;
00213 virtual bool IsSoundRegistered(std::string sSoundName) = 0;
00214 virtual void ResetSoundItr() = 0;
00215 virtual bool GetNextSound(std::string& sSoundName) = 0;
00216 virtual bool RemoveSound(std::string sSoundName) = 0;
00217 virtual bool RemoveAllSounds() = 0;
00218
00228 virtual bool GetSound3D(std::string sSound3DName, ISound3D*& pSound3D) = 0;
00235 virtual bool GetSound3DInit(std::string sSound3DName, Sound3DInit& init) = 0;
00236 virtual bool ReleaseSound3D(std::string sSound3DName, ISound3D* pSound3D) = 0;
00237 virtual bool IsSound3DRegistered(std::string sSound3DName) = 0;
00238 virtual void ResetSound3DItr() = 0;
00239 virtual bool GetNextSound3D(std::string& sSound3DName) = 0;
00240 virtual bool RemoveSound3D(std::string sSound3DName) = 0;
00241 virtual bool RemoveAllSounds3D() = 0;
00242
00243 virtual bool CreateSoundScape(ISoundScape*& pSoundScape) = 0;
00244 virtual bool InitSoundScape(std::string sSoundScapeName, ISoundScape*& pSoundScape) = 0;
00245 virtual bool IsSoundScapeRegistered(std::string sSoundScapeName) = 0;
00246 virtual void ResetSoundScapeItr() = 0;
00247 virtual bool GetNextSoundScape(std::string& sSoundScapeName) = 0;
00248 virtual bool RemoveSoundScape(std::string sSoundScapeName) = 0;
00249 virtual bool RemoveAllSoundScapes() = 0;
00250 };
00251
00257 inline static ISoundManager* SoundMgr()
00258 { return AudioScriptFactory::GetSoundMgr(); }
00259
00260 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00261 };
00262 #endif
00263
00264 #endif // ISOUND_H__