PlaySound.h
上传用户:panstart
上传日期:2022-04-12
资源大小:199k
文件大小:2k
源码类别:

IP电话/视频会议

开发平台:

C++ Builder

  1. // PlaySound1.h: interface for the PlaySound1 class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_PlaySound_H__676E24A1_615E_11D6_889A_000B2B0F84B6__INCLUDED_)
  5. #define AFX_PlaySound_H__676E24A1_615E_11D6_889A_000B2B0F84B6__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #define WM_PLAYSOUND_STARTPLAYING WM_USER+600
  10. #define WM_PLAYSOUND_STOPPLAYING WM_USER+601
  11. #define WM_PLAYSOUND_PLAYBLOCK WM_USER+602
  12. #define WM_PLAYSOUND_ENDTHREAD  WM_USER+603
  13. #define SOUNDSAMPLES 1000
  14. #define PLAYBUFFER   600
  15. #define SAMPLEPSEC   8000
  16. /*
  17. #ifndef WAVE_FORMAT_GSM610
  18. #define WAVE_FORMAT_GSM610 (0x0031)
  19. #endif
  20. */
  21. #include<afxmt.h>
  22. #include<mmsystem.h>
  23. class PlaySound1 : public CWinThread  
  24. {
  25. DECLARE_DYNCREATE(PlaySound1)
  26. public:
  27. /*
  28.  For GSM WAVE FORMAT uncomment this..and comment next line...
  29.  struct wave
  30. {
  31. WAVEFORMATEX wfx;
  32. WORD wSamplesPerBlock;
  33. }m_WaveFormatEx;
  34. */
  35. WAVEFORMATEX m_WaveFormatEx; 
  36. BOOL Playing;
  37. HWAVEOUT m_hPlay;
  38. CStdioFile log;
  39. CDialog *dlg;
  40. PlaySound1();
  41. PlaySound1(CDialog *dlg);
  42. virtual ~PlaySound1();
  43. BOOL InitInstance();
  44. int ExitInstance();
  45. void displayError(int code,char []);
  46. void displayHeader(LPWAVEHDR lphdr);
  47. LPWAVEHDR CreateWaveHeader(CString mesg);
  48. void ProcessSoundData(short int *sound, DWORD dwSamples);
  49. void GetDevProperty();
  50. afx_msg LRESULT OnStartPlaying(WPARAM wParam, LPARAM lParam);
  51. afx_msg LRESULT OnStopPlaying(WPARAM wParam, LPARAM lParam);
  52. afx_msg LRESULT OnEndPlaySoundData(WPARAM wParam, LPARAM lParam);
  53. afx_msg LRESULT OnWriteSoundData(WPARAM wParam, LPARAM lParam);
  54. afx_msg LRESULT OnEndThread(WPARAM wParam, LPARAM lParam);
  55. DECLARE_MESSAGE_MAP()
  56. };
  57. #endif // !defined(AFX_PlaySound_H__676E24A1_615E_11D6_889A_000B2B0F84B6__INCLUDED_)