OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC2_GAIN_CONTROLLER2_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC2_GAIN_CONTROLLER2_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AGC2_GAIN_CONTROLLER2_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AGC2_GAIN_CONTROLLER2_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "webrtc/modules/audio_processing/agc2/digital_gain_applier.h" | |
18 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 17 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
19 #include "webrtc/rtc_base/constructormagic.h" | 18 #include "webrtc/rtc_base/constructormagic.h" |
20 | 19 |
21 namespace webrtc { | 20 namespace webrtc { |
22 | 21 |
23 class ApmDataDumper; | 22 class ApmDataDumper; |
24 class AudioBuffer; | 23 class AudioBuffer; |
25 | 24 |
26 // Gain Controller 2 aims to automatically adjust levels by acting on the | 25 // Gain Controller 2 aims to automatically adjust levels by acting on the |
27 // microphone gain and/or applying digital gain. | 26 // microphone gain and/or applying digital gain. |
28 // | 27 // |
29 // It temporarily implements a hard-coded gain mode only. | 28 // It temporarily implements a fixed gain mode with hard-clipping. |
peah-webrtc
2017/09/15 07:44:25
It temporarily -> Temporarily
AleBzk
2017/09/29 09:39:06
Done.
| |
30 class GainController2 { | 29 class GainController2 { |
31 public: | 30 public: |
32 explicit GainController2(int sample_rate_hz); | 31 explicit GainController2(); |
33 ~GainController2(); | 32 ~GainController2(); |
34 | 33 |
35 int sample_rate_hz() { return sample_rate_hz_; } | 34 int sample_rate_hz() { return sample_rate_hz_; } |
35 float fixed_gain() { return fixed_gain_; } | |
36 | 36 |
37 void Initialize(int sample_rate_hz); | |
37 void Process(AudioBuffer* audio); | 38 void Process(AudioBuffer* audio); |
38 | 39 |
40 void ApplyConfig(const AudioProcessing::Config::GainController2& config); | |
39 static bool Validate(const AudioProcessing::Config::GainController2& config); | 41 static bool Validate(const AudioProcessing::Config::GainController2& config); |
40 static std::string ToString( | 42 static std::string ToString( |
41 const AudioProcessing::Config::GainController2& config); | 43 const AudioProcessing::Config::GainController2& config); |
42 | 44 |
43 private: | 45 private: |
46 std::unique_ptr<ApmDataDumper> data_dumper_; | |
44 int sample_rate_hz_; | 47 int sample_rate_hz_; |
45 std::unique_ptr<ApmDataDumper> data_dumper_; | 48 float fixed_gain_; |
46 DigitalGainApplier digital_gain_applier_; | |
47 static int instance_count_; | 49 static int instance_count_; |
peah-webrtc
2017/09/15 07:44:25
Please move this declaration to before data_dumper
AleBzk
2017/09/29 09:39:06
Done.
| |
48 // TODO(alessiob): Remove once a meaningful gain controller mode is | 50 |
49 // implemented. | |
50 const float gain_; | |
51 RTC_DISALLOW_COPY_AND_ASSIGN(GainController2); | 51 RTC_DISALLOW_COPY_AND_ASSIGN(GainController2); |
52 }; | 52 }; |
53 | 53 |
54 } // namespace webrtc | 54 } // namespace webrtc |
55 | 55 |
56 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC2_GAIN_CONTROLLER2_H_ | 56 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC2_GAIN_CONTROLLER2_H_ |
OLD | NEW |