00001 /* 00002 * paec.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 * rewritten amd made generic ptlib by Simon Horne 00024 * 00025 * Contributor(s): Miguel Rodriguez Perez 00026 * 00027 * $Revision: 21788 $ 00028 * $Author: rjongbloed $ 00029 * $Date: 2008-12-11 23:42:13 -0600 (Thu, 11 Dec 2008) $ 00030 */ 00031 00032 #ifndef PTLIB_PAEC_H 00033 #define PTLIB_PAEC_H 00034 00035 #ifdef P_USE_PRAGMA 00036 #pragma interface 00037 #endif 00038 00039 #include <ptclib/qchannel.h> 00040 00048 PQUEUE(ReceiveTimeQueue, PTimeInterval); 00049 00050 struct SpeexEchoState; 00051 struct SpeexPreprocessState; 00052 class PAec : public PObject 00053 { 00054 PCLASSINFO(PAec, PObject); 00055 public: 00056 00061 PAec(int _clock = 8000, int _sampletime = 30); 00062 ~PAec(); 00064 00069 void Send(BYTE * buffer, unsigned & length); 00070 00073 void Receive(BYTE * buffer, unsigned & length); 00075 00076 protected: 00077 PMutex readwritemute; 00078 PQueueChannel *echo_chan; 00079 SpeexEchoState *echoState; 00080 SpeexPreprocessState *preprocessState; 00081 int clockrate; // Frame Rate default 8000hz for narrowband audio 00082 int bufferTime; // Time between receiving and Transmitting 00083 PInt64 minbuffer; // minbuffer (in milliseconds) 00084 PInt64 maxbuffer; // maxbuffer (in milliseconds) 00085 int sampleTime; // Length of each sample 00086 ReceiveTimeQueue rectime; // Queue of timestamps for ensure read/write in sync 00087 PTimeInterval lastTimeStamp; // LastTimeStamp of recieved data 00088 PBoolean receiveReady; 00089 void *ref_buf; 00090 void *echo_buf; 00091 void *e_buf; 00092 void *noise; 00093 00094 }; 00095 00096 #endif // PTLIB_PAEC_H 00097 00098 // End Of File ///////////////////////////////////////////////////////////////