blob: fba716e2530aec159fec286101dca47b0d089c79 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:251/*
bjornv@webrtc.org0c6f9312012-01-30 09:39:082 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:253 *
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 Bonadei92ea95e2017-09-15 04:47:3111#ifndef MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
12#define MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
niklase@google.com470e71d2011-07-07 08:21:2513
kwiberg88788ad2016-02-19 15:04:4914#include <memory>
Alejandro Luebsfa639f02016-02-09 19:24:3215#include <vector>
16
Mirko Bonadei92ea95e2017-09-15 04:47:3117#include "modules/audio_processing/include/audio_processing.h"
18#include "rtc_base/constructormagic.h"
19#include "rtc_base/criticalsection.h"
niklase@google.com470e71d2011-07-07 08:21:2520
21namespace webrtc {
andrew@webrtc.org56e4a052014-02-27 22:23:1722
niklase@google.com470e71d2011-07-07 08:21:2523class AudioBuffer;
24
solenberg5e465c32015-12-08 21:22:3325class NoiseSuppressionImpl : public NoiseSuppression {
niklase@google.com470e71d2011-07-07 08:21:2526 public:
solenberg5e465c32015-12-08 21:22:3327 explicit NoiseSuppressionImpl(rtc::CriticalSection* crit);
28 ~NoiseSuppressionImpl() override;
niklase@google.com470e71d2011-07-07 08:21:2529
solenberg5e465c32015-12-08 21:22:3330 // TODO(peah): Fold into ctor, once public API is removed.
Peter Kasting69558702016-01-13 00:26:3531 void Initialize(size_t channels, int sample_rate_hz);
solenberg29e2f932015-12-16 09:18:1532 void AnalyzeCaptureAudio(AudioBuffer* audio);
33 void ProcessCaptureAudio(AudioBuffer* audio);
niklase@google.com470e71d2011-07-07 08:21:2534
35 // NoiseSuppression implementation.
solenberg5e465c32015-12-08 21:22:3336 int Enable(bool enable) override;
kjellander@webrtc.org14665ff2015-03-04 12:58:3537 bool is_enabled() const override;
solenberg5e465c32015-12-08 21:22:3338 int set_level(Level level) override;
Minyue13b96ba2015-10-02 22:39:1439 Level level() const override;
solenberg5e465c32015-12-08 21:22:3340 float speech_probability() const override;
Alejandro Luebsfa639f02016-02-09 19:24:3241 std::vector<float> NoiseEstimate() override;
Alex Luebs57ae8292016-03-09 15:24:3442 static size_t num_noise_bins();
niklase@google.com470e71d2011-07-07 08:21:2543
niklase@google.com470e71d2011-07-07 08:21:2544 private:
solenberg5e465c32015-12-08 21:22:3345 class Suppressor;
peahdf3efa82015-11-28 20:35:1546 rtc::CriticalSection* const crit_;
danilchap56359be2017-09-07 14:53:4547 bool enabled_ RTC_GUARDED_BY(crit_) = false;
48 Level level_ RTC_GUARDED_BY(crit_) = kModerate;
49 size_t channels_ RTC_GUARDED_BY(crit_) = 0;
50 int sample_rate_hz_ RTC_GUARDED_BY(crit_) = 0;
51 std::vector<std::unique_ptr<Suppressor>> suppressors_ RTC_GUARDED_BY(crit_);
solenberg5e465c32015-12-08 21:22:3352 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(NoiseSuppressionImpl);
niklase@google.com470e71d2011-07-07 08:21:2553};
54} // namespace webrtc
55
Mirko Bonadei92ea95e2017-09-15 04:47:3156#endif // MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_