BLOG | DOCUMENTATION | GITHUB

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) throw (Error)
 
bool isBusy () const
 
void stop () throw (Error)
 
void rewind () throw (Error)
 
void play (const ToneDescVector &tones, bool loop=false) throw (Error)
 
void playDigits (const ToneDigitVector &digits, bool loop=false) throw (Error)
 
ToneDigitMapVector getDigitMap () const throw (Error)
 
void setDigitMap (const ToneDigitMapVector &digit_map) throw (Error)
 
- Public Member Functions inherited from pj::AudioMedia
ConfPortInfo getPortInfo () const throw (Error)
 
int getPortId () const
 
void startTransmit (const AudioMedia &sink) const throw (Error)
 
void startTransmit2 (const AudioMedia &sink, const AudioMediaTransmitParam &param) const throw (Error)
 
void stopTransmit (const AudioMedia &sink) const throw (Error)
 
void adjustRxLevel (float level) throw (Error)
 
void adjustTxLevel (float level) throw (Error)
 
unsigned getRxLevel () const throw (Error)
 
unsigned getTxLevel () const 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) throw (Error)
 
static AudioMediatypecastFromMedia (Media *media)
 
- Protected Member Functions inherited from pj::AudioMedia
void registerMediaPort (MediaPort port) throw (Error)
 
void registerMediaPort2 (MediaPort port, pj_pool_t *pool) 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 
)
throw (Error
)

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 ( )
throw (Error
)

Instruct the tone generator to stop current processing.

◆ rewind()

void pj::ToneGenerator::rewind ( )
throw (Error
)

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 
)
throw (Error
)

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 
)
throw (Error
)

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
throw (Error
)

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)
throw (Error
)

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.