OPAL  Version 3.10.10
echocancel.h
Go to the documentation of this file.
1 /*
2  * echocancel.h
3  *
4  * Open Phone Abstraction Library (OPAL)
5  * Formally known as the Open H323 project.
6  *
7  * Copyright (c) 2004 Post Increment
8  *
9  * The contents of this file are subject to the Mozilla Public License
10  * Version 1.0 (the "License"); you may not use this file except in
11  * compliance with the License. You may obtain a copy of the License at
12  * http://www.mozilla.org/MPL/
13  *
14  * Software distributed under the License is distributed on an "AS IS"
15  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16  * the License for the specific language governing rights and limitations
17  * under the License.
18  *
19  * The Original Code is Open Phone Abstraction Library.
20  *
21  * The author of this code is Damien Sandras
22  *
23  * Contributor(s): Miguel Rodriguez Perez
24  *
25  * $Revision: 21293 $
26  * $Author: rjongbloed $
27  * $Date: 2008-10-12 18:24:41 -0500 (Sun, 12 Oct 2008) $
28  */
29 
30 #ifndef OPAL_CODEC_ECHOCANCEL_H
31 #define OPAL_CODEC_ECHOCANCEL_H
32 
33 #ifdef P_USE_PRAGMA
34 #pragma interface
35 #endif
36 
37 #include <opal/buildopts.h>
38 
39 #include <rtp/rtp.h>
40 #include <ptclib/qchannel.h>
41 
42 #ifndef SPEEX_ECHO_H
43 struct SpeexEchoState;
44 #endif
45 
46 #ifndef SPEEX_PREPROCESS_H
47 struct SpeexPreprocessState;
48 #endif
49 
51 class OpalEchoCanceler : public PObject
52 {
53  PCLASSINFO(OpalEchoCanceler, PObject);
54 public:
55  enum Mode {
58  };
59 
60  struct Params {
62  Mode mode = NoCancelation
63  ) : m_mode (mode)
64  { }
65 
67  };
68 
76 
77 
80  const PNotifier & GetReceiveHandler() const { return receiveHandler; }
81  const PNotifier & GetSendHandler() const {return sendHandler; }
82 
83 
86  void SetParameters(
87  const Params & newParam
88  );
89 
90 
93  void SetClockRate(
94  const int clockRate
95  );
96 
97 protected:
100 
101  PNotifier receiveHandler;
102  PNotifier sendHandler;
103 
105 
106 private:
107 
108  double mean;
109  int clockRate;
110  PQueueChannel *echo_chan;
111  PMutex stateMutex;
112  SpeexEchoState *echoState;
113  SpeexPreprocessState *preprocessState;
114 
115  // the following types are all void * to avoid including Speex header files
116  void * ref_buf;
117  void * echo_buf;
118  void * e_buf;
119  void * noise;
120 };
121 
122 #endif // OPAL_CODEC_ECHOCANCEL_H
123 
PNotifier receiveHandler
Definition: echocancel.h:101
Params(Mode mode=NoCancelation)
Definition: echocancel.h:61
Mode
Definition: echocancel.h:55
const PNotifier & GetReceiveHandler() const
Definition: echocancel.h:80
Mode m_mode
Definition: echocancel.h:66
Definition: rtp.h:71
Params param
Definition: echocancel.h:104
Definition: echocancel.h:56
Definition: echocancel.h:60
void SetParameters(const Params &newParam)
Definition: echocancel.h:51
Definition: echocancel.h:57
PDECLARE_NOTIFIER(RTP_DataFrame, OpalEchoCanceler, ReceivedPacket)
const PNotifier & GetSendHandler() const
Definition: echocancel.h:81
PNotifier sendHandler
Definition: echocancel.h:102
void SetClockRate(const int clockRate)