sipxmedialib  Version 3.3
MprMixer.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 
15 #ifndef _MprMixer_h_
16 #define _MprMixer_h_
17 
18 // SYSTEM INCLUDES
19 
20 // APPLICATION INCLUDES
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 
36 class MprMixer : public MpAudioResource
37 {
38 /* //////////////////////////// PUBLIC //////////////////////////////////// */
39 public:
40 
41 /* ============================ CREATORS ================================== */
43 
44 
46  MprMixer(const UtlString& rName, int numWeights);
47 
49  virtual
50  ~MprMixer();
51 
53 
54 /* ============================ MANIPULATORS ============================== */
56 
57 
59  UtlBoolean setWeights(int *newWeights, int numWeights);
64  UtlBoolean setWeight(int newWeight, int weightIndex);
71 
72 /* ============================ ACCESSORS ================================= */
74 
75 
77 
78 /* ============================ INQUIRY =================================== */
80 
81 
83 
84 /* //////////////////////////// PROTECTED ///////////////////////////////// */
85 protected:
86 
87 /* //////////////////////////// PRIVATE /////////////////////////////////// */
88 private:
89 
90  typedef enum
91  {
94  } AddlMsgTypes;
95 
96  enum { MAX_MIXER_INPUTS = 10 };
97 
100  int mScale;
101 
102  virtual UtlBoolean doProcessFrame(MpBufPtr inBufs[],
103  MpBufPtr outBufs[],
104  int inBufsSize,
105  int outBufsSize,
106  UtlBoolean isEnabled,
107  int samplesPerFrame,
108  int samplesPerSecond);
109 
111  virtual UtlBoolean handleMessage(MpFlowGraphMsg& rMsg);
112 
114  UtlBoolean handleSetWeight(int newWeight, int weightIndex);
115 
117  UtlBoolean handleSetWeights(int *newWeights, int numWeights);
118 
120  MprMixer(const MprMixer& rMprMixer);
121 
123  MprMixer& operator=(const MprMixer& rhs);
124 
125 };
126 
127 /* ============================ INLINE METHODS ============================ */
128 
129 #endif // _MprMixer_h_
Message object used to communicate with the media processing task.
Definition: MpFlowGraphMsg.h:33
int samplesPerFrame
int mWeights[MAX_MIXER_INPUTS]
Definition: MprMixer.h:98
UtlBoolean handleSetWeight(int newWeight, int weightIndex)
Handle the SET_WEIGHT message.
Definition: MprMixer.cpp:205
UtlBoolean setWeight(int newWeight, int weightIndex)
Sets the weighting factor for the "weightIndex" input.
Definition: MprMixer.cpp:77
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: MprMixer.cpp:95
Definition: MprMixer.h:93
Definition: MprMixer.h:92
int samplesPerSecond
virtual ~MprMixer()
Destructor.
Definition: MprMixer.cpp:49
MprMixer(const UtlString &rName, int numWeights)
Constructor.
Definition: MprMixer.cpp:37
int mScale
Definition: MprMixer.h:100
Definition: MprMixer.h:96
Abstract base class for all audio processing objects.
Definition: MpAudioResource.h:38
MprMixer & operator=(const MprMixer &rhs)
Assignment operator (not implemented for this class)
UtlBoolean setWeights(int *newWeights, int numWeights)
Sets the weighting factors for the first "numWeights" inputs.
Definition: MprMixer.cpp:58
Smart pointer to MpBuf.
Definition: MpBuf.h:160
The "Mixer" media processing resource.
Definition: MprMixer.h:36
UtlBoolean handleSetWeights(int *newWeights, int numWeights)
Handle the SET_WEIGHTS message.
Definition: MprMixer.cpp:218
int mNumWeights
Definition: MprMixer.h:99
virtual UtlBoolean handleMessage(MpFlowGraphMsg &rMsg)
Handle messages for this resource.
Definition: MprMixer.cpp:180
AddlMsgTypes
Definition: MprMixer.h:90
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