OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 | 11 |
12 /* | 12 /* |
13 * This header file includes the VAD API calls. Specific function calls are give
n below. | 13 * This header file includes the VAD API calls. Specific function calls are give
n below. |
14 */ | 14 */ |
15 | 15 |
16 #ifndef WEBRTC_COMMON_AUDIO_VAD_INCLUDE_WEBRTC_VAD_H_ // NOLINT | 16 #ifndef WEBRTC_COMMON_AUDIO_VAD_INCLUDE_WEBRTC_VAD_H_ // NOLINT |
17 #define WEBRTC_COMMON_AUDIO_VAD_INCLUDE_WEBRTC_VAD_H_ | 17 #define WEBRTC_COMMON_AUDIO_VAD_INCLUDE_WEBRTC_VAD_H_ |
18 | 18 |
| 19 #include <stddef.h> |
| 20 |
19 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
20 | 22 |
21 typedef struct WebRtcVadInst VadInst; | 23 typedef struct WebRtcVadInst VadInst; |
22 | 24 |
23 #ifdef __cplusplus | 25 #ifdef __cplusplus |
24 extern "C" { | 26 extern "C" { |
25 #endif | 27 #endif |
26 | 28 |
27 // Creates an instance to the VAD structure. | 29 // Creates an instance to the VAD structure. |
28 VadInst* WebRtcVad_Create(); | 30 VadInst* WebRtcVad_Create(); |
(...skipping 30 matching lines...) Expand all Loading... |
59 // - handle [i/o] : VAD Instance. Needs to be initialized by | 61 // - handle [i/o] : VAD Instance. Needs to be initialized by |
60 // WebRtcVad_Init() before call. | 62 // WebRtcVad_Init() before call. |
61 // - fs [i] : Sampling frequency (Hz): 8000, 16000, or 32000 | 63 // - fs [i] : Sampling frequency (Hz): 8000, 16000, or 32000 |
62 // - audio_frame [i] : Audio frame buffer. | 64 // - audio_frame [i] : Audio frame buffer. |
63 // - frame_length [i] : Length of audio frame buffer in number of samples. | 65 // - frame_length [i] : Length of audio frame buffer in number of samples. |
64 // | 66 // |
65 // returns : 1 - (Active Voice), | 67 // returns : 1 - (Active Voice), |
66 // 0 - (Non-active Voice), | 68 // 0 - (Non-active Voice), |
67 // -1 - (Error) | 69 // -1 - (Error) |
68 int WebRtcVad_Process(VadInst* handle, int fs, const int16_t* audio_frame, | 70 int WebRtcVad_Process(VadInst* handle, int fs, const int16_t* audio_frame, |
69 int frame_length); | 71 size_t frame_length); |
70 | 72 |
71 // Checks for valid combinations of |rate| and |frame_length|. We support 10, | 73 // Checks for valid combinations of |rate| and |frame_length|. We support 10, |
72 // 20 and 30 ms frames and the rates 8000, 16000 and 32000 Hz. | 74 // 20 and 30 ms frames and the rates 8000, 16000 and 32000 Hz. |
73 // | 75 // |
74 // - rate [i] : Sampling frequency (Hz). | 76 // - rate [i] : Sampling frequency (Hz). |
75 // - frame_length [i] : Speech frame buffer length in number of samples. | 77 // - frame_length [i] : Speech frame buffer length in number of samples. |
76 // | 78 // |
77 // returns : 0 - (valid combination), -1 - (invalid combination) | 79 // returns : 0 - (valid combination), -1 - (invalid combination) |
78 int WebRtcVad_ValidRateAndFrameLength(int rate, int frame_length); | 80 int WebRtcVad_ValidRateAndFrameLength(int rate, size_t frame_length); |
79 | 81 |
80 #ifdef __cplusplus | 82 #ifdef __cplusplus |
81 } | 83 } |
82 #endif | 84 #endif |
83 | 85 |
84 #endif // WEBRTC_COMMON_AUDIO_VAD_INCLUDE_WEBRTC_VAD_H_ // NOLINT | 86 #endif // WEBRTC_COMMON_AUDIO_VAD_INCLUDE_WEBRTC_VAD_H_ // NOLINT |
OLD | NEW |