2
* Copyright (C) 2008 2009 Savoir-Faire Linux inc.
3
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
#ifndef SPEEXECHOCANCEL_H
21
#define SPEEXECHOCANCEL_H
23
#include "audioprocessing.h"
24
#include <speex/speex_echo.h>
25
#include "speex/speex_preprocess.h"
27
#include "ringbuffer.h"
29
class SpeexEchoCancel : public Algorithm
38
virtual void reset (void);
41
* Add speaker data into internal buffer
42
* \param inputData containing far-end voice data to be sent to speakers
44
virtual void putData (SFLDataFormat *inputData, int nbBytes);
49
virtual void process (SFLDataFormat *data, int nbBytes);
52
* Perform echo cancellation using internal buffers
53
* \param inputData containing mixed echo and voice data
54
* \param outputData containing
56
virtual int process (SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes);
59
* Perform echo cancellation, application must provide its own buffer
60
* \param micData containing mixed echo and voice data
61
* \param spkrData containing far-end voice data to be sent to speakers
62
* \param outputData containing the processed data
64
virtual void process (SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes);
68
SpeexEchoState *_echoState;
70
SpeexPreprocessState *_preState;
73
RingBuffer *_spkrData;
77
SFLDataFormat _tmpSpkr[5000];
78
SFLDataFormat _tmpMic[5000];
79
SFLDataFormat _tmpOut[5000];