sipxmedialib  Version 3.3
MpAgcBase.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2008 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2008 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // $$
10 
11 // Author: Sergey Kostanbaev <Sergey DOT Kostanbaev AT sipez DOT com>
12 
13 #ifndef _MpAgcBase_h_
14 #define _MpAgcBase_h_
15 
16 // SYSTEM INCLUDES
17 // APPLICATION INCLUDES
18 #include "utl/UtlString.h"
19 #include "mp/MpTypes.h"
20 
21 // DEFINES
22 // MACROS
23 // EXTERNAL FUNCTIONS
24 // EXTERNAL VARIABLES
25 // CONSTANTS
26 // STRUCTS
27 // TYPEDEFS
28 // FORWARD DECLARATIONS
29 
35 class MpAgcBase
36 {
37 /* //////////////////////////////// PUBLIC //////////////////////////////// */
38 public:
39 
40 /* =============================== CREATORS =============================== */
42 
43 
45  static MpAgcBase *createAgc(const UtlString &name = "");
54  virtual OsStatus init(int samplerate) = 0;
60  virtual ~MpAgcBase() {};
62 
64  virtual void reset() = 0;
65 
67 
68 /* ============================= MANIPULATORS ============================= */
70 
71 
73  virtual OsStatus processFrame(const MpAudioSample* data, int count) = 0;
74 
76  static void setDefaultAlgorithm(const UtlString& name);
87 
88 /* ============================== ACCESSORS =============================== */
90 
91 
93  virtual OsStatus getAmplitude(MpAudioSample& amp, UtlBoolean &isClipped) = 0;
94 
96 
97 /* =============================== INQUIRY ================================ */
99 
100 
101 
103 
104 /* ////////////////////////////// PROTECTED /////////////////////////////// */
105 protected:
106 
107  static UtlString smDefaultAlgorithm;
108 
109 /* /////////////////////////////// PRIVATE //////////////////////////////// */
110 private:
111 
112 };
113 
114 /* ============================ INLINE METHODS ============================ */
115 
116 #endif // _MpAgcBase_h_
virtual void reset()=0
Reset.
Base class for AGC algorithm.
Definition: MpAgcBase.h:35
int16_t MpAudioSample
Definition: MpTypes.h:44
virtual ~MpAgcBase()
Destructor.
Definition: MpAgcBase.h:61
static void setDefaultAlgorithm(const UtlString &name)
Set algorithm to be used by default.
Definition: MpAgcBase.cpp:60
virtual OsStatus processFrame(const MpAudioSample *data, int count)=0
Calculate amplitude of the frame.
static MpAgcBase * createAgc(const UtlString &name="")
Factory method for VAD algorithms creation.
Definition: MpAgcBase.cpp:31
virtual OsStatus getAmplitude(MpAudioSample &amp, UtlBoolean &isClipped)=0
Get amplitude of the last processed frame.
static UtlString smDefaultAlgorithm
Name of algorithm to be used by default.
Definition: MpAgcBase.h:107
virtual OsStatus init(int samplerate)=0
Initialize AGC with given sample rate.