echocancel.h

Go to the documentation of this file.
00001 /*
00002  * echocancel.h
00003  *
00004  * Open Phone Abstraction Library (OPAL)
00005  * Formally known as the Open H323 project.
00006  *
00007  * Copyright (c) 2004 Post Increment
00008  *
00009  * The contents of this file are subject to the Mozilla Public License
00010  * Version 1.0 (the "License"); you may not use this file except in
00011  * compliance with the License. You may obtain a copy of the License at
00012  * http://www.mozilla.org/MPL/
00013  *
00014  * Software distributed under the License is distributed on an "AS IS"
00015  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00016  * the License for the specific language governing rights and limitations
00017  * under the License.
00018  *
00019  * The Original Code is Open Phone Abstraction Library.
00020  *
00021  * The author of this code is Damien Sandras
00022  *
00023  * Contributor(s): Miguel Rodriguez Perez
00024  *
00025  * $Revision: 19279 $
00026  * $Author: rjongbloed $
00027  * $Date: 2008-01-17 04:08:34 +0000 (Thu, 17 Jan 2008) $
00028  */
00029 
00030 #ifndef __OPAL_ECHOCANCEL_H
00031 #define __OPAL_ECHOCANCEL_H
00032 
00033 #ifdef P_USE_PRAGMA
00034 #pragma interface
00035 #endif
00036 
00037 #include <rtp/rtp.h>
00038 #include <ptclib/qchannel.h>
00039 
00040 #ifndef SPEEX_ECHO_H
00041 struct SpeexEchoState;
00042 #endif
00043 
00044 #ifndef SPEEX_PREPROCESS_H
00045 struct SpeexPreprocessState;
00046 #endif 
00047 
00049 class OpalEchoCanceler : public PObject
00050 {
00051   PCLASSINFO(OpalEchoCanceler, PObject);
00052 public:
00053   enum Mode {
00054     NoCancelation,
00055     Cancelation
00056   };
00057 
00058   struct Params {
00059     Params(
00060            Mode mode = NoCancelation
00061            ) : m_mode (mode)
00062     { }
00063 
00064     Mode m_mode;
00065   };
00066 
00071   OpalEchoCanceler();
00072   ~OpalEchoCanceler();
00074 
00075 
00078     const PNotifier & GetReceiveHandler() const { return receiveHandler; }
00079     const PNotifier & GetSendHandler() const {return sendHandler; }
00080 
00081     
00084     void SetParameters(
00085       const Params & newParam 
00086     );
00087 
00088 
00091     void SetClockRate(
00092       const int clockRate     
00093     );
00094 
00095 protected:
00096   PDECLARE_NOTIFIER(RTP_DataFrame, OpalEchoCanceler, ReceivedPacket);
00097   PDECLARE_NOTIFIER(RTP_DataFrame, OpalEchoCanceler, SentPacket);
00098 
00099   PNotifier receiveHandler;
00100   PNotifier sendHandler;
00101 
00102   Params param;
00103 
00104 private:
00105 
00106   double mean;
00107   int clockRate;
00108   PQueueChannel *echo_chan;
00109   PMutex stateMutex;
00110   SpeexEchoState *echoState;
00111   SpeexPreprocessState *preprocessState;
00112 
00113   // the following types are all void * to avoid including Speex header files
00114   void * ref_buf;
00115   void * echo_buf;
00116   void * e_buf;
00117   void * noise;
00118 };
00119 
00120 #endif // __OPAL_ECHOCANCEL_H
00121 

Generated on Mon Sep 15 11:48:42 2008 for OPAL by  doxygen 1.5.1