Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.7 KiB

  1. //
  2. // waves.h
  3. //
  4. #ifndef _WAVES_H_
  5. #define _WAVES_H_
  6. #include <mmsystem.h>
  7. #define NUM_TONES 21
  8. #define NUM_WAVES 22
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // class CWavePlayer
  12. //
  13. // Implements tone player for a single phone device.
  14. //
  15. class CWavePlayer
  16. {
  17. public:
  18. DECLARE_TRACELOG_CLASS(CWavePlayer)
  19. CWavePlayer();
  20. ~CWavePlayer();
  21. HRESULT Initialize(void);
  22. HRESULT OpenMixerDevice(long lWaveId);
  23. void CloseMixerDevice(void);
  24. HRESULT OpenWaveDeviceForTone(long lWaveId);
  25. HRESULT OpenWaveDeviceForRing(long lWaveId);
  26. void CloseWaveDeviceForTone(void);
  27. void CloseWaveDeviceForRing(void);
  28. BOOL IsInitialized(void) { return m_fInitialized; }
  29. BOOL IsInUse(void) { return ((m_hWaveOutTone != NULL) || (m_hWaveOutRing != NULL) || (m_hMixer != NULL)); }
  30. HRESULT StartTone(long lTone);
  31. HRESULT StartRing();
  32. HRESULT StopTone(long lTone);
  33. HRESULT StopRing(void);
  34. BOOL PlayingTone(long lTone);
  35. HRESULT SetVolume( DWORD dwVolume );
  36. HRESULT GetVolume( DWORD * pdwVolume );
  37. private:
  38. HRESULT ChangeTone();
  39. // TRUE if Initialize has succeeded.
  40. BOOL m_fInitialized;
  41. // Handle to the wave out device. NULL when the device is not open.
  42. HWAVEOUT m_hWaveOutTone;
  43. HWAVEOUT m_hWaveOutRing;
  44. HMIXER m_hMixer;
  45. MIXERCONTROL m_mxctrl;
  46. // Wave headers
  47. WAVEHDR m_WaveHeaderTone;
  48. WAVEHDR m_WaveHeaderRing;
  49. // Buffers for the tones
  50. LPBYTE m_lpWaveform[ NUM_WAVES ];
  51. DWORD m_dwWaveformSize[ NUM_WAVES ];
  52. BOOL m_fPlaying[ NUM_TONES ];
  53. LONG m_lCurrentTone;
  54. };
  55. #endif // _WAVES_H_