blob: 9ab8656a3a2c4e1209365a37c7ebee90441e018e [file] [log] [blame]
alessiob3ec96df2017-05-22 06:57:06 -07001/*
2 * Copyright (c) 2017 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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_AUDIO_PROCESSING_AGC2_GAIN_CONTROLLER2_H_
12#define MODULES_AUDIO_PROCESSING_AGC2_GAIN_CONTROLLER2_H_
alessiob3ec96df2017-05-22 06:57:06 -070013
14#include <memory>
15#include <string>
16
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "modules/audio_processing/agc2/digital_gain_applier.h"
18#include "modules/audio_processing/include/audio_processing.h"
19#include "rtc_base/constructormagic.h"
alessiob3ec96df2017-05-22 06:57:06 -070020
21namespace webrtc {
22
23class ApmDataDumper;
24class AudioBuffer;
25
26// Gain Controller 2 aims to automatically adjust levels by acting on the
27// microphone gain and/or applying digital gain.
28//
29// It temporarily implements a hard-coded gain mode only.
30class GainController2 {
31 public:
32 explicit GainController2(int sample_rate_hz);
33 ~GainController2();
34
35 int sample_rate_hz() { return sample_rate_hz_; }
36
37 void Process(AudioBuffer* audio);
38
39 static bool Validate(const AudioProcessing::Config::GainController2& config);
40 static std::string ToString(
41 const AudioProcessing::Config::GainController2& config);
42
43 private:
44 int sample_rate_hz_;
45 std::unique_ptr<ApmDataDumper> data_dumper_;
46 DigitalGainApplier digital_gain_applier_;
47 static int instance_count_;
48 // TODO(alessiob): Remove once a meaningful gain controller mode is
49 // implemented.
50 const float gain_;
51 RTC_DISALLOW_COPY_AND_ASSIGN(GainController2);
52};
53
54} // namespace webrtc
55
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020056#endif // MODULES_AUDIO_PROCESSING_AGC2_GAIN_CONTROLLER2_H_