sipxmedialib  Version 3.3
MprFromMic.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2007 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2007 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 
14 
15 #ifndef _MprFromMic_h_
16 #define _MprFromMic_h_
17 
18 #define REAL_SILENCE_DETECTION
19 
20 // SYSTEM INCLUDES
21 
22 // APPLICATION INCLUDES
23 #include "os/OsDefs.h"
24 #include "os/OsMsgQ.h"
25 #include "mp/MpAudioResource.h"
26 #include "mp/MpCodec.h"
27 
28 // DEFINES
29 // MACROS
30 // EXTERNAL FUNCTIONS
31 // EXTERNAL VARIABLES
32 // CONSTANTS
33 // STRUCTS
34 // TYPEDEFS
35 typedef void (*MICDATAHOOK)(const int nLength, short* samples) ;
36 
37 // FORWARD DECLARATIONS
38 
43 {
44 /* //////////////////////////// PUBLIC //////////////////////////////////// */
45 public:
46  enum { MAX_MIC_BUFFERS = 10 };
47 
48 /* ============================ CREATORS ================================== */
50 
51 
53  MprFromMic(const UtlString& rName, OsMsgQ *pMicQ);
54 
56  virtual
57  ~MprFromMic();
58 
60 
61 /* ============================ MANIPULATORS ============================== */
63 
64 
66 
67 /* ============================ ACCESSORS ================================= */
69 
70 
72 
73 /* ============================ INQUIRY =================================== */
75 
76 
78 
79 /* //////////////////////////// PROTECTED ///////////////////////////////// */
80 protected:
81 
82 /* //////////////////////////// PRIVATE /////////////////////////////////// */
83 private:
84 
85  enum{EqFilterLen = 24};
86 
87  OsMsgQ *mpMicQ;
88  int16_t shpFilterBuf[80 + 10];
90 #ifndef REAL_SILENCE_DETECTION
91  unsigned long MinVoiceEnergy;
92 #endif
93 
95  void highpass_filter800(int16_t *, int16_t *, short);
96  MpSpeechType speech_detected(int16_t*, int);
97 
98 
99  virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[],
100  MpBufPtr outBufs[],
101  int inBufsSize,
102  int outBufsSize,
103  UtlBoolean isEnabled,
104  int samplesPerFrame=80,
105  int samplesPerSecond=8000);
106 
108  MprFromMic(const MprFromMic& rMprFromMic);
109 
111  MprFromMic& operator=(const MprFromMic& rhs);
112 
113 public:
115 
116 };
117 
118 /* ============================ INLINE METHODS ============================ */
119 
120 #endif // _MprFromMic_h_
MprFromMic(const UtlString &rName, OsMsgQ *pMicQ)
Constructor.
Definition: MprFromMic.cpp:47
void highpass_filter800(int16_t *, int16_t *, short)
Definition: MprFromMic.cpp:344
int samplesPerFrame
The "From Microphone" media processing resource.
Definition: MprFromMic.h:42
int mNumFrames
Definition: MprFromMic.h:89
static MICDATAHOOK s_fnMicDataHook
Definition: MprFromMic.h:114
Definition: MprFromMic.h:85
Definition: MprFromMic.h:46
int samplesPerSecond
MpSpeechType speech_detected(int16_t *, int)
Definition: MprFromMic.cpp:300
MpSpeechType
Type of audio data.
Definition: MpTypes.h:65
Abstract base class for all audio processing objects.
Definition: MpAudioResource.h:38
int16_t shpFilterBuf[80+10]
Definition: MprFromMic.h:88
virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[], MpBufPtr outBufs[], int inBufsSize, int outBufsSize, UtlBoolean isEnabled, int samplesPerFrame=80, int samplesPerSecond=8000)
This method does the real work for the media processing resource and must be defined in each class de...
Definition: MprFromMic.cpp:75
Smart pointer to MpBuf.
Definition: MpBuf.h:160
MprFromMic & operator=(const MprFromMic &rhs)
Assignment operator (not implemented for this class)
OsMsgQ * mpMicQ
We will read audio data from this queue.
Definition: MprFromMic.h:87
void(* MICDATAHOOK)(const int nLength, short *samples)
Definition: MprFromMic.h:35
virtual ~MprFromMic()
Destructor.
Definition: MprFromMic.cpp:60
void Init_highpass_filter800()
Definition: MprFromMic.cpp:336
UtlBoolean isEnabled() const
Returns TRUE is this resource is currently enabled, FALSE otherwise.
Definition: MpResource.cpp:440