Commit e7fca1e2 authored by Alexandre Savard's avatar Alexandre Savard

[#1966] Instantiate AudioProcessing and EchoCanceller class

parent f215bcbc
......@@ -17,6 +17,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef ALGORITHM_H
#define ALGORITHM_H
#include "global.h"
/**
......@@ -28,11 +31,6 @@ class Algorithm {
public:
/**
* Constructor for this class
*/
Algorithm();
/**
* Class implementing this interface must define this function
* \param micData
......@@ -40,3 +38,5 @@ class Algorithm {
virtual void process(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData) = 0;
};
#endif
......@@ -29,6 +29,6 @@ AudioProcessing::~AudioProcessing(void){}
void AudioProcessing::processAudio(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData) {
_algorithm->process(micData, spkrData, outputData);
if(_algorithm)
_algorithm->process(micData, spkrData, outputData);
}
......@@ -17,6 +17,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef AUDIOPROCESSING_H
#define AUDIOPROCESSING_H
#include "algorithm.h"
/**
......@@ -49,3 +53,5 @@ private:
Algorithm *_algorithm;
};
#endif
......@@ -25,6 +25,6 @@ EchoCancel::EchoCancel() {}
EchoCancel::~EchoCancel() {}
void EchoCancel::process(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData) {
}
......@@ -17,10 +17,15 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef ECHOCANCEL_H
#define ECHOCANCEL_H
#include "audioprocessing.h"
#include <speex/speex_echo.h>
class EchoCancel : Algorithm {
class EchoCancel : public Algorithm {
public:
EchoCancel();
......@@ -34,3 +39,5 @@ class EchoCancel : Algorithm {
*/
virtual void process(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData);
};
#endif
......@@ -20,17 +20,25 @@
#include "mainbuffer.h"
#include "audioprocessing.h"
MainBuffer::MainBuffer() : _internalSamplingRate (0)
{
mixBuffer = new SFLDataFormat[STATIC_BUFSIZE];
_echoCancel = new EchoCancel();
_audioProcessing = new AudioProcessing(static_cast<Algorithm *>(_echoCancel));
}
MainBuffer::~MainBuffer()
{
delete [] mixBuffer;
mixBuffer = NULL;
delete [] mixBuffer; mixBuffer = NULL;
delete _echoCancel; _echoCancel = NULL;
delete _audioProcessing; _audioProcessing = NULL;
}
......
......@@ -29,6 +29,8 @@
#include "../global.h"
#include "../call.h"
#include "ringbuffer.h"
#include "echocancel.h"
#include "algorithm.h"
......@@ -110,6 +112,10 @@ public:
int _internalSamplingRate;
EchoCancel *_echoCancel;
AudioProcessing *_audioProcessing;
public:
friend class MainBufferTest;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment