www.pudn.com > CP_IVR.zip > HSound.h


// HSound.h: interface for the CHSound class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_HSOUND_H__337B018A_B6BF_4AF8_AB44_60952DFA6897__INCLUDED_) 
#define AFX_HSOUND_H__337B018A_B6BF_4AF8_AB44_60952DFA6897__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include  
#include "HPlayList.h" 
 
class CHSound   
{ 
private: 
	BOOL PlayNextFile(); 
	void PlayNextBuffer(MSG msg); 
	HPSTR Open( LPCTSTR szWaveFile, LPWAVEFORMATEX& lpWaveFmt, DWORD& dwDataSize ); 
 
	DWORD GetStatus(); 
	void SetStatus(DWORD dwCurStat); 
 
								  /* Thread to process messages like WM_DONE */ 
	static UINT CallBackThread (LPVOID pParam);	    
												/* Different possible states */ 
	#define STT_ASLEEP	0x00000001 
	#define STT_PREPARE	0x00000010 
	#define STT_PLAYING	0x00000100 
	#define STT_RSTTING	0x00001000 
	#define STT_CLOSING	0x00010000 
	#define STT_OPENING	0x00100000 
	#define STT_FILEOPN	0x01000000 
	#define STT_EXTRNRS	0x10000000 
 
	static	BOOL		m_bThreadContinue; 
	static	HANDLE		m_hStatEvent; 
	static	DWORD		m_dwStatus; 
	static	BOOL		m_bContinue; 
	 
	CRITICAL_SECTION	m_statusCrtcSec; 
	CRITICAL_SECTION	m_externalResetCrtcSec; 
	DWORD				m_dwCurrtBufIndex; 
	DWORD				m_dwBufCnt; 
	DWORD				m_dwMinBufSize; 
	DWORD				m_dwDataSize; 
	CWinThread			*m_pCallBackThread; 
	HWAVEOUT			m_hWaveOut; 
	// Just to make a function more quick! 
	HPSTR				m_lpData, m_lpBuf2; 
	DWORD				m_dwBLength; 
	MMRESULT			mmRes; 
	static LPWAVEHDR	m_lpWHdr; 
 
	CHPlayList			m_playList; 
							   /* Callback function to receive waveout events*/ 
	BOOL				m_bExitAfter, 
						m_bForceClose; 
	UINT				m_sndIndex; 
	CWnd*				m_wndTimer; 
	DWORD				m_dwDevId; 
	unsigned long		m_boss; 
 
public: 
	void SetManager(unsigned long mngrThread); 
	BOOL Reset(); 
	BOOL Play (DWORD dwDevId, LPCTSTR szWaveFile); 
	BOOL PlayList(DWORD dwDeviceId, BOOL bExitAfter = FALSE, BOOL bDisableForceExit = FALSE); 
	BOOL IsPlaying(); 
	BOOL Close();			  						    /* Close and Cleanup */ 
	BOOL Stop();										     /* Stop playing */ 
	BOOL Pause(); 
 
	void CleanPlayList(); 
	void AddToPlayList(CString szWaveFile); 
 
	void SetTimerWindow(CWnd* wndTimer); 
	void KillTimer(); 
	void SetTimer(); 
 
	CHSound(); 
	virtual ~CHSound(); 
}; 
 
#endif // !defined(AFX_HSOUND_H__337B018A_B6BF_4AF8_AB44_60952DFA6897__INCLUDED_)