aleloi | 5f09980 | 2016-08-25 00:45:31 -0700 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "modules/audio_processing/include/audio_processing.h" |
aleloi | 5f09980 | 2016-08-25 00:45:31 -0700 | [diff] [blame] | 12 | |
Artem Titov | 59bbd65 | 2019-08-02 11:31:37 +0200 | [diff] [blame] | 13 | #include "rtc_base/strings/string_builder.h" |
| 14 | |
aleloi | 5f09980 | 2016-08-25 00:45:31 -0700 | [diff] [blame] | 15 | namespace webrtc { |
Artem Titov | 59bbd65 | 2019-08-02 11:31:37 +0200 | [diff] [blame] | 16 | namespace { |
| 17 | |
| 18 | std::string NoiseSuppressionLevelToString( |
| 19 | const AudioProcessing::Config::NoiseSuppression::Level& level) { |
| 20 | switch (level) { |
| 21 | case AudioProcessing::Config::NoiseSuppression::Level::kLow: |
| 22 | return "Low"; |
| 23 | case AudioProcessing::Config::NoiseSuppression::Level::kModerate: |
| 24 | return "Moderate"; |
| 25 | case AudioProcessing::Config::NoiseSuppression::Level::kHigh: |
| 26 | return "High"; |
| 27 | case AudioProcessing::Config::NoiseSuppression::Level::kVeryHigh: |
| 28 | return "VeryHigh"; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | std::string GainController1ModeToString( |
| 33 | const AudioProcessing::Config::GainController1::Mode& mode) { |
| 34 | switch (mode) { |
| 35 | case AudioProcessing::Config::GainController1::Mode::kAdaptiveAnalog: |
| 36 | return "AdaptiveAnalog"; |
| 37 | case AudioProcessing::Config::GainController1::Mode::kAdaptiveDigital: |
| 38 | return "AdaptiveDigital"; |
| 39 | case AudioProcessing::Config::GainController1::Mode::kFixedDigital: |
| 40 | return "FixedDigital"; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | std::string GainController2LevelEstimatorToString( |
| 45 | const AudioProcessing::Config::GainController2::LevelEstimator& level) { |
| 46 | switch (level) { |
| 47 | case AudioProcessing::Config::GainController2::LevelEstimator::kRms: |
| 48 | return "Rms"; |
| 49 | case AudioProcessing::Config::GainController2::LevelEstimator::kPeak: |
| 50 | return "Peak"; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | } // namespace |
aleloi | 5f09980 | 2016-08-25 00:45:31 -0700 | [diff] [blame] | 55 | |
Alex Loiko | 73ec019 | 2018-05-15 10:52:28 +0200 | [diff] [blame] | 56 | void CustomProcessing::SetRuntimeSetting( |
| 57 | AudioProcessing::RuntimeSetting setting) {} |
| 58 | |
Artem Titov | 59bbd65 | 2019-08-02 11:31:37 +0200 | [diff] [blame] | 59 | std::string AudioProcessing::Config::ToString() const { |
| 60 | char buf[1024]; |
| 61 | rtc::SimpleStringBuilder builder(buf); |
| 62 | builder << "AudioProcessing::Config{ " |
| 63 | << "pre_amplifier: { enabled: " << pre_amplifier.enabled |
| 64 | << ", fixed_gain_factor: " << pre_amplifier.fixed_gain_factor |
| 65 | << " }, high_pass_filter: { enabled: " << high_pass_filter.enabled |
| 66 | << " }, echo_canceller: { enabled: " << echo_canceller.enabled |
| 67 | << ", mobile_mode: " << echo_canceller.mobile_mode |
| 68 | << ", legacy_moderate_suppression_level: " |
| 69 | << echo_canceller.legacy_moderate_suppression_level |
| 70 | << ", use_legacy_aec: " << echo_canceller.use_legacy_aec |
| 71 | << " }, noise_suppression: { enabled: " << noise_suppression.enabled |
| 72 | << ", level: " |
| 73 | << NoiseSuppressionLevelToString(noise_suppression.level) |
| 74 | << " }, voice_detection: { enabled: " << voice_detection.enabled |
| 75 | << " }, gain_controller1: { enabled: " << gain_controller1.enabled |
| 76 | << ", mode: " << GainController1ModeToString(gain_controller1.mode) |
| 77 | << ", target_level_dbfs: " << gain_controller1.target_level_dbfs |
| 78 | << ", compression_gain_db: " << gain_controller1.compression_gain_db |
| 79 | << ", enable_limiter: " << gain_controller1.enable_limiter |
| 80 | << ", analog_level_minimum: " << gain_controller1.analog_level_minimum |
| 81 | << ", analog_level_maximum: " << gain_controller1.analog_level_maximum |
| 82 | << " }, gain_controller2: { enabled: " << gain_controller2.enabled |
| 83 | << ", fixed_digital: { gain_db: " |
| 84 | << gain_controller2.fixed_digital.gain_db |
| 85 | << " }, adaptive_digital: { enabled: " |
| 86 | << gain_controller2.adaptive_digital.enabled << ", level_estimator: " |
| 87 | << GainController2LevelEstimatorToString( |
| 88 | gain_controller2.adaptive_digital.level_estimator) |
| 89 | << ", use_saturation_protector: " |
| 90 | << gain_controller2.adaptive_digital.use_saturation_protector |
| 91 | << ", extra_saturation_margin_db: " |
| 92 | << gain_controller2.adaptive_digital.extra_saturation_margin_db |
| 93 | << " } }, residual_echo_detector: { enabled: " |
| 94 | << residual_echo_detector.enabled |
| 95 | << " }, level_estimation: { enabled: " << level_estimation.enabled |
| 96 | << " } }"; |
| 97 | return builder.str(); |
| 98 | } |
| 99 | |
aleloi | 5f09980 | 2016-08-25 00:45:31 -0700 | [diff] [blame] | 100 | } // namespace webrtc |