mirror of https://github.com/axmolengine/axmol.git
76 lines
1.3 KiB
C++
76 lines
1.3 KiB
C++
#ifndef _MCI_PLAYER_WIN32_H_
|
||
#define _MCI_PLAYER_WIN32_H_
|
||
|
||
#include "CCStdC.h"
|
||
#include <mmsystem.h>
|
||
#include <string>
|
||
using namespace std;
|
||
|
||
|
||
namespace CocosDenshion {
|
||
|
||
class MciPlayer
|
||
{
|
||
public:
|
||
MciPlayer();
|
||
~MciPlayer();
|
||
|
||
void Close();
|
||
|
||
/**
|
||
@brief 播放声音文件
|
||
@param pFileName 播放的声音文件名称,需要包含文件的路径
|
||
@param nTimes 播放声音文件的循环次数,默认值为 1,即播放一次
|
||
*/
|
||
void Open(const char* pFileName, UINT uId);
|
||
|
||
void Play(UINT uTimes = 1);
|
||
|
||
/**
|
||
@brief 暂停播放声音
|
||
*/
|
||
void Pause();
|
||
|
||
/**
|
||
@brief 继续播放声音
|
||
*/
|
||
void Resume();
|
||
|
||
/**
|
||
@brief 停止播放声音
|
||
*/
|
||
void Stop();
|
||
|
||
/**
|
||
@brief 重新播放
|
||
*/
|
||
void Rewind();
|
||
|
||
/**
|
||
@brief 获取播放器当前是否正在播放中
|
||
*/
|
||
bool IsPlaying();
|
||
|
||
/**
|
||
@brief 获取当前播放的音效 ID
|
||
@return 当前播放的音效ID
|
||
*/
|
||
UINT GetSoundID();
|
||
|
||
private:
|
||
friend LRESULT WINAPI _SoundPlayProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||
|
||
void _SendGenericCommand(int nCommand, DWORD_PTR param1 = 0, DWORD_PTR parma2 = 0);
|
||
|
||
HWND _wnd;
|
||
MCIDEVICEID _dev;
|
||
UINT _soundID;
|
||
UINT _times;
|
||
bool _playing;
|
||
std::string strExt;
|
||
};
|
||
|
||
} // end of namespace CocosDenshion
|
||
|
||
#endif
|