Speex  1.2~beta4
speex_echo.h
Go to the documentation of this file.
1 /* Copyright (C) Jean-Marc Valin */
6 /*
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions are
9  met:
10 
11  1. Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13 
14  2. Redistributions in binary form must reproduce the above copyright
15  notice, this list of conditions and the following disclaimer in the
16  documentation and/or other materials provided with the distribution.
17 
18  3. The name of the author may not be used to endorse or promote products
19  derived from this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  POSSIBILITY OF SUCH DAMAGE.
32 */
33 
34 #ifndef SPEEX_ECHO_H
35 #define SPEEX_ECHO_H
36 
40 #include "speex/speex_types.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
47 #define SPEEX_ECHO_GET_FRAME_SIZE 3
48 
50 #define SPEEX_ECHO_SET_SAMPLING_RATE 24
51 
52 #define SPEEX_ECHO_GET_SAMPLING_RATE 25
53 
54 /* Can't set window sizes */
56 #define SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE 27
57 
58 /* Can't set window content */
60 #define SPEEX_ECHO_GET_IMPULSE_RESPONSE 29
61 
63 struct SpeexEchoState_;
64 
70 typedef struct SpeexEchoState_ SpeexEchoState;
71 
77 SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length);
78 
86 SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers);
87 
92 
101 void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out);
102 
104 void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout);
105 
112 void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out);
113 
118 void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play);
119 
124 
132 int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr);
133 
134 
135 
136 struct SpeexDecorrState_;
137 
138 typedef struct SpeexDecorrState_ SpeexDecorrState;
139 
140 
147 SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size);
148 
156 void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength);
157 
161 void speex_decorrelate_destroy(SpeexDecorrState *st);
162 
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 
170 #endif