Sam Zackrisson | 2351313 | 2019-01-11 15:10:32 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019 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 MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_PROXY_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_PROXY_H_ |
| 13 | |
| 14 | #include <vector> |
| 15 | |
| 16 | #include "modules/audio_processing/include/audio_processing.h" |
Steve Anton | f380284 | 2019-01-24 19:07:40 -0800 | [diff] [blame] | 17 | #include "rtc_base/constructor_magic.h" |
Sam Zackrisson | 2351313 | 2019-01-11 15:10:32 +0100 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | // This class ensures interoperability with the pointer-to-submodule interface |
| 21 | // AudioProcessing::noise_suppression() and AudioProcessing::ApplyConfig: |
| 22 | // Enable(..) and set_level(..) calls are applied via |
| 23 | // AudioProcessing::ApplyConfig, while all other function calls are forwarded |
| 24 | // directly to a wrapped NoiseSuppression instance. |
| 25 | class NoiseSuppressionProxy : public NoiseSuppression { |
| 26 | public: |
| 27 | NoiseSuppressionProxy(AudioProcessing* apm, NoiseSuppression* ns); |
| 28 | ~NoiseSuppressionProxy() override; |
| 29 | |
| 30 | // NoiseSuppression implementation. |
| 31 | int Enable(bool enable) override; |
| 32 | bool is_enabled() const override; |
| 33 | int set_level(Level level) override; |
| 34 | Level level() const override; |
| 35 | float speech_probability() const override; |
| 36 | std::vector<float> NoiseEstimate() override; |
| 37 | |
| 38 | private: |
| 39 | AudioProcessing* apm_; |
| 40 | NoiseSuppression* ns_; |
| 41 | RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(NoiseSuppressionProxy); |
| 42 | }; |
| 43 | } // namespace webrtc |
| 44 | |
| 45 | #endif // MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_PROXY_H_ |