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.

69 lines
2.9 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: agcva.h
  6. * Content: Abstract base class for automatic gain control and
  7. * voice activation algorithms
  8. *
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 11/30/99 pnewson Created it
  13. * 01/31/2000 pnewson re-add support for absence of DVCLIENTCONFIG_AUTOSENSITIVITY flag
  14. * 03/03/2000 rodtoll Updated to handle alternative gamevoice build.
  15. * 04/25/2000 pnewson Fix to improve responsiveness of AGC when volume level too low
  16. *
  17. ***************************************************************************/
  18. #ifndef _AGCVA_H_
  19. #define _AGCVA_H_
  20. // The purpose of this abstract base class is to make it relatively simple to
  21. // experiment with different AGC (auto gain control) & VA (voice activation)
  22. // algorithms during development. If used properly, switching algorithms at compile
  23. // time should be as simple as changing one line of code - the line where the concrete
  24. // AGC/VA class is created.
  25. //
  26. // Note that this interface is used to perform the AGC and VA calculations, and to save
  27. // and restore algorithm specific settings from the registry. It does not actually
  28. // adjust the volume on the device. That's the responsibility of the code using
  29. // this class
  30. //
  31. // The AGC and VA algorithms have been bundled into this single interface because
  32. // they often need to perform very similar calculations on the input frame. By combining
  33. // them into one interface, it is possible for them to share the results of frame
  34. // calculations.
  35. //
  36. // Additionally, the AGC algorithm is pretty much "at the mercy" of the VA algorithm,
  37. // since it presumably will not adjust the volume during periods of silence.
  38. //
  39. // If you want to experiment with families of AGC and VA algorithms that are meant
  40. // to work together, I suggest creating your own abstract AGC and VA base classes
  41. // for your family of algoriths, and write a concrete class derived from this one
  42. // that uses your separate abstract AGC and VA algorithms. That way someone won't come
  43. // along and try to plug an AGC or VA algorithm into your framework that does not belong.
  44. //
  45. class CAGCVA
  46. {
  47. public:
  48. CAGCVA() {};
  49. virtual ~CAGCVA() {};
  50. virtual HRESULT Init(
  51. const WCHAR *wszBasePath,
  52. DWORD dwFlags,
  53. GUID guidCaptureDevice,
  54. int iSampleRate,
  55. int iBitsPerSample,
  56. LONG* plInitVolume,
  57. DWORD dwSensitivity) = 0;
  58. virtual HRESULT Deinit() = 0;
  59. virtual HRESULT SetSensitivity(DWORD dwFlags, DWORD dwSensitivity) = 0;
  60. virtual HRESULT GetSensitivity(DWORD* pdwFlags, DWORD* pdwSensitivity) = 0;
  61. virtual HRESULT AnalyzeData(BYTE* pbAudioData, DWORD dwAudioDataSize) = 0;
  62. virtual HRESULT AGCResults(LONG lCurVolume, LONG* plNewVolume, BOOL fTransmitFrame) = 0;
  63. virtual HRESULT VAResults(BOOL* pfVoiceDetected) = 0;
  64. virtual HRESULT PeakResults(BYTE* pbPeakValue) = 0;
  65. };
  66. #endif