mirror of https://github.com/axmolengine/axmol.git
68 lines
1.1 KiB
C++
68 lines
1.1 KiB
C++
#ifndef _MCI_PLAYER_UPHONE_H_
|
||
#define _MCI_PLAYER_UPHONE_H_
|
||
|
||
#include<windows.h>
|
||
#include <mmsystem.h>
|
||
|
||
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);
|
||
|
||
HWND m_hWnd;
|
||
MCIDEVICEID m_hDev;
|
||
UINT m_nSoundID;
|
||
UINT m_uTimes;
|
||
bool m_bPlaying;
|
||
};
|
||
|
||
#endif
|