1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef __SPEECH_AEC_H__
5 #define __SPEECH_AEC_H__
6 
7 #include <stdint.h>
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #define SPEECH_AEC_GET_LIB_ST          (0)
14 
15 /*
16 60
17 16383
18 4
19 */
20 typedef struct {
21     int32_t     bypass;
22     int32_t     delay;
23     int32_t     leak_estimate;
24     int32_t     leak_estimate_shift;
25 } SpeechAecConfig;
26 
27 struct SpeechAecState_;
28 
29 typedef struct SpeechAecState_ SpeechAecState;
30 
31 // Creat a instance from speech_aec module/class
32 // Common value include: sample rate, frame size and so on.
33 SpeechAecState *speech_aec_create(int32_t sample_rate, int32_t frame_size, const SpeechAecConfig *cfg);
34 
35 // Destory a speech aec instance
36 int32_t speech_aec_destroy(SpeechAecState *st);
37 
38 // Just use modify instance configure
39 int32_t speech_aec_set_config(SpeechAecState *st, const SpeechAecConfig *cfg);
40 
41 // Get/set some value or enable/disable some function
42 int32_t speech_aec_ctl(SpeechAecState *st, int32_t ctl, void *ptr);
43 
44 // Process speech stream
45 int32_t speech_aec_process(SpeechAecState *st, int16_t *pcm_in, int16_t *pcm_ref, int32_t pcm_len, int16_t *pcm_out);
46 
47 // Debug speech_aec instance
48 int32_t speech_aec_dump(SpeechAecState *st);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif
55