summaryrefslogtreecommitdiff
path: root/osframework/source/SexyAppFramework/DSoundManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'osframework/source/SexyAppFramework/DSoundManager.h')
-rw-r--r--osframework/source/SexyAppFramework/DSoundManager.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/osframework/source/SexyAppFramework/DSoundManager.h b/osframework/source/SexyAppFramework/DSoundManager.h
new file mode 100644
index 0000000..4be2cad
--- /dev/null
+++ b/osframework/source/SexyAppFramework/DSoundManager.h
@@ -0,0 +1,74 @@
+#ifndef __DSOUNDMANAGER_H__
+#define __DSOUNDMANAGER_H__
+
+#include "dsoundversion.h"
+#include "SoundManager.h"
+
+namespace Sexy
+{
+
+class DSoundInstance;
+
+class DSoundManager : public SoundManager
+{
+ friend class DSoundInstance;
+ friend class DSoundMusicInterface;
+
+protected:
+ LPDIRECTSOUNDBUFFER mSourceSounds[MAX_SOURCE_SOUNDS];
+ std::string mSourceFileNames[MAX_SOURCE_SOUNDS];
+ LPDIRECTSOUNDBUFFER mPrimaryBuffer;
+ ulong mSourceDataSizes[MAX_SOURCE_SOUNDS];
+ double mBaseVolumes[MAX_SOURCE_SOUNDS];
+ int mBasePans[MAX_SOURCE_SOUNDS];
+ DSoundInstance* mPlayingSounds[MAX_CHANNELS];
+ double mMasterVolume;
+ DWORD mLastReleaseTick;
+
+protected:
+ int FindFreeChannel();
+ int VolumeToDB(double theVolume);
+ bool LoadOGGSound(unsigned int theSfxID, const std::string& theFilename);
+ bool LoadFModSound(unsigned int theSfxID, const std::string& theFilename);
+ bool LoadWAVSound(unsigned int theSfxID, const std::string& theFilename);
+ bool LoadAUSound(unsigned int theSfxID, const std::string& theFilename);
+ bool WriteWAV(unsigned int theSfxID, const std::string& theFilename, const std::string& theDepFile);
+ bool GetTheFileTime(const std::string& theDepFile, FILETIME* theFileTime);
+ void ReleaseFreeChannels();
+
+public:
+ LPDIRECTSOUND mDirectSound;
+ bool mHaveFMod;
+
+ DSoundManager(HWND theHWnd, bool haveFMod);
+ virtual ~DSoundManager();
+
+ virtual bool Initialized();
+
+ virtual bool LoadSound(unsigned int theSfxID, const std::string& theFilename);
+ virtual int LoadSound(const std::string& theFilename);
+ virtual void ReleaseSound(unsigned int theSfxID);
+
+ virtual void SetVolume(double theVolume);
+ virtual bool SetBaseVolume(unsigned int theSfxID, double theBaseVolume);
+ virtual bool SetBasePan(unsigned int theSfxID, int theBasePan);
+
+ virtual SoundInstance* GetSoundInstance(unsigned int theSfxID);
+
+ virtual void ReleaseSounds();
+ virtual void ReleaseChannels();
+
+ virtual double GetMasterVolume();
+ virtual void SetMasterVolume(double theVolume);
+
+ virtual void Flush();
+
+ virtual void SetCooperativeWindow(HWND theHWnd, bool isWindowed);
+ virtual void StopAllSounds();
+ virtual int GetFreeSoundId();
+ virtual int GetNumSounds();
+};
+
+}
+
+#endif //__DSOUNDMANAGER_H__ \ No newline at end of file