PWLib 1.10.10
Public Types | Public Member Functions | Static Protected Member Functions | Static Protected Attributes
PDTMFEncoder Class Reference

#include <dtmf.h>

Inheritance diagram for PDTMFEncoder:
PBYTEArray

List of all members.

Public Types

enum  { DefaultToneLen = 100 }

Public Member Functions

 PDTMFEncoder (const char *dtmf=NULL, unsigned len=DefaultToneLen)
void AddTone (char ch, unsigned len=DefaultToneLen)
void AddTone (const PString &str, unsigned len=DefaultToneLen)
void AddTone (double freq1, double freq2=0, unsigned len=DefaultToneLen)
void GenerateRingBackTone ()
void GenerateDialTone ()
void GenerateBusyTone ()
char DtmfChar (PINDEX i)

Static Protected Member Functions

static PMutex & GetMutex ()
static void MakeSineTable ()
static double sine (unsigned int ptr)

Static Protected Attributes

static BOOL sineTabInit
static double sinetab [1<< 11]

Detailed Description

this class can be used to generate PCM data for tones (such as DTMF) at a sample rate of 8khz


Member Enumeration Documentation

anonymous enum
Enumerator:
DefaultToneLen 

Constructor & Destructor Documentation

PDTMFEncoder::PDTMFEncoder ( const char *  dtmf = NULL,
unsigned  len = DefaultToneLen 
) [inline]

Create PCM data for the specified DTMF sequence

Parameters:
dtmfcharacter string to encode
lenlength of each DTMF tone in milliseconds

References AddTone().


Member Function Documentation

void PDTMFEncoder::AddTone ( char  ch,
unsigned  len = DefaultToneLen 
)

Add the PCM data for the specified tone to the buffer

Parameters:
chcharacter to encode
lenlength of DTMF tone in milliseconds

Referenced by GenerateBusyTone(), GenerateDialTone(), GenerateRingBackTone(), and PDTMFEncoder().

void PDTMFEncoder::AddTone ( const PString &  str,
unsigned  len = DefaultToneLen 
)

Add the PCM data for the specified tone sequence to the buffer

Parameters:
strstring to encode
lenlength of DTMF tone in milliseconds
void PDTMFEncoder::AddTone ( double  freq1,
double  freq2 = 0,
unsigned  len = DefaultToneLen 
)

Add the PCM data for the specified dual-frequency tone to the buffer freq2 can be zero, which will generate a single frequency tone

char PDTMFEncoder::DtmfChar ( PINDEX  i)

Convenience function to get the ASCII character for a DTMF index, where the index varies from 0 to 15

Returns:
ASCII value
Parameters:
iindex of tone
void PDTMFEncoder::GenerateBusyTone ( ) [inline]

Generate PCM data for a single cadence of the US standard busy tone of 480/620hz for 1/2 second, 1/2 second of silence

References AddTone().

void PDTMFEncoder::GenerateDialTone ( ) [inline]

Generate PCM data for 1 second of US standard dial tone of 350/440hz

References AddTone().

void PDTMFEncoder::GenerateRingBackTone ( ) [inline]

Generate PCM data for a single cadence of the US standard ring tone of 440/480hz for 2 seconds, followed by 5 seconds of silence

References AddTone().

static PMutex& PDTMFEncoder::GetMutex ( ) [static, protected]
static void PDTMFEncoder::MakeSineTable ( ) [static, protected]
static double PDTMFEncoder::sine ( unsigned int  ptr) [inline, static, protected]

References sinetab.


Member Data Documentation

double PDTMFEncoder::sinetab[1<< 11] [static, protected]

Referenced by sine().

BOOL PDTMFEncoder::sineTabInit [static, protected]

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