typedef struct {
signed short l;
signed short r;
} STEREO;
/* Read a raw audio file (8KHz sample frequency, 16bit PCM, stereo)
* from stdin, echo cancel it and write it to stdout
*/
int main(int argc, char *argv[]) {
STEREO inbuf[TAPS], outbuf[TAPS];
int taps;
while (taps = fread(inbuf, sizeof(STEREO), TAPS, stdin)) {
int i;
for (i = 0; i < taps; ++i) {
int s0 = inbuf[i].l; /* left channel microphone */
int s1 = inbuf[i].r; /* right channel speaker */
/* and do NLMS*/
s0 = aec.doAEC(s0, s1);
/* copy back */
outbuf[i].l = 0; /* left channel silence */
outbuf[i].r = s0; /* right channel echo cancelled mic */
}