⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 player.h

📁 This source can emulate function generator using sound card. This source is very useful for sound c
💻 H
字号:
#ifndef _PLAYER_INCLUDED
#define _PLAYER_INCLUDED

#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include <vector>
#include "IPlayer.h"


#pragma comment(lib, "dsound.lib")
#pragma comment(lib, "dxguid.lib")

class Player : public IPlayer
{
private :
	SOUNDFORMAT m_format;						// Format for a sound buffer, 
											//	as describe in IPlayer.h

	LPDIRECTSOUNDBUFFER	m_lpDSBuffer;		// DirectSound buffer
	LPDIRECTSOUND m_lpDS;					// DirectSound object
	HWND m_hWnd;							// Window handler

	HANDLE* m_pReadEvent;
	HANDLE m_hNotifyEndThread;
	LPDIRECTSOUNDNOTIFY m_lpdsNotify;
	DSBPOSITIONNOTIFY* m_pDSNotify;

	int m_nbReadEvent;

	IPlayer::SoundEventListener* objectListener;
		

public :
	Player();
	~Player();
		
	virtual void Init();
	void SetHWnd(HWND p_hWnd);

	virtual void Play(long p_flag);
	virtual void Stop();	
	virtual bool CreateSoundBuffer(SOUNDFORMAT format, long bufferLength, long event);
	virtual void Write(long start, BYTE* data, long size);
	virtual bool CreateEventReadNotification(std::vector<DWORD>&p_event);	
	virtual void SetSoundEventListener(IPlayer::SoundEventListener* p_listener);
	virtual void RemoveSoundEventListener();

private :	
	class Mutex* m_mutex;

	void CallEvent(int eventNumber);
	void WaitNotif();

	static void WaitForNotify(Player* p_player) ;

};

#endif	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -