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 #include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h" |
| 12 |
| 13 #include "webrtc/base/checks.h" |
| 14 #include "webrtc/base/criticalsection.h" |
| 15 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 16 |
| 17 namespace webrtc { |
| 18 |
| 19 GainControlForExperimentalAgc::GainControlForExperimentalAgc( |
| 20 GainControl* gain_control, |
| 21 rtc::CriticalSection* crit_capture) |
| 22 : real_gain_control_(gain_control), |
| 23 volume_(0), |
| 24 crit_capture_(crit_capture) {} |
| 25 |
| 26 int GainControlForExperimentalAgc::Enable(bool enable) { |
| 27 return real_gain_control_->Enable(enable); |
| 28 } |
| 29 |
| 30 bool GainControlForExperimentalAgc::is_enabled() const { |
| 31 return real_gain_control_->is_enabled(); |
| 32 } |
| 33 |
| 34 int GainControlForExperimentalAgc::set_stream_analog_level(int level) { |
| 35 rtc::CritScope cs_capture(crit_capture_); |
| 36 volume_ = level; |
| 37 return AudioProcessing::kNoError; |
| 38 } |
| 39 |
| 40 int GainControlForExperimentalAgc::stream_analog_level() { |
| 41 rtc::CritScope cs_capture(crit_capture_); |
| 42 return volume_; |
| 43 } |
| 44 |
| 45 int GainControlForExperimentalAgc::set_mode(Mode mode) { |
| 46 return AudioProcessing::kNoError; |
| 47 } |
| 48 |
| 49 GainControl::Mode GainControlForExperimentalAgc::mode() const { |
| 50 return GainControl::kAdaptiveAnalog; |
| 51 } |
| 52 |
| 53 int GainControlForExperimentalAgc::set_target_level_dbfs(int level) { |
| 54 return AudioProcessing::kNoError; |
| 55 } |
| 56 |
| 57 int GainControlForExperimentalAgc::target_level_dbfs() const { |
| 58 return real_gain_control_->target_level_dbfs(); |
| 59 } |
| 60 |
| 61 int GainControlForExperimentalAgc::set_compression_gain_db(int gain) { |
| 62 return AudioProcessing::kNoError; |
| 63 } |
| 64 |
| 65 int GainControlForExperimentalAgc::compression_gain_db() const { |
| 66 return real_gain_control_->compression_gain_db(); |
| 67 } |
| 68 |
| 69 int GainControlForExperimentalAgc::enable_limiter(bool enable) { |
| 70 return AudioProcessing::kNoError; |
| 71 } |
| 72 |
| 73 bool GainControlForExperimentalAgc::is_limiter_enabled() const { |
| 74 return real_gain_control_->is_limiter_enabled(); |
| 75 } |
| 76 |
| 77 int GainControlForExperimentalAgc::set_analog_level_limits(int minimum, |
| 78 int maximum) { |
| 79 return AudioProcessing::kNoError; |
| 80 } |
| 81 |
| 82 int GainControlForExperimentalAgc::analog_level_minimum() const { |
| 83 return real_gain_control_->analog_level_minimum(); |
| 84 } |
| 85 |
| 86 int GainControlForExperimentalAgc::analog_level_maximum() const { |
| 87 return real_gain_control_->analog_level_maximum(); |
| 88 } |
| 89 |
| 90 bool GainControlForExperimentalAgc::stream_is_saturated() const { |
| 91 return real_gain_control_->stream_is_saturated(); |
| 92 } |
| 93 |
| 94 void GainControlForExperimentalAgc::SetMicVolume(int volume) { |
| 95 rtc::CritScope cs_capture(crit_capture_); |
| 96 volume_ = volume; |
| 97 } |
| 98 |
| 99 int GainControlForExperimentalAgc::GetMicVolume() { |
| 100 rtc::CritScope cs_capture(crit_capture_); |
| 101 return volume_; |
| 102 } |
| 103 |
| 104 } // namespace webrtc |
OLD | NEW |