#ifndef T2DLL_T2SOUNDPLAYER_H #define T2DLL_T2SOUNDPLAYER_H #include "../common.h" enum PLAYMODE { PlayMode_0, PlayMode_1, PlayMode_2, PlayMode_3 }; enum SOUNDPRIORITY { SoundPriority_0, SoundPriority_1, SoundPriority_2, SoundPriority_3 }; enum { SoundMask_2 = 2, SoundMask_10 = 0x10, SoundMask_20 = 0x20, }; enum { SoundFlags_1 = 1, SoundFlags_10 = 0x10, SoundFlags_20 = 0x20, SoundFlags_10000 = 0x10000 }; class AFX_CLASS_EXPORT T2SoundObjItem { public: T2SoundObjItem(); ~T2SoundObjItem(); enum { FileSource = 1, ResSource = 2 }; CString mName; SOUNDPRIORITY mPriority; LPDIRECTSOUNDBUFFER mDSBuffers[4]; DWORD mPlayedAt[4]; int mSourceKind; CString mPath; unsigned int mResID; HINSTANCE mModuleHandle; }; class AFX_CLASS_EXPORT T2SoundObjItemList : public CList { public: T2SoundObjItemList(); virtual ~T2SoundObjItemList(); }; class AFX_CLASS_EXPORT T2SoundPlayer : public CWnd { DECLARE_MESSAGE_MAP() public: T2SoundPlayer(CWnd* inParentWnd, IDirectSound* inDirectSound); virtual ~T2SoundPlayer(); void AddSound(const CString& inName, SOUNDPRIORITY inPriority, const CString& inPath); void AddSound(const CString& inName, SOUNDPRIORITY inPriority, unsigned int inResID, HINSTANCE inModule); void DeleteSound(const CString& inName); void DeleteSoundAll(); void Play(const CString& inName, unsigned int inMask, unsigned int inFlags, POINT* inPt, PLAYMODE inPlayMode, int inVolume); void Stop(const CString& inName); void StopAll(); void SetVolume(const CString& inName, int inVolume); void SetSoundOn(BOOL inSoundOn); void FadeOut(); void FadeIn(); void PlayCDTrack(int inTrack, BOOL inFlag); void StopCD(); unsigned int GetSEMask() const { return mSEMask; } void SetSEMask(unsigned int inMask) { mSEMask = inMask; } BOOL IsSoundOn() const { return mIsSoundOn; } protected: LRESULT OnMCINotify(WPARAM wParam, LPARAM lParam); private: BOOL LoadSound(T2SoundObjItem* inItem, const CString& inName, CWave& inWave, BOOL inReloadFlag); IDirectSound *mDirectSound; T2SoundObjItemList *mItemList; int mCurrentCDTrack; unsigned int mSEMask; BOOL mIsSoundOn; BOOL mIsFadeOut; }; #endif