OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class LevelController { | 32 class LevelController { |
33 public: | 33 public: |
34 LevelController(); | 34 LevelController(); |
35 ~LevelController(); | 35 ~LevelController(); |
36 | 36 |
37 void Initialize(int sample_rate_hz); | 37 void Initialize(int sample_rate_hz); |
38 void Process(AudioBuffer* audio); | 38 void Process(AudioBuffer* audio); |
39 float GetLastGain() { return last_gain_; } | 39 float GetLastGain() { return last_gain_; } |
40 | 40 |
| 41 // Validates a config. |
| 42 static bool Validate(const AudioProcessing::Config::LevelController& config); |
| 43 // Dumps a config to a string. |
| 44 static std::string ToString( |
| 45 const AudioProcessing::Config::LevelController& config); |
| 46 |
41 private: | 47 private: |
42 class Metrics { | 48 class Metrics { |
43 public: | 49 public: |
44 Metrics() { Initialize(AudioProcessing::kSampleRate48kHz); } | 50 Metrics() { Initialize(AudioProcessing::kSampleRate48kHz); } |
45 void Initialize(int sample_rate_hz); | 51 void Initialize(int sample_rate_hz); |
46 void Update(float long_term_peak_level, | 52 void Update(float long_term_peak_level, |
47 float noise_level, | 53 float noise_level, |
48 float gain, | 54 float gain, |
49 float frame_peak_level); | 55 float frame_peak_level); |
50 | 56 |
(...skipping 23 matching lines...) Expand all Loading... |
74 float dc_level_[2]; | 80 float dc_level_[2]; |
75 float dc_forgetting_factor_; | 81 float dc_forgetting_factor_; |
76 float last_gain_; | 82 float last_gain_; |
77 | 83 |
78 RTC_DISALLOW_COPY_AND_ASSIGN(LevelController); | 84 RTC_DISALLOW_COPY_AND_ASSIGN(LevelController); |
79 }; | 85 }; |
80 | 86 |
81 } // namespace webrtc | 87 } // namespace webrtc |
82 | 88 |
83 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_LEVEL_CONTROLLER_H_ | 89 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_LEVEL_CONTROLLER_H_ |
OLD | NEW |