~ubuntu-branches/ubuntu/saucy/sflphone/saucy

« back to all changes in this revision

Viewing changes to sflphone-common/src/audio/speexechocancel.h

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2010-12-24 16:33:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101224163355-tkvvikqxbrbav6up
Tags: 0.9.11-1
* New upstream release
* Add new build dependencies on libwebkit-dev and libyaml-dev

* Bump Standards-Version up to 3.9.1
* Bump debhelper compatibility to 8
* Patch another typo in the upstream code (lintian notice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2008 2009 Savoir-Faire Linux inc.
 
3
 *  Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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.
 
18
 */
 
19
 
 
20
#ifndef SPEEXECHOCANCEL_H
 
21
#define SPEEXECHOCANCEL_H
 
22
 
 
23
#include "audioprocessing.h"
 
24
#include <speex/speex_echo.h>
 
25
#include "speex/speex_preprocess.h"
 
26
 
 
27
#include "ringbuffer.h"
 
28
 
 
29
class SpeexEchoCancel : public Algorithm
 
30
{
 
31
 
 
32
    public:
 
33
 
 
34
        SpeexEchoCancel();
 
35
 
 
36
        ~SpeexEchoCancel();
 
37
 
 
38
        virtual void reset (void);
 
39
 
 
40
        /**
 
41
         * Add speaker data into internal buffer
 
42
         * \param inputData containing far-end voice data to be sent to speakers
 
43
         */
 
44
        virtual void putData (SFLDataFormat *inputData, int nbBytes);
 
45
 
 
46
        /**
 
47
         * Unused
 
48
         */
 
49
        virtual void process (SFLDataFormat *data, int nbBytes);
 
50
 
 
51
        /**
 
52
         * Perform echo cancellation using internal buffers
 
53
         * \param inputData containing mixed echo and voice data
 
54
         * \param outputData containing
 
55
         */
 
56
        virtual int process (SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes);
 
57
 
 
58
        /**
 
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
 
63
         */
 
64
        virtual void process (SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes);
 
65
 
 
66
    private:
 
67
 
 
68
        SpeexEchoState *_echoState;
 
69
 
 
70
        SpeexPreprocessState *_preState;
 
71
 
 
72
        RingBuffer *_micData;
 
73
        RingBuffer *_spkrData;
 
74
 
 
75
        bool _spkrStoped;
 
76
 
 
77
        SFLDataFormat _tmpSpkr[5000];
 
78
        SFLDataFormat _tmpMic[5000];
 
79
        SFLDataFormat _tmpOut[5000];
 
80
 
 
81
        ofstream *micFile;
 
82
        ofstream *spkrFile;
 
83
        ofstream *echoFile;
 
84
};
 
85
 
 
86
#endif