PTLib  Version 2.14.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
paec.h
Go to the documentation of this file.
1 /*
2  * paec.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  * rewritten amd made generic ptlib by Simon Horne
24  *
25  * Contributor(s): Miguel Rodriguez Perez
26  *
27  * $Revision: 21788 $
28  * $Author: rjongbloed $
29  * $Date: 2008-12-12 16:42:13 +1100 (Fri, 12 Dec 2008) $
30  */
31 
32 #ifndef PTLIB_PAEC_H
33 #define PTLIB_PAEC_H
34 
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38 
39 #include <ptclib/qchannel.h>
40 
48 PQUEUE(ReceiveTimeQueue, PTimeInterval);
49 
50 struct SpeexEchoState;
51 struct SpeexPreprocessState;
52 class PAec : public PObject
53 {
54  PCLASSINFO(PAec, PObject);
55 public:
56 
61  PAec(int _clock = 8000, int _sampletime = 30);
62  ~PAec();
64 
69  void Send(BYTE * buffer, unsigned & length);
70 
73  void Receive(BYTE * buffer, unsigned & length);
75 
76 protected:
79  SpeexEchoState *echoState;
80  SpeexPreprocessState *preprocessState;
81  int clockrate; // Frame Rate default 8000hz for narrowband audio
82  int bufferTime; // Time between receiving and Transmitting
83  PInt64 minbuffer; // minbuffer (in milliseconds)
84  PInt64 maxbuffer; // maxbuffer (in milliseconds)
85  int sampleTime; // Length of each sample
86  ReceiveTimeQueue rectime; // Queue of timestamps for ensure read/write in sync
87  PTimeInterval lastTimeStamp; // LastTimeStamp of recieved data
89  void *ref_buf;
90  void *echo_buf;
91  void *e_buf;
92  void *noise;
93 
94 };
95 
96 #endif // PTLIB_PAEC_H
97 
98 // End Of File ///////////////////////////////////////////////////////////////