Source code of Windows XP (NT5)
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.

65 lines
1.8 KiB

  1. /*************************************************
  2. * wave.h *
  3. * *
  4. * Copyright (C) 1995-1999 Microsoft Inc. *
  5. * *
  6. *************************************************/
  7. // wave.h : header file
  8. //
  9. #ifndef __WAVE__
  10. #define __WAVE__
  11. #include "waveodev.h"
  12. #include "mmreg.h"
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CWave object
  15. class CWave : public CObject
  16. {
  17. DECLARE_SERIAL(CWave)
  18. public:
  19. CWave();
  20. ~CWave();
  21. BOOL Create(int nsamples, int samprate = 11025, int sampsize = 8);
  22. BOOL Play(CWaveOutDevice* pWaveOutDevice = NULL);
  23. void Stop();
  24. BOOL Load(char* pszFileName = NULL);
  25. BOOL Load(CFile* fp);
  26. BOOL Load(UINT_PTR hFile);
  27. BOOL Load(HMMIO hmmio);
  28. BOOL LoadResource(WORD wID);
  29. // Attributes
  30. public:
  31. WAVEFORMATEX* GetFormat()
  32. {return (WAVEFORMATEX*)&m_pcmfmt;}
  33. CWaveOutDevice* GetOutDevice()
  34. {return m_pOutDev;}
  35. int GetSize() {return m_iSize;}
  36. int GetNumSamples();
  37. int GetSample(int index);
  38. virtual void OnWaveOutDone();
  39. virtual void OnWaveInData();
  40. void SetSample(int index, int iValue);
  41. // Implementation
  42. public:
  43. void* GetSamples() {return m_pSamples;}
  44. BOOL IsBusy() {return m_bBusy;}
  45. void SetBusy(BOOL b) {m_bBusy = b;}
  46. protected:
  47. virtual void Serialize(CArchive& ar); // Overridden for document I/O
  48. private:
  49. PCMWAVEFORMAT m_pcmfmt; // PCM wave format header
  50. void* m_pSamples; // Pointer to the samples
  51. int m_iSize; // Size in bytes
  52. CWaveOutDevice *m_pOutDev; // Output device
  53. BOOL m_bBusy; // Set to TRUE if playing or recording
  54. };
  55. #endif // __WAVE__