sipxmedialib  Version 3.3
MprToneGen.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2006 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 #ifndef _MprToneGen_h_
15 #define _MprToneGen_h_
16 
17 // SYSTEM INCLUDES
18 
19 // APPLICATION INCLUDES
20 #include "mp/dtmflib.h"
21 #include "mp/MpFlowGraphMsg.h"
22 #include "mp/MpAudioResource.h"
23 
24 // DEFINES
25 // MACROS
26 // EXTERNAL FUNCTIONS
27 // EXTERNAL VARIABLES
28 // CONSTANTS
29 // STRUCTS
30 // TYPEDEFS
31 // FORWARD DECLARATIONS
32 
38 {
39 /* //////////////////////////// PUBLIC //////////////////////////////////// */
40 public:
41 
42 /* ============================ CREATORS ================================== */
44 
45 
47  MprToneGen(const UtlString& rName, const char* locale);
48 
50  virtual
51  ~MprToneGen();
52 
54 
55 /* ============================ MANIPULATORS ============================== */
57 
58 
59 #ifdef LATER
60 /* Later (soon) this will be incorporated, but this is not quite the right
61 implementation. At least these changes are needed:
62 (1) this should be an overriding virtual function, named
63  handleSetSamplesPerSec.
64 (2) MpResource (the base class) needs to be enhanced so that the base
65  virtual function exists to be overridden.
66 */
67 
69  virtual UtlBoolean setSamplesPerSec(int samplesPerSec);
70  // Returns FALSE if the specified rate is not supported, TRUE otherwise.
71 #endif
72 
75  OsStatus startTone(int toneId);
80  static OsStatus startTone(const UtlString& namedResource,
82  OsMsgQ& fgQ,
83  int toneId);
97  OsStatus stopTone(void);
104  static OsStatus stopTone(const UtlString& namedResource,
106  OsMsgQ& fgQ);
120 
121 /* ============================ ACCESSORS ================================= */
123 
124 
126 
127 /* ============================ INQUIRY =================================== */
129 
130 
132 
133 /* //////////////////////////// PROTECTED ///////////////////////////////// */
134 protected:
135 
136 /* //////////////////////////// PRIVATE /////////////////////////////////// */
137 private:
138  typedef enum
139  {
142  } AddlMsgTypes;
143 
144  static const int MIN_SAMPLE_RATE;
145  static const int MAX_SAMPLE_RATE;
146 
148  const char* mpLocale;
149 
150  virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[],
151  MpBufPtr outBufs[],
152  int inBufsSize,
153  int outBufsSize,
154  UtlBoolean isEnabled,
155  int samplesPerFrame,
156  int samplesPerSecond);
157 
159  virtual UtlBoolean handleMessage(MpFlowGraphMsg& fgMsg);
160 
162  virtual UtlBoolean handleMessage(MpResourceMsg& rMsg);
163 
165  OsStatus setFlowGraph(MpFlowGraphBase* pFlowGraph);
173  MprToneGen(const MprToneGen& rMprToneGen);
175 
177  MprToneGen& operator=(const MprToneGen& rhs);
178 
179 };
180 
181 /* ============================ INLINE METHODS ============================ */
182 
183 #endif // _MprToneGen_h_
Message object used to communicate with the media processing task.
Definition: MpFlowGraphMsg.h:33
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...
Definition: MprToneGen.cpp:114
The "Tone Generator" media processing resource.
Definition: MprToneGen.h:37
Message object used to communicate with the media processing task.
Definition: MpResourceMsg.h:30
int samplesPerFrame
Definition: dtmflib.cpp:56
Flow graph for coordinating the execution of media processing resources.
Definition: MpFlowGraphBase.h:91
OsStatus stopTone(void)
Sends a STOP_TONE message to this resource to stop generating an audio tone.
Definition: MprToneGen.cpp:87
OsStatus startTone(int toneId)
Sends a START_TONE message to this resource to begin generating an audio tone.
Definition: MprToneGen.cpp:63
int samplesPerSecond
MprToneGen(const UtlString &rName, const char *locale)
Constructor.
Definition: MprToneGen.cpp:44
Abstract base class for all audio processing objects.
Definition: MpAudioResource.h:38
MpToneGenPtr mpToneGenState
Definition: MprToneGen.h:147
static const int MIN_SAMPLE_RATE
Definition: MprToneGen.h:144
static const int MAX_SAMPLE_RATE
Definition: MprToneGen.h:145
OsStatus setFlowGraph(MpFlowGraphBase *pFlowGraph)
Associates this resource with the indicated flow graph.
Definition: MprToneGen.cpp:241
Smart pointer to MpBuf.
Definition: MpBuf.h:160
Definition: MprToneGen.h:141
const char * mpLocale
Definition: MprToneGen.h:148
AddlMsgTypes
Definition: MprToneGen.h:138
virtual UtlBoolean handleMessage(MpFlowGraphMsg &fgMsg)
Handle flowgraph messages for this resource.
Definition: MprToneGen.cpp:190
MprToneGen & operator=(const MprToneGen &rhs)
Assignment operator (not implemented for this class)
Definition: MprToneGen.h:140
virtual ~MprToneGen()
Destructor.
Definition: MprToneGen.cpp:53
UtlBoolean isEnabled() const
Returns TRUE is this resource is currently enabled, FALSE otherwise.
Definition: MpResource.cpp:440
start of resource-specific messages
Definition: MpFlowGraphMsg.h:67