OPAL Version 3.10.2
OpalSilenceDetector Class Reference

#include <silencedetect.h>

Inheritance diagram for OpalSilenceDetector:
OpalLineSilenceDetector OpalPCM16SilenceDetector

Data Structures

struct  Params

Public Types

enum  Mode { NoSilenceDetection, FixedSilenceDetection, AdaptiveSilenceDetection, NumModes }

Public Member Functions

Construction
 OpalSilenceDetector (const Params &newParam)

Basic operations

PNotifier receiveHandler
Mode mode
unsigned signalDeadband
unsigned silenceDeadband
unsigned adaptivePeriod
int clockRate
unsigned lastTimestamp
unsigned receivedTime
unsigned levelThreshold
unsigned signalMinimum
unsigned silenceMaximum
unsigned signalReceivedTime
unsigned silenceReceivedTime
bool inTalkBurst
PMutex inUse
const PNotifier & GetReceiveHandler () const
void SetParameters (const Params &params, const int clockRate=0)
void SetClockRate (const int clockRate)
int GetClockRate () const
Mode GetStatus (PBoolean *isInTalkBurst, unsigned *currentThreshold) const
virtual unsigned GetAverageSignalLevel (const BYTE *buffer, PINDEX size)=0
 PDECLARE_NOTIFIER (RTP_DataFrame, OpalSilenceDetector, ReceivedPacket)

Member Enumeration Documentation

Enumerator:
NoSilenceDetection 
FixedSilenceDetection 
AdaptiveSilenceDetection 
NumModes 

Constructor & Destructor Documentation

OpalSilenceDetector::OpalSilenceDetector ( const Params newParam)

Create a new detector. Default clock rate is 8000.

Parameters:
newParamNew parameters for silence detector

Member Function Documentation

virtual unsigned OpalSilenceDetector::GetAverageSignalLevel ( const BYTE *  buffer,
PINDEX  size 
) [pure virtual]

Get the average signal level in the stream. This is called from within the silence detection algorithm to calculate the average signal level of the last data frame read from the stream.

The default behaviour returns UINT_MAX which indicates that the average signal has no meaning for the stream.

Parameters:
bufferRTP payload being detected
sizeSize of payload buffer

Implemented in OpalPCM16SilenceDetector, and OpalLineSilenceDetector.

int OpalSilenceDetector::GetClockRate ( ) const [inline]

Get the current sampling clock rate.

References clockRate.

const PNotifier& OpalSilenceDetector::GetReceiveHandler ( ) const [inline]

References receiveHandler.

Mode OpalSilenceDetector::GetStatus ( PBoolean *  isInTalkBurst,
unsigned *  currentThreshold 
) const

Get silence detection status

The inTalkBurst value is true if packet transmission is enabled and false if it is being suppressed due to silence.

The currentThreshold value is the value from 0 to 32767 which is used as the threshold value for 16 bit PCM data.

OpalSilenceDetector::PDECLARE_NOTIFIER ( RTP_DataFrame  ,
OpalSilenceDetector  ,
ReceivedPacket   
) [protected]
void OpalSilenceDetector::SetClockRate ( const int  clockRate)

Set the sampling clock rate for the preprocessor. Adusts the interpretation of time values. This may be called while audio is being transferred, but if in adaptive mode calling this will reset the filter.

Parameters:
clockRateSampling clock rate for the preprocessor
void OpalSilenceDetector::SetParameters ( const Params params,
const int  clockRate = 0 
)

Set the silence detector parameters. This adjusts the silence detector "agression". The deadband and adaptive periods are in ms units to work for any clock rate. The clock rate value is optional: 0 leaves value unchanged. This may be called while audio is being transferred, but if in adaptive mode calling this will reset the filter.

Parameters:
paramsNew parameters for silence detector
clockRateSampling clock rate for the preprocessor

Field Documentation

Referenced by GetClockRate().

PMutex OpalSilenceDetector::inUse [protected]
unsigned OpalSilenceDetector::lastTimestamp [protected]
unsigned OpalSilenceDetector::receivedTime [protected]
PNotifier OpalSilenceDetector::receiveHandler [protected]

Referenced by GetReceiveHandler().

unsigned OpalSilenceDetector::signalMinimum [protected]

The documentation for this class was generated from the following file: