MusicPlace.h
资源名称:LwGame2.0.rar [点击查看]
上传用户:semy2100
上传日期:2013-01-22
资源大小:3633k
文件大小:2k
源码类别:
射击游戏
开发平台:
Visual C++
- /********************************************************************
- * 空运爆发 *
- * Version 2.0 *
- * 本游戏全部代码由: *
- * 冲天实验室 梁锋 编写 *
- * 邮箱:lenwine@126.com *
- * bbs: http://free2.e-168.cn/lenwind (正在开发中...) *
- **********************************************************************/
- #ifndef MUSICPLACE
- #define MUSICPLACE
- //设置两个全局变量控制音量
- extern int m_bMusVoLF;//用控制背景音乐音量大小
- extern int m_cMusVoLF;//用于控制音效音量大小
- //wave 文件头格式
- struct LWaveF
- {
- BYTE RIFF[4]; //"RIFF"
- DWORD dwSize; //Size of data to follow
- BYTE WAVE[4]; //"WAVE"
- BYTE fmt_[4]; //"fmt"
- DWORD dw16; //16
- WORD wOne_O; //1
- WORD wChnls; //Number of Channels
- DWORD dwSRate; //Sample Rate
- DWORD BytesPerSec; //Sample Rate
- WORD wBlkAlign; //1
- WORD BitsPerSample; //Sample size
- BYTE DATA[4]; //"DATA"
- DWORD dwDSize; //Number of Samples
- };
- class MusicPlace
- {
- protected:
- LPDIRECTSOUNDBUFFER m_lMusBuf;//声音缓冲区对象
- public:
- MusicPlace(const char* FileName,BOOL m_bgMusic,LPDIRECTSOUND lpDS,DWORD dwFlags=DSBCAPS_CTRLVOLUME);
- virtual ~MusicPlace();
- public:
- BOOL ActionPlay(BOOL bContinue=FALSE);//播放声音
- BOOL ActionStop();
- BOOL CreateSoundBuffer(LPDIRECTSOUND lpDS,DWORD dwFlags,DWORD dwBufSize,DWORD dwFreq,DWORD dwBitsPerSample,DWORD dwBlkAlign,BOOL bStereo);
- BOOL Access(FILE* pFile,DWORD dwSize,DWORD dwPos);//数据访问
- BOOL bTrue();
- LPDIRECTSOUNDBUFFER GetBuffer(){return m_lMusBuf;}
- void CtrlVolume(int vol=0);//设置音量
- private:
- BOOL m_lenbm;//判断背景音乐
- };
- #endif