sipxmedialib  Version 3.3
MprSpeexPreProcess.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2006 ProfitFuel Inc. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // Copyright (C) 2006 SIPez LLC.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 #ifndef _MprSpeexPreprocess_h_
14 #define _MprSpeexPreprocess_h_
15 
16 // SYSTEM INCLUDES
17 // APPLICATION INCLUDES
18 #include "mp/MpAudioResource.h"
19 #include "mp/MpFlowGraphMsg.h"
20 
21 // DEFINES
22 // MACROS
23 // EXTERNAL FUNCTIONS
24 // EXTERNAL VARIABLES
25 // CONSTANTS
26 // STRUCTS
27 // TYPEDEFS
28 // FORWARD DECLARATIONS
29 struct SpeexPreprocessState_;
30 typedef SpeexPreprocessState_ SpeexPreprocessState;
31 
33 
43 {
44 /* //////////////////////////// PUBLIC //////////////////////////////////// */
45 public:
46 
51  };
52 
53 /* ============================ CREATORS ================================== */
54 
56  MprSpeexPreprocess(const UtlString& rName, UtlBoolean isAgcEnabled=FALSE,
57  UtlBoolean isNoiseReductionEnabled=FALSE);
58 
60  virtual
62 
63 
64 /* ============================ MANIPULATORS ============================== */
65 
67  UtlBoolean setAGC(UtlBoolean enable);
68 
70  UtlBoolean setNoiseReduction(UtlBoolean enable);
71 
73  static inline void setGlobalAgcEnableState(GlobalEnableState state);
78  static inline void setGlobalNoiseReductionEnableState(GlobalEnableState state);
84 /* ============================ ACCESSORS ================================= */
85 
86 /* ============================ INQUIRY =================================== */
87 
88 /* //////////////////////////// PROTECTED ///////////////////////////////// */
89 protected:
90 
91 /* //////////////////////////// PRIVATE /////////////////////////////////// */
92 private:
93  typedef enum
94  {
97  } AddlMsgTypes;
98 
100  UtlBoolean mIsAgcEnabled;
103 
108  UtlBoolean mIsAgcEnabledReal;
114 
115  inline UtlBoolean getRealAgcState() const;
116  inline UtlBoolean getRealNoiseReductionState() const;
117 
118  virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[],
119  MpBufPtr outBufs[],
120  int inBufsSize,
121  int outBufsSize,
122  UtlBoolean isEnabled,
123  int samplesPerFrame,
124  int samplesPerSecond);
125 
127  virtual UtlBoolean handleMessage(MpFlowGraphMsg& rMsg);
128 
130  UtlBoolean handleSetAGC(UtlBoolean enable);
131 
133  UtlBoolean handleSetNoiseReduction(UtlBoolean enable);
134 
136  OsStatus setFlowGraph(MpFlowGraphBase* pFlowGraph);
144  UtlBoolean connectInput(MpResource& rFrom, int fromPortIdx, int toPortIdx);
146 
148  UtlBoolean disconnectInput(int outPortIdx);
149 
151  MprSpeexPreprocess(const MprSpeexPreprocess& rMprSpeexPreprocess);
152 
155 
156 };
157 
159 {
160  smGlobalAgcEnableState = state;
161 }
162 
164 {
166 }
167 
169 {
172 }
173 
175 {
178 }
179 
180 /* ============================ INLINE METHODS ============================ */
181 
182 #endif // _MprSpeexPreprocess_h_
Message object used to communicate with the media processing task.
Definition: MpFlowGraphMsg.h:33
static volatile GlobalEnableState smGlobalAgcEnableState
Definition: MprSpeexPreProcess.h:104
SpeexPreprocessState_ SpeexPreprocessState
Definition: MprSpeexPreProcess.h:29
static volatile GlobalEnableState smGlobalNoiseReductionEnableState
Definition: MprSpeexPreProcess.h:109
int samplesPerFrame
UtlBoolean getRealNoiseReductionState() const
Definition: MprSpeexPreProcess.h:174
Definition: MprSpeexPreProcess.h:95
UtlBoolean disconnectInput(int outPortIdx)
Removes the connection to the inPortIdx input port of this resource.
UtlBoolean mIsAgcEnabled
Should AGC be enabled?
Definition: MprSpeexPreProcess.h:101
UtlBoolean connectInput(MpResource &rFrom, int fromPortIdx, int toPortIdx)
Connects the toPortIdx input port on this resource to the fromPortIdx output port of the rFrom resour...
UtlBoolean mIsNoiseReductionEnabledReal
Is Noise Reduction really enabled?
Definition: MprSpeexPreProcess.h:113
All MprSpeexEchoCancel resources are forced to enable.
Definition: MprSpeexPreProcess.h:48
Flow graph for coordinating the execution of media processing resources.
Definition: MpFlowGraphBase.h:91
virtual UtlBoolean handleMessage(MpFlowGraphMsg &rMsg)
Handle messages for this resource.
int samplesPerSecond
UtlBoolean mIsAgcEnabledReal
Is AGC really enabled?
Definition: MprSpeexPreProcess.h:108
OsStatus setFlowGraph(MpFlowGraphBase *pFlowGraph)
Associates this resource with the indicated flow graph.
MprSpeexPreprocess(const UtlString &rName, UtlBoolean isAgcEnabled=FALSE, UtlBoolean isNoiseReductionEnabled=FALSE)
Constructor.
Abstract base class for all audio processing objects.
Definition: MpAudioResource.h:38
AddlMsgTypes
Definition: MprSpeexPreProcess.h:93
UtlBoolean setNoiseReduction(UtlBoolean enable)
Enable or disable noise reduction.
GlobalEnableState
Definition: MprSpeexPreProcess.h:47
The "Speex Audio Preprocessor" media processing resource.
Definition: MprSpeexPreProcess.h:42
SpeexPreprocessState * mpPreprocessState
Definition: MprSpeexPreProcess.h:99
Definition: MprSpeexPreProcess.h:96
virtual UtlBoolean enable()
Enable this resource.
Definition: MpResource.cpp:145
Smart pointer to MpBuf.
Definition: MpBuf.h:160
UtlBoolean setAGC(UtlBoolean enable)
Enable or disable Automatic Gain Control.
UtlBoolean mIsNoiseReductionEnabled
Should Noise Reduction be enabled?
Definition: MprSpeexPreProcess.h:102
static void setGlobalNoiseReductionEnableState(GlobalEnableState state)
Set global Noise Reduction enable/disable state.
Definition: MprSpeexPreProcess.h:163
UtlBoolean getRealAgcState() const
Definition: MprSpeexPreProcess.h:168
Each resource respect its own enable/disable state.
Definition: MprSpeexPreProcess.h:50
UtlBoolean handleSetNoiseReduction(UtlBoolean enable)
Handle the SET_NOISE_REDUCTION message.
Abstract base class for all media processing objects.
Definition: MpResource.h:56
virtual ~MprSpeexPreprocess()
Destructor.
#define FALSE
Definition: PlgDefsV1.h:37
virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[], MpBufPtr outBufs[], int inBufsSize, int outBufsSize, UtlBoolean isEnabled, int samplesPerFrame, int samplesPerSecond)
This method does the real work for the media processing resource and must be defined in each class de...
UtlBoolean handleSetAGC(UtlBoolean enable)
Handle the SET_AGC message.
static void setGlobalAgcEnableState(GlobalEnableState state)
Set global AGC enable/disable state.
Definition: MprSpeexPreProcess.h:158
MprSpeexPreprocess & operator=(const MprSpeexPreprocess &rhs)
Assignment operator (not implemented for this class)
UtlBoolean isEnabled() const
Returns TRUE is this resource is currently enabled, FALSE otherwise.
Definition: MpResource.cpp:440
All MprSpeexEchoCancel resources are forced to disable.
Definition: MprSpeexPreProcess.h:49
start of resource-specific messages
Definition: MpFlowGraphMsg.h:67