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.

120 lines
3.0 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: agcva1.h
  6. * Content: Concrete class that implements CAutoGainControl
  7. *
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 12/01/99 pnewson Created it
  12. * 01/31/2000 pnewson re-add support for absence of DVCLIENTCONFIG_AUTOSENSITIVITY flag
  13. * 03/03/2000 rodtoll Updated to handle alternative gamevoice build.
  14. * 04/25/2000 pnewson Fix to improve responsiveness of AGC when volume level too low
  15. *
  16. ***************************************************************************/
  17. #ifndef _AGCVA1_H_
  18. #define _AGCVA1_H_
  19. #define CAGCVA1_HISTOGRAM_BUCKETS 0x10
  20. #define CAGCVA1_AGCTICKSIZE 250
  21. class CAGCVA1 : public CAGCVA
  22. {
  23. protected:
  24. DWORD m_dwFlags;
  25. DWORD m_dwSensitivity;
  26. GUID m_guidCaptureDevice;
  27. LONG m_lCurVolume;
  28. LONG m_lCurStepSize;
  29. int m_iSampleRate;
  30. int m_iBitsPerSample;
  31. int m_iShiftConstantFast;
  32. int m_iShiftConstantSlow;
  33. int m_iEnvelopeSampleRate;
  34. int m_iCurSampleNum;
  35. int m_iCurEnvelopeValueFast;
  36. int m_iCurEnvelopeValueSlow;
  37. int m_iPrevEnvelopeSample;
  38. int m_iHangoverSamples;
  39. int m_iCurHangoverSamples;
  40. BYTE m_bPeak;
  41. /*
  42. BYTE m_bPeak127;
  43. BYTE m_bPeakLog;
  44. BYTE m_bZeroCrossings127;
  45. BYTE m_bZeroCrossingsLog;
  46. */
  47. BOOL m_fVoiceDetectedNow;
  48. BOOL m_fVoiceHangoverActive;
  49. BOOL m_fVoiceDetectedThisFrame;
  50. BOOL m_fDeadZoneDetected;
  51. int m_iFeedbackSamples;
  52. /*
  53. BOOL m_fClipping;
  54. int m_iClippingCount;
  55. */
  56. int m_iClippingSampleCount;
  57. int m_iNonClippingSampleCount;
  58. int m_iDeadZoneSamples;
  59. int m_iDeadZoneSampleThreshold;
  60. BOOL m_fAGCLastFrameAdjusted;
  61. //DWORD m_dwAGCBelowThresholdTime;
  62. //DWORD m_dwFrameTime;
  63. float* m_rgfAGCHistory;
  64. DWORD m_dwHistorySamples;
  65. WCHAR m_wszRegPath[_MAX_PATH];
  66. /*
  67. DWORD m_rgdwPeakHistogram[CAGCVA1_HISTOGRAM_BUCKETS];
  68. DWORD m_rgdwZeroCrossingsHistogram[CAGCVA1_HISTOGRAM_BUCKETS];
  69. */
  70. public:
  71. CAGCVA1()
  72. : m_guidCaptureDevice(GUID_NULL)
  73. , m_lCurVolume(0)
  74. , m_lCurStepSize(0)
  75. , m_bPeak(0)
  76. , m_fVoiceDetectedThisFrame(FALSE)
  77. , m_fVoiceDetectedNow(FALSE)
  78. //, m_fVoiceDetectedValid(FALSE)
  79. //, m_fAGCLastFrameAdjusted(FALSE)
  80. //, m_dwAGCBelowThresholdTime(0)
  81. //, m_dwFrameTime(0)
  82. {};
  83. virtual ~CAGCVA1() {};
  84. virtual HRESULT Init(
  85. const WCHAR *wszBasePath,
  86. DWORD dwFlags,
  87. GUID guidCaptureDevice,
  88. int iSampleRate,
  89. int iBitsPerSample,
  90. LONG* plInitVolume,
  91. DWORD dwSensitivity);
  92. virtual HRESULT Deinit();
  93. virtual HRESULT SetSensitivity(DWORD dwFlags, DWORD dwSensitivity);
  94. virtual HRESULT GetSensitivity(DWORD* pdwFlags, DWORD* pdwSensitivity);
  95. virtual HRESULT AnalyzeData(BYTE* pbAudioData, DWORD dwAudioDataSize/*, DWORD dwFrameTime*/);
  96. virtual HRESULT AGCResults(LONG lCurVolume, LONG* plNewVolume, BOOL fTransmitFrame);
  97. virtual HRESULT VAResults(BOOL* pfVoiceDetected);
  98. virtual HRESULT PeakResults(BYTE* pbPeakValue);
  99. };
  100. #endif