niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
bjornv@webrtc.org | 0c6f931 | 2012-01-30 09:39:08 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
bjornv@webrtc.org | 0c6f931 | 2012-01-30 09:39:08 +0000 | [diff] [blame] | 11 | #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_VOICE_DETECTION_IMPL_H_ |
| 12 | #define WEBRTC_MODULES_AUDIO_PROCESSING_VOICE_DETECTION_IMPL_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
pbos@webrtc.org | 7fad4b8 | 2013-05-28 08:11:59 +0000 | [diff] [blame] | 14 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 15 | #include "webrtc/modules/audio_processing/processing_component.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | class AudioProcessingImpl; |
| 19 | class AudioBuffer; |
| 20 | |
| 21 | class VoiceDetectionImpl : public VoiceDetection, |
| 22 | public ProcessingComponent { |
| 23 | public: |
| 24 | explicit VoiceDetectionImpl(const AudioProcessingImpl* apm); |
| 25 | virtual ~VoiceDetectionImpl(); |
| 26 | |
| 27 | int ProcessCaptureAudio(AudioBuffer* audio); |
| 28 | |
| 29 | // VoiceDetection implementation. |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 30 | virtual bool is_enabled() const OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 31 | |
| 32 | // ProcessingComponent implementation. |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 33 | virtual int Initialize() OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 34 | |
| 35 | private: |
| 36 | // VoiceDetection implementation. |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 37 | virtual int Enable(bool enable) OVERRIDE; |
| 38 | virtual int set_stream_has_voice(bool has_voice) OVERRIDE; |
| 39 | virtual bool stream_has_voice() const OVERRIDE; |
| 40 | virtual int set_likelihood(Likelihood likelihood) OVERRIDE; |
| 41 | virtual Likelihood likelihood() const OVERRIDE; |
| 42 | virtual int set_frame_size_ms(int size) OVERRIDE; |
| 43 | virtual int frame_size_ms() const OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | |
| 45 | // ProcessingComponent implementation. |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 46 | virtual void* CreateHandle() const OVERRIDE; |
| 47 | virtual int InitializeHandle(void* handle) const OVERRIDE; |
| 48 | virtual int ConfigureHandle(void* handle) const OVERRIDE; |
| 49 | virtual int DestroyHandle(void* handle) const OVERRIDE; |
| 50 | virtual int num_handles_required() const OVERRIDE; |
| 51 | virtual int GetHandleError(void* handle) const OVERRIDE; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 52 | |
| 53 | const AudioProcessingImpl* apm_; |
| 54 | bool stream_has_voice_; |
| 55 | bool using_external_vad_; |
| 56 | Likelihood likelihood_; |
| 57 | int frame_size_ms_; |
| 58 | int frame_size_samples_; |
| 59 | }; |
| 60 | } // namespace webrtc |
| 61 | |
bjornv@webrtc.org | 0c6f931 | 2012-01-30 09:39:08 +0000 | [diff] [blame] | 62 | #endif // WEBRTC_MODULES_AUDIO_PROCESSING_VOICE_DETECTION_IMPL_H_ |