-
Notifications
You must be signed in to change notification settings - Fork 7.1k
/
Copy pathMciPlayer.h
71 lines (54 loc) · 1.19 KB
/
MciPlayer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef _MCI_PLAYER_WIN32_H_
#define _MCI_PLAYER_WIN32_H_
#include<windows.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 m_hWnd;
MCIDEVICEID m_hDev;
UINT m_nSoundID;
UINT m_uTimes;
bool m_bPlaying;
};
} // end of namespace CocosDenshion
#endif