OpalSilenceDetector Class Referenceabstract

`#include <silencedetect.h>`

Inheritance diagram for OpalSilenceDetector:

## 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

enum OpalSilenceDetector::Mode

Enumerator
NoSilenceDetection |
FixedSilenceDetection |
AdaptiveSilenceDetection |
NumModes |

## Constructor & Destructor Documentation

OpalSilenceDetector::OpalSilenceDetector | ( | const Params & | newParam | ) |

Create a new detector. Default clock rate is 8000.

Parameters

  newParam | New 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

  buffer | RTP payload being detected
  size | Size of payload buffer

Implemented in OpalLineSilenceDetector, and OpalPCM16SilenceDetector.

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

  clockRate | Sampling 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

  params | New parameters for silence detector
  clockRate | Sampling clock rate for the preprocessor

## Field Documentation

unsigned OpalSilenceDetector::adaptivePeriod

protected

int OpalSilenceDetector::clockRate

protected

Referenced by GetClockRate().

bool OpalSilenceDetector::inTalkBurst

protected

PMutex OpalSilenceDetector::inUse

protected

unsigned OpalSilenceDetector::lastTimestamp

protected

unsigned OpalSilenceDetector::levelThreshold

protected

Mode OpalSilenceDetector::mode

protected

unsigned OpalSilenceDetector::receivedTime

protected

PNotifier OpalSilenceDetector::receiveHandler

protected

Referenced by GetReceiveHandler().

unsigned OpalSilenceDetector::signalDeadband

protected

unsigned OpalSilenceDetector::signalMinimum

protected

unsigned OpalSilenceDetector::signalReceivedTime

protected

unsigned OpalSilenceDetector::silenceDeadband

protected

unsigned OpalSilenceDetector::silenceMaximum

protected

unsigned OpalSilenceDetector::silenceReceivedTime

protected

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

- silencedetect.h