# OpalSilenceDetector Class Reference

`#include <silencedetect.h>`

Inheritance diagram for OpalSilenceDetector:

[legend]

## Basic operations

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

## Public Types

typedef Modes | Mode

## Public Member Functions

| P_DECLARE_ENUM (Modes, NoSilenceDetection, FixedSilenceDetection, AdaptiveSilenceDetection)
Construction
| OpalSilenceDetector (const Params &newParam)

## Data Structures

struct | Params

## Member Typedef Documentation

typedef Modes OpalSilenceDetector::Mode

## 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 OpalPCM16SilenceDetector, and OpalLineSilenceDetector.

int OpalSilenceDetector::GetClockRate | ( |  | ) | const`[inline]`

Get the current sampling clock rate.

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

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::P_DECLARE_ENUM | ( | Modes | ,
|  | NoSilenceDetection | ,
|  | FixedSilenceDetection | ,
|  | AdaptiveSilenceDetection |  |
| ) |  |  |

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]`

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]`

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