Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 244 | chris | 1 | #ifndef __DSOUNDMANAGER_H__ |
| 2 | #define __DSOUNDMANAGER_H__ |
||
| 3 | |||
| 4 | #include "dsoundversion.h" |
||
| 5 | #include "SoundManager.h" |
||
| 6 | |||
| 7 | namespace Sexy |
||
| 8 | { |
||
| 9 | |||
| 10 | class DSoundInstance; |
||
| 11 | |||
| 12 | class DSoundManager : public SoundManager |
||
| 13 | { |
||
| 14 | friend class DSoundInstance; |
||
| 15 | friend class DSoundMusicInterface; |
||
| 16 | |||
| 17 | protected: |
||
| 18 | LPDIRECTSOUNDBUFFER mSourceSounds[MAX_SOURCE_SOUNDS]; |
||
| 19 | std::string mSourceFileNames[MAX_SOURCE_SOUNDS]; |
||
| 20 | LPDIRECTSOUNDBUFFER mPrimaryBuffer; |
||
| 21 | ulong mSourceDataSizes[MAX_SOURCE_SOUNDS]; |
||
| 22 | double mBaseVolumes[MAX_SOURCE_SOUNDS]; |
||
| 23 | int mBasePans[MAX_SOURCE_SOUNDS]; |
||
| 24 | DSoundInstance* mPlayingSounds[MAX_CHANNELS]; |
||
| 25 | double mMasterVolume; |
||
| 26 | DWORD mLastReleaseTick; |
||
| 27 | |||
| 28 | protected: |
||
| 29 | int FindFreeChannel(); |
||
| 30 | int VolumeToDB(double theVolume); |
||
| 31 | bool LoadOGGSound(unsigned int theSfxID, const std::string& theFilename); |
||
| 32 | bool LoadFModSound(unsigned int theSfxID, const std::string& theFilename); |
||
| 33 | bool LoadWAVSound(unsigned int theSfxID, const std::string& theFilename); |
||
| 34 | bool LoadAUSound(unsigned int theSfxID, const std::string& theFilename); |
||
| 35 | bool WriteWAV(unsigned int theSfxID, const std::string& theFilename, const std::string& theDepFile); |
||
| 36 | bool GetTheFileTime(const std::string& theDepFile, FILETIME* theFileTime); |
||
| 37 | void ReleaseFreeChannels(); |
||
| 38 | |||
| 39 | public: |
||
| 40 | LPDIRECTSOUND mDirectSound; |
||
| 41 | bool mHaveFMod; |
||
| 42 | |||
| 43 | DSoundManager(HWND theHWnd, bool haveFMod); |
||
| 44 | virtual ~DSoundManager(); |
||
| 45 | |||
| 46 | virtual bool Initialized(); |
||
| 47 | |||
| 48 | virtual bool LoadSound(unsigned int theSfxID, const std::string& theFilename); |
||
| 49 | virtual int LoadSound(const std::string& theFilename); |
||
| 50 | virtual void ReleaseSound(unsigned int theSfxID); |
||
| 51 | |||
| 52 | virtual void SetVolume(double theVolume); |
||
| 53 | virtual bool SetBaseVolume(unsigned int theSfxID, double theBaseVolume); |
||
| 54 | virtual bool SetBasePan(unsigned int theSfxID, int theBasePan); |
||
| 55 | |||
| 56 | virtual SoundInstance* GetSoundInstance(unsigned int theSfxID); |
||
| 57 | |||
| 58 | virtual void ReleaseSounds(); |
||
| 59 | virtual void ReleaseChannels(); |
||
| 60 | |||
| 61 | virtual double GetMasterVolume(); |
||
| 62 | virtual void SetMasterVolume(double theVolume); |
||
| 63 | |||
| 64 | virtual void Flush(); |
||
| 65 | |||
| 66 | virtual void SetCooperativeWindow(HWND theHWnd, bool isWindowed); |
||
| 67 | virtual void StopAllSounds(); |
||
| 68 | virtual int GetFreeSoundId(); |
||
| 69 | virtual int GetNumSounds(); |
||
| 70 | }; |
||
| 71 | |||
| 72 | } |
||
| 73 | |||
| 74 | #endif //__DSOUNDMANAGER_H__ |