blob: a3b346050f184e0faed2583612bc8bae091ceb7d [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
bjornv@webrtc.org0c6f9312012-01-30 09:39:08 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
bjornv@webrtc.org0c6f9312012-01-30 09:39:08 +000011#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
solenberg5e465c32015-12-08 13:22:33 -080014#include "webrtc/base/constructormagic.h"
peahdf3efa82015-11-28 12:35:15 -080015#include "webrtc/base/criticalsection.h"
solenberg5e465c32015-12-08 13:22:33 -080016#include "webrtc/base/scoped_ptr.h"
pbos@webrtc.org7fad4b82013-05-28 08:11:59 +000017#include "webrtc/modules/audio_processing/include/audio_processing.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
19namespace webrtc {
andrew@webrtc.org56e4a052014-02-27 22:23:17 +000020
niklase@google.com470e71d2011-07-07 08:21:25 +000021class AudioBuffer;
22
solenberg5e465c32015-12-08 13:22:33 -080023class NoiseSuppressionImpl : public NoiseSuppression {
niklase@google.com470e71d2011-07-07 08:21:25 +000024 public:
solenberg5e465c32015-12-08 13:22:33 -080025 explicit NoiseSuppressionImpl(rtc::CriticalSection* crit);
26 ~NoiseSuppressionImpl() override;
niklase@google.com470e71d2011-07-07 08:21:25 +000027
solenberg5e465c32015-12-08 13:22:33 -080028 // TODO(peah): Fold into ctor, once public API is removed.
29 void Initialize(int channels, int sample_rate_hz);
aluebs@webrtc.orgfda2c2e2014-09-18 09:54:06 +000030 int AnalyzeCaptureAudio(AudioBuffer* audio);
niklase@google.com470e71d2011-07-07 08:21:25 +000031 int ProcessCaptureAudio(AudioBuffer* audio);
32
33 // NoiseSuppression implementation.
solenberg5e465c32015-12-08 13:22:33 -080034 int Enable(bool enable) override;
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +000035 bool is_enabled() const override;
solenberg5e465c32015-12-08 13:22:33 -080036 int set_level(Level level) override;
Minyue13b96ba2015-10-03 00:39:14 +020037 Level level() const override;
solenberg5e465c32015-12-08 13:22:33 -080038 float speech_probability() const override;
niklase@google.com470e71d2011-07-07 08:21:25 +000039
niklase@google.com470e71d2011-07-07 08:21:25 +000040 private:
solenberg5e465c32015-12-08 13:22:33 -080041 class Suppressor;
peahdf3efa82015-11-28 12:35:15 -080042 rtc::CriticalSection* const crit_;
solenberg5e465c32015-12-08 13:22:33 -080043 bool enabled_ GUARDED_BY(crit_) = false;
44 Level level_ GUARDED_BY(crit_) = kModerate;
45 std::vector<rtc::scoped_ptr<Suppressor>> suppressors_ GUARDED_BY(crit_);
46 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(NoiseSuppressionImpl);
niklase@google.com470e71d2011-07-07 08:21:25 +000047};
48} // namespace webrtc
49
bjornv@webrtc.org0c6f9312012-01-30 09:39:08 +000050#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_