1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2018, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Anthony Minessale II <anthm@freeswitch.org>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  *
26  * Seven Du <dujinfang@gmail.com>
27  *
28  *
29  * switch_vad.h VAD code with optional libfvad
30  *
31  */
32 /*!
33   \defgroup vad1 VAD code with optional libfvad
34   \ingroup core1
35   \{
36 */
37 #ifndef FREESWITCH_VAD_H
38 #define FREESWITCH_VAD_H
39 
40 SWITCH_BEGIN_EXTERN_C
41 
42 SWITCH_DECLARE(switch_vad_t *) switch_vad_init(int sample_rate, int channels);
43 
44 /*
45  * Valid modes are -1 ("disable fvad, using native"), 0 ("quality"), 1 ("low bitrate"), 2 ("aggressive"), and 3 * ("very aggressive").
46  * The default mode is -1.
47 */
48 
49 SWITCH_DECLARE(int) switch_vad_set_mode(switch_vad_t *vad, int mode);
50 SWITCH_DECLARE(void) switch_vad_set_param(switch_vad_t *vad, const char *key, int val);
51 SWITCH_DECLARE(switch_vad_state_t) switch_vad_process(switch_vad_t *vad, int16_t *data, unsigned int samples);
52 SWITCH_DECLARE(switch_vad_state_t) switch_vad_get_state(switch_vad_t *vad);
53 SWITCH_DECLARE(void) switch_vad_reset(switch_vad_t *vad);
54 SWITCH_DECLARE(void) switch_vad_destroy(switch_vad_t **vad);
55 
56 SWITCH_DECLARE(const char *) switch_vad_state2str(switch_vad_state_t state);
57 
58 SWITCH_END_EXTERN_C
59 #endif
60 /* For Emacs:
61  * Local Variables:
62  * mode:c
63  * indent-tabs-mode:t
64  * tab-width:4
65  * c-basic-offset:4
66  * End:
67  * For VIM:
68  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
69  */
70