axmol/CocosDenshion/win32/MciPlayer.h

72 lines
1.2 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _MCI_PLAYER_WIN32_H_
#define _MCI_PLAYER_WIN32_H_
#include "CCStdC.h"
#include <mmsystem.h>
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);
HWND _wnd;
MCIDEVICEID _dev;
UINT _soundID;
UINT _times;
bool _playing;
};
} // end of namespace CocosDenshion
#endif