diff options
author | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2008-05-30 15:22:28 +0400 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2008-05-30 15:22:28 +0400 |
commit | d794a6ab626ab6d3bbe6689185b22a1df993b8e0 (patch) | |
tree | 02c78019acecbae88ad2c4ec153b3f20d5e3fa9c | |
parent | 9b09b8681342c3ab874c2c3f85a84227e3251e9d (diff) |
Made multi-channel AEC API compatible with the previous one.stereo
-rw-r--r-- | include/speex/speex_echo.h | 11 | ||||
-rw-r--r-- | libspeex/mdf.c | 7 | ||||
-rw-r--r-- | libspeex/testecho.c | 2 |
3 files changed, 17 insertions, 3 deletions
diff --git a/include/speex/speex_echo.h b/include/speex/speex_echo.h index aef1f64..1970af4 100644 --- a/include/speex/speex_echo.h +++ b/include/speex/speex_echo.h @@ -74,7 +74,16 @@ typedef struct SpeexEchoState_ SpeexEchoState; * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms) * @return Newly-created echo canceller state */ -SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length, int nb_mic, int nb_speakers); +SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length); + +/** Creates a new multi-channel echo canceller state + * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms) + * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms) + * @param nb_mic Number of microphone channels + * @param nb_speakers Number of speaker channels + * @return Newly-created echo canceller state + */ +SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers); /** Destroys an echo canceller state * @param st Echo canceller state diff --git a/libspeex/mdf.c b/libspeex/mdf.c index b9945db..d8bacaf 100644 --- a/libspeex/mdf.c +++ b/libspeex/mdf.c @@ -399,7 +399,12 @@ static void dump_audio(const spx_int16_t *rec, const spx_int16_t *play, const sp #endif /** Creates a new echo canceller state */ -EXPORT SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length, int nb_mic, int nb_speakers) +EXPORT SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length) +{ + return speex_echo_state_init_mc(frame_size, filter_length, 1, 1); +} + +EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers) { int i,N,M, C, K; SpeexEchoState *st = (SpeexEchoState *)speex_alloc(sizeof(SpeexEchoState)); diff --git a/libspeex/testecho.c b/libspeex/testecho.c index 01b4539..5ae855f 100644 --- a/libspeex/testecho.c +++ b/libspeex/testecho.c @@ -31,7 +31,7 @@ int main(int argc, char **argv) ref_fd = fopen(argv[1], "rb"); e_fd = fopen(argv[3], "wb"); - st = speex_echo_state_init(NN, TAIL, 1, 1); + st = speex_echo_state_init(NN, TAIL); den = speex_preprocess_state_init(NN, sampleRate); speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &sampleRate); speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_STATE, st); |