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.

102 lines
3.8 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: sndutils.h
  6. * Content: Declares sound related untility functions
  7. *
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 07/16/99 rodtoll Created
  12. * 07/30/99 rodtoll Updated util functions to take GUIDs and allow for
  13. * users to pre-create capture/playback devices and
  14. * pass them into InitXXXXDuplex
  15. * 08/25/99 rodtoll General Cleanup/Modifications to support new
  16. * compression sub-system.
  17. * 08/30/99 rodtoll Added new playback format param to sound init
  18. * 11/12/99 rodtoll Updated full duplex test to use new abstracted recording
  19. * and playback systems.
  20. * rodtoll Updated to allow passing of sounddeviceconfig flags in dwflags
  21. * parameter to init is effected by the flags specified by user
  22. * 12/01/99 rodtoll Bug #115783 - Will always adjust volume of default device
  23. * Updated to eliminate pointer to GUIDs.
  24. * 01/27/2000 rodtoll Updated tests to accept buffer descriptions and play flags/priority
  25. * 07/12/2000 rodtoll Bug #31468 - Add diagnostic spew to logfile to show what is failing the HW Wizard
  26. * 08/03/2000 rodtoll Bug #41457 - DPVOICE: need way to discover which specific dsound call failed when returning DVERR_SOUNDINITFAILURE
  27. * 08/29/2000 rodtoll Bug #43553 and Bug #43620 - Buffer lockup handling.
  28. * 11/16/2000 rodtoll Bug #47783 - DPVOICE: Improve debugging of failures caused by DirectSound errors.
  29. *
  30. ***************************************************************************/
  31. class CAudioPlaybackBuffer;
  32. class CAudioPlaybackDevice;
  33. class CAudioRecordDevice;
  34. class CAudioRecordBuffer;
  35. //
  36. // This module contains the definition of sound relatedt utility
  37. // functions. Functions in this module manipulate WAVEFORMATEX
  38. // structures and provide full duplex initialization / testing
  39. // facilities.
  40. //
  41. // This module also contains the routines used to measure peak
  42. // of an audio buffer and for voice activation.
  43. //
  44. //
  45. #ifndef __SOUNDUTILS_H
  46. #define __SOUNDUTILS_H
  47. void DV_SetupBufferDesc( LPDSBUFFERDESC lpdsBufferDesc, LPDSBUFFERDESC lpdsBufferSource, LPWAVEFORMATEX lpwfxFormat, DWORD dwBufferSize );
  48. HRESULT InitFullDuplex(
  49. HWND hwnd,
  50. const GUID &guidPlayback,
  51. CAudioPlaybackDevice **audioPlaybackDevice,
  52. LPDSBUFFERDESC lpdsBufferDesc,
  53. CAudioPlaybackBuffer **audioPlaybackBuffer,
  54. const GUID &guidRecord,
  55. CAudioRecordDevice **audioRecordDevice,
  56. CAudioRecordBuffer **audioRecordBuffer,
  57. const GUID &guidCT,
  58. WAVEFORMATEX *primaryFormat,
  59. WAVEFORMATEX *lpwfxPlayFormat,
  60. BOOL aso,
  61. DWORD dwPlayPriority,
  62. DWORD dwPlayFlags,
  63. DWORD dwFlags
  64. );
  65. HRESULT InitHalfDuplex(
  66. HWND hwnd,
  67. const GUID &guidPlayback,
  68. CAudioPlaybackDevice **audioPlaybackDevice,
  69. LPDSBUFFERDESC lpdsBufferDesc,
  70. CAudioPlaybackBuffer **audioPlaybackBuffer,
  71. const GUID &guidCT,
  72. WAVEFORMATEX *primaryFormat,
  73. WAVEFORMATEX *lpwfxPlayFormat,
  74. DWORD dwPlayPriority,
  75. DWORD dwPlayFlags,
  76. DWORD dwFlags
  77. );
  78. HRESULT InitializeRecordBuffer( HWND hwnd, const DVFULLCOMPRESSIONINFO* lpdvfInfo, CAudioRecordDevice *parecDevice, CAudioRecordBuffer **pparecBuffer, DWORD dwFlags );
  79. BYTE FindPeak( BYTE *data, DWORD frameSize, BOOL eightBit );
  80. void DSERTRACK_Update( const char *szAPICall, HRESULT hrResult );
  81. void DSERRTRACK_Reset();
  82. BOOL DSERRTRACK_Init();
  83. void DSERRTRACK_UnInit();
  84. extern BOOL g_fDSErrorBreak;
  85. #if defined(DEBUG) || defined(DBG) || defined(_DEBUG)
  86. #define DSASSERT(condition) if( g_fDSErrorBreak ) { DNASSERT( condition ); }
  87. #else
  88. #define DSASSERT(condition)
  89. #endif
  90. #endif