<div>I have invoke the speex echo cancellation interface as follow, but it seems not work (the echo still exists, my testbed is a small udp based p2p voice chat software). Can anyone tell me why it doesn't work? or whether I have made some mistake? Thanks a lot.<br>#define SPEEX_SAMPLERATE 8000<br>#define SPEEX_NN 128<br>#define SPEEX_TAIL 1920<br><br>class AECHandler<br>{<br>public:<br> AECHandler(void){<br> this->st = speex_echo_state_init(SPEEX_NN, SPEEX_TAIL);<br> int tmp = SPEEX_SAMPLERATE;<br> this->den = speex_preprocess_state_init(SPEEX_NN, SPEEX_SAMPLERATE);<br> speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &tmp);<br> speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE, st);<br> //int tmp1 = 1;<br> //speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_AGC, &tmp1);<br> }<br> //FILE *echo_fd, *ref_fd, *e_fd;<br> short echo_buf[SPEEX_NN], ref_buf[SPEEX_NN], e_buf[SPEEX_NN];<br> SpeexEchoState *st;<br> SpeexPreprocessState *den; <br> char* inputBuf;<br> ~AECHandler(void){<br> speex_echo_state_destroy(this->st);<br> speex_preprocess_state_destroy(this->den);<br> }<br> void HookComingSound(char* buf){<br> speex_echo_playback(this->st,(spx_int16_t*)buf);<br> }<br> void HookOutingSound(char* origin, char* &outbuf){<br> speex_echo_capture(this->st,(spx_int16_t*)origin,(spx_int16_t*)outbuf);<br> speex_preprocess_run(this->den,(spx_int16_t*)outbuf);<br> }<br>};<br></div><br><!-- footer --><br><span title="neteasefooter"/><hr/>
<a href="http://www.yeah.net">网易邮箱,中国第一大电子邮件服务商</a>
</span>