www.pudn.com > 3D_Tank.rar > Sound.h


#ifndef __SOUND_H__ 
#define __SOUND_H__ 
 
#include  
#include  
#include  
#include  
#include  
#include  
#include "ComPtr.h" 
#include "Error.h" 
#include "D:\DX90SDK\Samples\C++\Common\dsutil.h" 
 
#pragma comment(lib, "dxerr9.lib") 
 
typedef std::vector >	vecSound; 
typedef std::map				mapSound; 
 
struct DSDevice 
{ 
	GUID		guid; 
	std::string strDevice; 
}; 
 
typedef std::vector vecDSDevice; 
 
BOOL CALLBACK DSEnumCallback(LPGUID  lpGuid, LPCSTR  lpcstrDescription,  
							 LPCSTR  lpcstrModule, LPVOID  lpContext); 
 
class CSoundSet  
{ 
public: 
	CSoundSet(); 
	~CSoundSet(); 
	BOOL InitSoundDevice(HWND hwnd); 
	BOOL AddSoundEffect(LPTSTR lptstrFile); 
	BOOL Play(LPTSTR lptstrFile); 
	BOOL AddStreamSound(LPTSTR lptstrFile); 
 
private: 
	CComPtr			m_pSound;			//设备接口 
	CComPtr		m_pPrimaryBuffer;	//主声音缓存 
	mapSound						m_mapSound;			//音效 
	CComPtr	m_StreamSound;		//流式缓冲 
 
	HANDLE							m_handleStart; 
	HANDLE							m_handleMiddle; 
	 
	vecDSDevice						m_vecDevice;		//支持DirectSound的驱动程序 
	HWND							m_hWindow;			//应用程序窗口句柄 
 
	CWaveFile						m_wavStream; 
}; 
 
 
#endif   //CSound 类