1 /* 2 * Copyright (c) 2014 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 WEBRTC_COMMON_AUDIO_VAD_INCLUDE_VAD_H_ 12 #define WEBRTC_COMMON_AUDIO_VAD_INCLUDE_VAD_H_ 13 14 #include "webrtc/base/checks.h" 15 #include "webrtc/common_audio/vad/include/webrtc_vad.h" 16 #include "webrtc/typedefs.h" 17 18 namespace webrtc { 19 20 // This is a C++ wrapper class for WebRtcVad. 21 class Vad { 22 public: 23 enum Aggressiveness { 24 kVadNormal = 0, 25 kVadLowBitrate = 1, 26 kVadAggressive = 2, 27 kVadVeryAggressive = 3 28 }; 29 30 enum Activity { kPassive = 0, kActive = 1, kError = -1 }; 31 32 explicit Vad(enum Aggressiveness mode); 33 34 virtual ~Vad(); 35 36 virtual Activity VoiceActivity(const int16_t* audio, 37 size_t num_samples, 38 int sample_rate_hz); 39 40 private: 41 VadInst* handle_; 42 }; 43 44 } // namespace webrtc 45 #endif // WEBRTC_COMMON_AUDIO_VAD_INCLUDE_VAD_H_ 46