BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJSIP Reference

pj::ToneGenerator Class Reference

#include <media.hpp>

Inheritance diagram for pj::ToneGenerator:
pj::AudioMedia pj::Media

Public Member Functions

 ToneGenerator ()
 
 ~ToneGenerator ()
 
void createToneGenerator (unsigned clock_rate=16000, unsigned channel_count=1) PJSUA2_THROW(Error)
 
bool isBusy () const
 
void stop () PJSUA2_THROW(Error)
 
void rewind () PJSUA2_THROW(Error)
 
void play (const ToneDescVector &tones, bool loop=false) PJSUA2_THROW(Error)
 
void playDigits (const ToneDigitVector &digits, bool loop=false) PJSUA2_THROW(Error)
 
ToneDigitMapVector getDigitMap () const PJSUA2_THROW(Error)
 
void setDigitMap (const ToneDigitMapVector &digit_map) PJSUA2_THROW(Error)
 
- Public Member Functions inherited from pj::AudioMedia
ConfPortInfo getPortInfo () const PJSUA2_THROW(Error)
 
int getPortId () const
 
void startTransmit (const AudioMedia &sink) const PJSUA2_THROW(Error)
 
void startTransmit2 (const AudioMedia &sink, const AudioMediaTransmitParam &param) const PJSUA2_THROW(Error)
 
void stopTransmit (const AudioMedia &sink) const PJSUA2_THROW(Error)
 
void adjustRxLevel (float level) PJSUA2_THROW(Error)
 
void adjustTxLevel (float level) PJSUA2_THROW(Error)
 
unsigned getRxLevel () const PJSUA2_THROW(Error)
 
unsigned getTxLevel () const PJSUA2_THROW(Error)
 
 AudioMedia ()
 
virtual ~AudioMedia ()
 
- Public Member Functions inherited from pj::Media
virtual ~Media ()
 
pjmedia_type getType () const
 

Additional Inherited Members

- Static Public Member Functions inherited from pj::AudioMedia
static ConfPortInfo getPortInfoFromId (int port_id) PJSUA2_THROW(Error)
 
static AudioMediatypecastFromMedia (Media *media)
 
- Protected Member Functions inherited from pj::AudioMedia
void registerMediaPort (MediaPort port) PJSUA2_THROW(Error)
 
void registerMediaPort2 (MediaPort port, pj_pool_t *pool) PJSUA2_THROW(Error)
 
void unregisterMediaPort ()
 
- Protected Member Functions inherited from pj::Media
 Media (pjmedia_type med_type)
 
- Protected Attributes inherited from pj::AudioMedia
int id
 

Detailed Description

Tone generator.

Constructor & Destructor Documentation

◆ ToneGenerator()

pj::ToneGenerator::ToneGenerator ( )

Constructor.

◆ ~ToneGenerator()

pj::ToneGenerator::~ToneGenerator ( )

Destructor. This will unregister the tone generator port from the conference bridge.

Member Function Documentation

◆ createToneGenerator()

void pj::ToneGenerator::createToneGenerator ( unsigned  clock_rate = 16000,
unsigned  channel_count = 1 
)

Create tone generator and register the port to the conference bridge.

◆ isBusy()

bool pj::ToneGenerator::isBusy ( ) const

Check if the tone generator is still busy producing some tones.

Returns
Non-zero if busy.

◆ stop()

void pj::ToneGenerator::stop ( )

Instruct the tone generator to stop current processing.

◆ rewind()

void pj::ToneGenerator::rewind ( )

Rewind the playback. This will start the playback to the first tone in the playback list.

◆ play()

void pj::ToneGenerator::play ( const ToneDescVector tones,
bool  loop = false 
)

Instruct the tone generator to play single or dual frequency tones with the specified duration. The new tones will be appended to currently playing tones, unless stop() is called before calling this function. The playback will begin as soon as the tone generator is connected to other media.

Parameters
tonesArray of tones to be played.
loopPlay the tone in a loop.

◆ playDigits()

void pj::ToneGenerator::playDigits ( const ToneDigitVector digits,
bool  loop = false 
)

Instruct the tone generator to play multiple MF digits with each of the digits having individual ON/OFF duration. Each of the digit in the digit array must have the corresponding descriptor in the digit map. The new tones will be appended to currently playing tones, unless stop() is called before calling this function. The playback will begin as soon as the tone generator is connected to a sink media.

Parameters
digitsArray of MF digits.
loopPlay the tone in a loop.

◆ getDigitMap()

ToneDigitMapVector pj::ToneGenerator::getDigitMap ( ) const

Get the digit-map currently used by this tone generator.

Returns
The digitmap currently used by the tone generator

◆ setDigitMap()

void pj::ToneGenerator::setDigitMap ( const ToneDigitMapVector digit_map)

Set digit map to be used by the tone generator.

Parameters
digit_mapDigitmap to be used by the tone generator.

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

 


PJSIP Open Source, high performance, small footprint, and very very portable SIP stack
Copyright (C) 2006-2008 Teluu Inc.