sipxmedialib  Version 3.3
Static Public Attributes | List of all members
MpPlcSilence Class Reference

#include <MpPlcSilence.h>

Inheritance diagram for MpPlcSilence:
Inheritance graph
[legend]
Collaboration diagram for MpPlcSilence:
Collaboration graph
[legend]

Public Member Functions

Creators
OsStatus init (int samplesPerSec)
 Initialize PLC with given sample rate and frame size. More...
 
 ~MpPlcSilence ()
 Destructor. More...
 
void reset ()
 Reset. More...
 
void fullReset ()
 Full reset followed by init call. More...
 
Manipulators
OsStatus insertToHistory (int frameNum, const MpSpeechParams &speechParams, MpAudioSample *pBuf, unsigned inSamplesNum)
 Update PLC history with late/future frame. More...
 
OsStatus processFrame (MpSpeechParams &speechParams, MpAudioSample *pBuf, unsigned bufferSize, unsigned inSamplesNum, unsigned outSamplesNum, int wantedAdjustment, int &madeAdjustment)
 Process next frame - do PLC and/or adjustment if needed. More...
 
Accessors
int getMaxDelayedFramesNum () const
 Return maximum offset for delayed frame with respect to current. More...
 
int getMaxFutureFramesNum () const
 Return maximum offset for future frame with respect to current. More...
 
int getAlgorithmicDelay () const
 Return algorithmic delay in samples, should be called after init. More...
 
- Public Member Functions inherited from MpPlcBase
virtual ~MpPlcBase ()
 Virtual base destructor. More...
 

Static Public Attributes

static const char * name = "Silence substitution"
 

Additional Inherited Members

- Static Public Member Functions inherited from MpPlcBase
static MpPlcBasecreatePlc (const UtlString &name="")
 Factory method for PLC algorithms creation. More...
 
static void setDefaultAlgorithm (const UtlString &name)
 Set algorithm to be used by default. More...
 
- Static Protected Attributes inherited from MpPlcBase
static UtlString smDefaultAlgorithm
 Name of algorithm to be used by default. More...
 

Detailed Description

Silence substitution PLC.

Simplest possible PLC - it just returns silence in place of missed frames.

Constructor & Destructor Documentation

Destructor.

Member Function Documentation

OsStatus init ( int  samplesPerSec)
virtual

Initialize PLC with given sample rate and frame size.

Should be called before any other class methods.

Implements MpPlcBase.

void reset ( )
virtual

Reset.

Implements MpPlcBase.

void fullReset ( )
virtual

Full reset followed by init call.

Implements MpPlcBase.

OsStatus insertToHistory ( int  frameNum,
const MpSpeechParams speechParams,
MpAudioSample pBuf,
unsigned  inSamplesNum 
)
virtual

Update PLC history with late/future frame.

Parameters
[in]frameNum- position of passed data relative to current moment. E.g. frameNum<0 means late frame, frameNum>0 means future frame and frameNum==0 means current frame. Passing late and future frames may improve PLC quality if algorithm supports this. Passing late and future frames they should be in bounds set by of getMaxFutureFramesNum() and getMaxDelayedFramesNum().
[in]speechParams- various parameters of speech.
[in,out]pBuf- buffer with input data.
[in]inSamplesNum- number of samples of actual data, passed to this function.

Implements MpPlcBase.

OsStatus processFrame ( MpSpeechParams speechParams,
MpAudioSample pBuf,
unsigned  bufferSize,
unsigned  inSamplesNum,
unsigned  outSamplesNum,
int  wantedAdjustment,
int &  madeAdjustment 
)
virtual

Process next frame - do PLC and/or adjustment if needed.

Parameters
[in]speechParams- various parameters of speech.
[in,out]pBuf- buffer with input data and place for output data. Data is read from this buffer if numSamples>0. If any processing is needed, i.e. PLC or adjustment is requested, output data will also be written to this buffer.
[in]bufferSize- size of pBuf buffer. This value is always greater or equal to numSamples. When algorithm needs to write data to buffer it must take this value into account.
[in]inSamplesNum- number of samples of actual data, passed to this function. If we've got no data and PLC is needed, this parameter should be equal to 0. If inSamplesNum is not 0, it is equal to outSamplesNum.
[in]outSamplesNum- output frame size. Together with wantedAdjustment this value sets bounds in which we want to fit output data length. See wantedAdjustment for more details. If inSamplesNum is not 0, outSamplesNum is equal to it.
[in]wantedAdjustment- number of samples by which we want to adjust audio stream. Output number of samples must be in range [outSamplesNum; outSamplesNum + wantedAdjustment]. Output lengths closer to outSamplesNum + wantedAdjustment are desired, but not required. Note, that output lengths not in this range are not allowed and may confuse upper levels. Positive values request stream extension (samples should be added), negative values request stream reduction (samples should be took off).
[out]madeAdjustment- length of made adjustment. Shows how many samples were added to stream (if positive) or removed from stream (if negative).

Implements MpPlcBase.

int getMaxDelayedFramesNum ( ) const
virtual

Return maximum offset for delayed frame with respect to current.

If zero is returned, late packets are not allowed.

Implements MpPlcBase.

int getMaxFutureFramesNum ( ) const
virtual

Return maximum offset for future frame with respect to current.

If zero is returned, future packets are not allowed.

Implements MpPlcBase.

int getAlgorithmicDelay ( ) const
virtual

Return algorithmic delay in samples, should be called after init.

Implements MpPlcBase.

Member Data Documentation

const char * name = "Silence substitution"
static