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

#include <MpVadSimple.h>

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

Public Member Functions

Creators
 MpVadSimple ()
 Constructor. More...
 
OsStatus init (int samplesPerSec)
 Initialize VAD with given sample rate. More...
 
 ~MpVadSimple ()
 Destructor. More...
 
Manipulators
MpSpeechType processFrame (uint32_t packetTimeStamp, const MpAudioSample *pBuf, unsigned inSamplesNum, const MpSpeechParams &speechParams, UtlBoolean calcEnergyOnly=FALSE)
 Detect speech presence. More...
 
OsStatus setParam (const char *paramName, void *value)
 Set algorithm parameter. More...
 
void setMinimumEnergy (int minEnergy)
 Set threshold energy. More...
 
void reset ()
 Prepare to process other unrelated audio stream. More...
 
Accessors
int getEnergy () const
 Return weighted energy of current frame. More...
 
- Public Member Functions inherited from MpVadBase
virtual ~MpVadBase ()
 Destructor. More...
 
void setName (const UtlString &name)
 Set name. More...
 

Static Public Attributes

static const char * name = "Simple"
 Name of this VAD algorithm for use in MpVadBase::createVad(). More...
 

Private Attributes

int mLastFrameSize
 
int mLastEnergy
 
int mSamplesPerSecond
 
int mMinEnergy
 

Additional Inherited Members

- Static Public Member Functions inherited from MpVadBase
static MpVadBasecreateVad (const UtlString &name="")
 Factory method for VAD algorithms creation. More...
 
static void setDefaultAlgorithm (const UtlString &name)
 Set algorithm to be used by default. More...
 
- Protected Attributes inherited from MpVadBase
UtlString mName
 Name useful for debugging to distiguish multiple instances. More...
 
- Static Protected Attributes inherited from MpVadBase
static UtlString smDefaultAlgorithm
 Name of algorithm to be used by default. More...
 

Detailed Description

Simple Energy-basede VAD.

This VAD is simplest possible - it just compare mean frame energy with given threshold.

Constructor & Destructor Documentation

Constructor.

Destructor.

Member Function Documentation

OsStatus init ( int  samplesPerSec)
virtual

Initialize VAD with given sample rate.

Should be called before any other class methods.

Implements MpVadBase.

MpSpeechType processFrame ( uint32_t  packetTimeStamp,
const MpAudioSample pBuf,
unsigned  inSamplesNum,
const MpSpeechParams speechParams,
UtlBoolean  calcEnergyOnly = FALSE 
)
virtual

Detect speech presence.

Parameters
[in]packetTimeStamp- RTP timestamp of packet.
[in]pBuf- buffer with input data.
[in]inSamplesNum- number of samples of actual data, passed to this function.
[in]speechParams- various parameters of speech.
[in]calcEnergyOnly- if TRUE, VAD should calculate energy only.
Returns
Method returns MP_SPEECH_ACTIVE or MP_SPEECH_SILENT mainly, but if algorithm doesn't handle some situations return value may be MP_SPEECH_UNKNOWN

Implements MpVadBase.

OsStatus setParam ( const char *  paramName,
void *  value 
)
virtual

Set algorithm parameter.

Parameters
[in]paramName- name of parameter
[in]value- value, can be any type, before call cast it to void*
Returns
Method returns OS_SUCCESS if parameter has been set, otherwise OS_FAILED

Implements MpVadBase.

void setMinimumEnergy ( int  minEnergy)

Set threshold energy.

void reset ( )
virtual

Prepare to process other unrelated audio stream.

Only initialized algorithm can be reseted. Calling reset() should bring algorithm to the original state as it was right after init(). So init() should NOT be called after reset().

Implements MpVadBase.

int getEnergy ( ) const
virtual

Return weighted energy of current frame.

Implements MpVadBase.

Member Data Documentation

const char * name = "Simple"
static

Name of this VAD algorithm for use in MpVadBase::createVad().

int mLastFrameSize
private
int mLastEnergy
private
int mSamplesPerSecond
private
int mMinEnergy
private