#pragma once #include "common.h" enum PLAYMODE { PlayMode_0, PlayMode_1, PlayMode_2, PlayMode_3 }; enum SOUNDPRIORITY { SoundPriority_0, SoundPriority_1 }; enum { SoundMask_10 = 0x10 }; enum { SoundFlags_10 = 0x10, SoundFlags_10000 = 0x10000 }; class AFX_EXT_CLASS 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; }; class AFX_EXT_CLASS 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_EXT_CLASS T2SoundObjItemList : public CList { public: T2SoundObjItemList(); virtual ~T2SoundObjItemList(); };