SoundOut.h
上传用户:onsales
上传日期:2010-01-31
资源大小:224k
文件大小:1k
源码类别:

网络编程

开发平台:

Visual C++

  1. // SoundOut.h: interface for the CSoundOut class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_SOUNDOUT_H__B67ADB63_05A3_11D4_8D3A_000021E6766A__INCLUDED_)
  5. #define AFX_SOUNDOUT_H__B67ADB63_05A3_11D4_8D3A_000021E6766A__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "mmsystem.h"
  10. #include "math.h"
  11. class CSoundOut  
  12. {
  13. public:
  14. CSoundOut();
  15. virtual ~CSoundOut();
  16. public:
  17. MMRESULT OpenSpk();
  18. void     WriteData(char *lpData,long length);
  19. void     StartSpk();
  20. void     CloseSpk();
  21. void     AddBuffer();
  22. void     SetBits(int bits){m_nBits=bits;}
  23. void     SetBuffer(char *pBuffer){m_pOutputBuffer=pBuffer;}
  24. void     SetBlockProp(long samples,int num){m_nBlock=samples;m_nBlockNum=num;}
  25. void     SetSampleRate(UINT nSampleRate){m_WaveOutSampleRate=nSampleRate;}
  26. HANDLE m_WaveOutEvent;
  27. CWinThread * m_WaveOutThread;
  28. BOOL m_TerminateThread;
  29. private:
  30. void WaveInitFormat(WORD nCh,DWORD nSampleRate,WORD BitsPerSample);
  31. char * m_pOutputBuffer;
  32. WAVEOUTCAPS m_WaveOutDevCaps;
  33.     HWAVEOUT m_WaveOut;
  34. WAVEHDR* m_WaveHeader;
  35.     WAVEFORMATEX m_WaveFormat;
  36. UINT m_WaveOutSampleRate;
  37. long m_nBlock;
  38. int m_nBlockNum;
  39. int m_nBits;
  40. int m_nCurrent;
  41. };
  42. #endif // !defined(AFX_SOUNDOUT_H__B67ADB63_05A3_11D4_8D3A_000021E6766A__INCLUDED_)