2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-01-30 09:39:08 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-01-30 09:39:08 +00:00
|
|
|
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
|
|
|
|
|
#define WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-08 13:22:33 -08:00
|
|
|
#include "webrtc/base/constructormagic.h"
|
2015-11-28 12:35:15 -08:00
|
|
|
#include "webrtc/base/criticalsection.h"
|
2015-12-08 13:22:33 -08:00
|
|
|
#include "webrtc/base/scoped_ptr.h"
|
2013-05-28 08:11:59 +00:00
|
|
|
#include "webrtc/modules/audio_processing/include/audio_processing.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2014-02-27 22:23:17 +00:00
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
class AudioBuffer;
|
|
|
|
|
|
2015-12-08 13:22:33 -08:00
|
|
|
class NoiseSuppressionImpl : public NoiseSuppression {
|
2011-07-07 08:21:25 +00:00
|
|
|
public:
|
2015-12-08 13:22:33 -08:00
|
|
|
explicit NoiseSuppressionImpl(rtc::CriticalSection* crit);
|
|
|
|
|
~NoiseSuppressionImpl() override;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-08 13:22:33 -08:00
|
|
|
// TODO(peah): Fold into ctor, once public API is removed.
|
|
|
|
|
void Initialize(int channels, int sample_rate_hz);
|
2015-12-16 01:18:15 -08:00
|
|
|
void AnalyzeCaptureAudio(AudioBuffer* audio);
|
|
|
|
|
void ProcessCaptureAudio(AudioBuffer* audio);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
// NoiseSuppression implementation.
|
2015-12-08 13:22:33 -08:00
|
|
|
int Enable(bool enable) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
bool is_enabled() const override;
|
2015-12-08 13:22:33 -08:00
|
|
|
int set_level(Level level) override;
|
2015-10-03 00:39:14 +02:00
|
|
|
Level level() const override;
|
2015-12-08 13:22:33 -08:00
|
|
|
float speech_probability() const override;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
private:
|
2015-12-08 13:22:33 -08:00
|
|
|
class Suppressor;
|
2015-11-28 12:35:15 -08:00
|
|
|
rtc::CriticalSection* const crit_;
|
2015-12-08 13:22:33 -08:00
|
|
|
bool enabled_ GUARDED_BY(crit_) = false;
|
|
|
|
|
Level level_ GUARDED_BY(crit_) = kModerate;
|
2015-12-16 01:18:15 -08:00
|
|
|
int channels_ GUARDED_BY(crit_) = 0;
|
|
|
|
|
int sample_rate_hz_ GUARDED_BY(crit_) = 0;
|
2015-12-08 13:22:33 -08:00
|
|
|
std::vector<rtc::scoped_ptr<Suppressor>> suppressors_ GUARDED_BY(crit_);
|
|
|
|
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(NoiseSuppressionImpl);
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2012-01-30 09:39:08 +00:00
|
|
|
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
|