PTLib  Version 2.18.8
 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  */
28 
29 #ifndef PTLIB_PAEC_H
30 #define PTLIB_PAEC_H
31 
32 #ifdef P_USE_PRAGMA
33 #pragma interface
34 #endif
35 
36 #include <ptclib/qchannel.h>
37 
45 PQUEUE(ReceiveTimeQueue, PTimeInterval);
46 
47 struct SpeexEchoState;
48 struct SpeexPreprocessState;
49 class PAec : public PObject
50 {
51  PCLASSINFO(PAec, PObject);
52 public:
53 
58  PAec(int _clock = 8000, int _sampletime = 30);
59  ~PAec();
61 
66  void Send(BYTE * buffer, unsigned & length);
67 
70  void Receive(BYTE * buffer, unsigned & length);
72 
73 protected:
76  SpeexEchoState *echoState;
77  SpeexPreprocessState *preprocessState;
78  int clockrate; // Frame Rate default 8000hz for narrowband audio
79  int bufferTime; // Time between receiving and Transmitting
80  PInt64 minbuffer; // minbuffer (in milliseconds)
81  PInt64 maxbuffer; // maxbuffer (in milliseconds)
82  int sampleTime; // Length of each sample
83  ReceiveTimeQueue rectime; // Queue of timestamps for ensure read/write in sync
84  PTimeInterval lastTimeStamp; // LastTimeStamp of recieved data
86  void *ref_buf;
87  void *echo_buf;
88  void *e_buf;
89  void *noise;
90 
91 };
92 
93 #endif // PTLIB_PAEC_H
94 
95 // End Of File ///////////////////////////////////////////////////////////////
PQueueChannel * echo_chan
Definition: paec.h:75
PBoolean receiveReady
Definition: paec.h:85
Definition: paec.h:49
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:51
#define PQUEUE(cls, T)
Declare a queue class.
Definition: lists.h:554
void * ref_buf
Definition: paec.h:86
void * e_buf
Definition: paec.h:88
int bufferTime
Definition: paec.h:79
SpeexPreprocessState * preprocessState
Definition: paec.h:77
PAec(int _clock=8000, int _sampletime=30)
Create a new canceler.
void Receive(BYTE *buffer, unsigned &length)
Playing Channel Should be called after decoding and prior to playing.
PInt64 minbuffer
Definition: paec.h:80
void Send(BYTE *buffer, unsigned &length)
@name Basic operations
PInt64 maxbuffer
Definition: paec.h:81
int sampleTime
Definition: paec.h:82
PMutex readwritemute
Definition: paec.h:74
bool PBoolean
Definition: object.h:174
ReceiveTimeQueue rectime
Definition: paec.h:83
SpeexEchoState * echoState
Definition: paec.h:76
int clockrate
Definition: paec.h:78
This class defines a thread mutual exclusion object.
Definition: mutex.h:101
Class for implementing a serial queue channel in memory.
Definition: qchannel.h:50
void * echo_buf
Definition: paec.h:87
void * noise
Definition: paec.h:89
PTimeInterval lastTimeStamp
Definition: paec.h:84
Ultimate parent class for all objects in the class library.
Definition: object.h:2204