sipxmedialib  Version 3.3
MpPlcBase.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 _MpPlcBase_h_
14 #define _MpPlcBase_h_
15 
16 // SYSTEM INCLUDES
17 // APPLICATION INCLUDES
18 #include <utl/UtlDefs.h>
19 #include <os/OsStatus.h>
20 #include <utl/UtlString.h>
21 #include "mp/MpTypes.h"
22 
23 // DEFINES
24 // MACROS
25 // EXTERNAL FUNCTIONS
26 // EXTERNAL VARIABLES
27 // CONSTANTS
28 // STRUCTS
29 // TYPEDEFS
30 // FORWARD DECLARATIONS
31 
40 class MpPlcBase
41 {
42 /* //////////////////////////// PUBLIC //////////////////////////////////// */
43 public:
44 
45 /* ============================ CREATORS ================================== */
47 
48 
50  static MpPlcBase *createPlc(const UtlString &name = "");
59  virtual OsStatus init(int samplesPerSec) = 0;
65  virtual ~MpPlcBase() {};
67 
69  virtual void reset() = 0;
70 
72  virtual void fullReset() = 0;
73 
75 
76 /* ============================ MANIPULATORS ============================== */
78 
79 
81  virtual OsStatus insertToHistory(int frameNum,
82  const MpSpeechParams &speechParams,
83  MpAudioSample* pBuf,
84  unsigned inSamplesNum) = 0;
99  virtual OsStatus processFrame(MpSpeechParams &speechParams,
101  MpAudioSample* pBuf,
102  unsigned bufferSize,
103  unsigned inSamplesNum,
104  unsigned outSamplesNum,
105  int wantedAdjustment,
106  int &madeAdjustment) = 0;
139  static void setDefaultAlgorithm(const UtlString& name);
151 
152 /* ============================ ACCESSORS ================================= */
154 
155 
157  virtual int getMaxDelayedFramesNum() const = 0;
162  virtual int getMaxFutureFramesNum() const = 0;
168  virtual int getAlgorithmicDelay() const = 0;
170 
172 
173 /* ============================ INQUIRY =================================== */
175 
176 
178 
179 /* //////////////////////////// PROTECTED ///////////////////////////////// */
180 protected:
181 
182  static UtlString smDefaultAlgorithm;
183 
184 /* //////////////////////////// PRIVATE /////////////////////////////////// */
185 private:
186 
187 };
188 
189 /* ============================ INLINE METHODS ============================ */
190 
191 #endif //_MpPlcBase_h_
virtual void reset()=0
Reset.
virtual int getMaxFutureFramesNum() const =0
Return maximum offset for future frame with respect to current.
Definition: MpPlcBase.h:40
virtual void fullReset()=0
Full reset followed by init call.
static void setDefaultAlgorithm(const UtlString &name)
Set algorithm to be used by default.
Definition: MpPlcBase.cpp:60
Definition: MpTypes.h:74
virtual int getAlgorithmicDelay() const =0
Return algorithmic delay in samples, should be called after init.
virtual OsStatus init(int samplesPerSec)=0
Initialize PLC with given sample rate and frame size.
virtual ~MpPlcBase()
Virtual base destructor.
Definition: MpPlcBase.h:66
virtual OsStatus processFrame(MpSpeechParams &speechParams, MpAudioSample *pBuf, unsigned bufferSize, unsigned inSamplesNum, unsigned outSamplesNum, int wantedAdjustment, int &madeAdjustment)=0
Process next frame - do PLC and/or adjustment if needed.
int16_t MpAudioSample
Definition: MpTypes.h:44
static MpPlcBase * createPlc(const UtlString &name="")
Factory method for PLC algorithms creation.
Definition: MpPlcBase.cpp:31
virtual OsStatus insertToHistory(int frameNum, const MpSpeechParams &speechParams, MpAudioSample *pBuf, unsigned inSamplesNum)=0
Update PLC history with late/future frame.
virtual int getMaxDelayedFramesNum() const =0
Return maximum offset for delayed frame with respect to current.
static UtlString smDefaultAlgorithm
Name of algorithm to be used by default.
Definition: MpPlcBase.h:182