OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 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 WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_FOR_EXPERIMENTAL_AGC_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_FOR_EXPERIMENTAL_AGC_H_ |
| 13 |
| 14 #include "webrtc/base/constructormagic.h" |
| 15 #include "webrtc/base/criticalsection.h" |
| 16 #include "webrtc/base/thread_checker.h" |
| 17 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h" |
| 18 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 19 |
| 20 namespace webrtc { |
| 21 |
| 22 // This class has two main purposes: |
| 23 // |
| 24 // 1) It is returned instead of the real GainControl after the new AGC has been |
| 25 // enabled in order to prevent an outside user from overriding compression |
| 26 // settings. It doesn't do anything in its implementation, except for |
| 27 // delegating the const methods and Enable calls to the real GainControl, so |
| 28 // AGC can still be disabled. |
| 29 // |
| 30 // 2) It is injected into AgcManagerDirect and implements volume callbacks for |
| 31 // getting and setting the volume level. It just caches this value to be used |
| 32 // in VoiceEngine later. |
| 33 class GainControlForExperimentalAgc : public GainControl, |
| 34 public VolumeCallbacks { |
| 35 public: |
| 36 explicit GainControlForExperimentalAgc(GainControl* gain_control, |
| 37 rtc::CriticalSection* crit_capture); |
| 38 |
| 39 // GainControl implementation. |
| 40 int Enable(bool enable) override; |
| 41 bool is_enabled() const override; |
| 42 int set_stream_analog_level(int level) override; |
| 43 int stream_analog_level() override; |
| 44 int set_mode(Mode mode) override; |
| 45 Mode mode() const override; |
| 46 int set_target_level_dbfs(int level) override; |
| 47 int target_level_dbfs() const override; |
| 48 int set_compression_gain_db(int gain) override; |
| 49 int compression_gain_db() const override; |
| 50 int enable_limiter(bool enable) override; |
| 51 bool is_limiter_enabled() const override; |
| 52 int set_analog_level_limits(int minimum, int maximum) override; |
| 53 int analog_level_minimum() const override; |
| 54 int analog_level_maximum() const override; |
| 55 bool stream_is_saturated() const override; |
| 56 |
| 57 // VolumeCallbacks implementation. |
| 58 void SetMicVolume(int volume) override; |
| 59 int GetMicVolume() override; |
| 60 |
| 61 private: |
| 62 GainControl* real_gain_control_; |
| 63 int volume_; |
| 64 rtc::CriticalSection* crit_capture_; |
| 65 RTC_DISALLOW_COPY_AND_ASSIGN(GainControlForExperimentalAgc); |
| 66 }; |
| 67 |
| 68 } // namespace webrtc |
| 69 |
| 70 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_FOR_EXPERIMENTAL_AGC_H_ |
OLD | NEW |