1 /*
2  *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef MODULES_AUDIO_PROCESSING_AGC2_ADAPTIVE_AGC_H_
12 #define MODULES_AUDIO_PROCESSING_AGC2_ADAPTIVE_AGC_H_
13 
14 #include "modules/audio_processing/agc2/adaptive_digital_gain_applier.h"
15 #include "modules/audio_processing/agc2/adaptive_mode_level_estimator.h"
16 #include "modules/audio_processing/agc2/noise_level_estimator.h"
17 #include "modules/audio_processing/agc2/vad_with_level.h"
18 #include "modules/audio_processing/include/audio_frame_view.h"
19 #include "modules/audio_processing/include/audio_processing.h"
20 
21 namespace webrtc {
22 class ApmDataDumper;
23 
24 class AdaptiveAgc {
25  public:
26   explicit AdaptiveAgc(ApmDataDumper* apm_data_dumper);
27   AdaptiveAgc(ApmDataDumper* apm_data_dumper,
28               const AudioProcessing::Config::GainController2& config);
29   ~AdaptiveAgc();
30 
31   void Process(AudioFrameView<float> float_frame, float last_audio_level);
32   void Reset();
33 
34  private:
35   AdaptiveModeLevelEstimator speech_level_estimator_;
36   VadWithLevel vad_;
37   AdaptiveDigitalGainApplier gain_applier_;
38   ApmDataDumper* const apm_data_dumper_;
39   NoiseLevelEstimator noise_level_estimator_;
40 };
41 
42 }  // namespace webrtc
43 
44 #endif  // MODULES_AUDIO_PROCESSING_AGC2_ADAPTIVE_AGC_H_
45