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.

76 lines
2.2 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999, 2000 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: wavformat.h
  6. * Content:
  7. * This module contains the CWaveFormat class which is used to work with
  8. * WAVEFORMATEX structures.
  9. *
  10. * History:
  11. * Date By Reason
  12. * ==== == ======
  13. * 07/06/00 rodtoll Created
  14. *
  15. ***************************************************************************/
  16. #ifndef __WAVFORMAT_H
  17. #define __WAVFORMAT_H
  18. /////////////////////////////////////////////////////////////////////
  19. //
  20. // CWaveFormat
  21. //
  22. // Used to store and manipulate WAVEFORMATEX structures.
  23. //
  24. class CWaveFormat
  25. {
  26. public:
  27. CWaveFormat(): m_pwfxFormat(NULL), m_fOwned(FALSE) {};
  28. ~CWaveFormat() { Cleanup(); };
  29. // Initialize with full parameters
  30. HRESULT Initialize( WORD wFormatTag, DWORD nSamplesPerSec, WORD nChannels, WORD wBitsPerSample,
  31. WORD nBlockAlign, DWORD nAvgBytesPerSec, WORD cbSize, void *pvExtra );
  32. // Initialize and copy the specified format
  33. HRESULT InitializeCPY( LPWAVEFORMATEX pwfxFormat, void *pvExtra );
  34. // Build a standard PCM format
  35. HRESULT InitializePCM( WORD wHZ, BOOL fStereo, BYTE bBitsPerSample );
  36. // Create a WAVEFORMAT that is of size dwSize
  37. HRESULT InitializeMEM( DWORD dwSize );
  38. // Initialize but unowned
  39. HRESULT InitializeUSE( WAVEFORMATEX *pwfxFormat );
  40. // Initialize from registry
  41. HRESULT InitializeREG( HKEY hKeyRoot, const WCHAR *wszPath );
  42. // Set this object equal to the parameter
  43. HRESULT SetEqual( CWaveFormat *pwfxFormat );
  44. // Are these two types equal?
  45. BOOL IsEqual( CWaveFormat *pwfxFormat );
  46. // Return a pointer to the format
  47. inline WAVEFORMATEX *GetFormat() { return m_pwfxFormat; };
  48. inline WAVEFORMATEX *Disconnect() { m_fOwned = FALSE; return GetFormat(); };
  49. // Is this an eight bit waveformat?
  50. inline BOOL IsEightBit() const { return (m_pwfxFormat->wBitsPerSample==8); };
  51. // Write the contained value to the registry
  52. HRESULT WriteREG( HKEY hKeyRoot, const WCHAR *wszPath );
  53. protected:
  54. void Cleanup();
  55. WAVEFORMATEX *m_pwfxFormat;
  56. BOOL m_fOwned;
  57. };
  58. #endif