# PDTMFEncoder Class Reference

this class can be used to generate PCM data for DTMF tones at a sample rate of 8khz More...

`#include <dtmf.h>`

Inheritance diagram for PDTMFEncoder:

List of all members.

## Public Types

| DefaultToneLen = 100
enum | { DefaultToneLen = 100 }

## Public Member Functions

| PDTMFEncoder (const char *dtmf=NULL, unsigned milliseconds=DefaultToneLen)
| Create PCM data for the specified DTMF sequence.
| PDTMFEncoder (char key, unsigned milliseconds=DefaultToneLen)
| Create PCM data for the specified dtmf key.
void | AddTone (const char *str, unsigned milliseconds=DefaultToneLen)
| Add the PCM data for the specified tone sequence to the buffer.
void | AddTone (char ch, unsigned milliseconds=DefaultToneLen)
| Add the PCM data for the specified tone to the buffer.
void | AddTone (double frequency1, double frequency2=0, unsigned milliseconds=DefaultToneLen)
| Add the PCM data for the specified dual-frequency tone to the buffer frequency2 can be zero, which will generate a single frequency tone.
void | GenerateRingBackTone ()
| 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.
void | GenerateDialTone ()
| Generate PCM data for 1 second of US standard dial tone of 350/440hz.
void | GenerateBusyTone ()
| 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.
char | DtmfChar (PINDEX i)
| Convenience function to get the ASCII character for a DTMF index, where the index varies from 0 to 15.

## Detailed Description

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

## Member Enumeration Documentation

anonymous enum

Enumerator:

  DefaultToneLen |

## Constructor & Destructor Documentation

PDTMFEncoder::PDTMFEncoder | ( | const char * | dtmf = `NULL`,
|  | unsigned | milliseconds = `DefaultToneLen` |
| ) |  |  |

Create PCM data for the specified DTMF sequence.

Parameters:

  dtmf | character string to encode
  milliseconds | length of each DTMF tone in milliseconds

PDTMFEncoder::PDTMFEncoder | ( | char | key,
|  | unsigned | milliseconds = `DefaultToneLen` |
| ) |  |  |

Create PCM data for the specified dtmf key.

Parameters:

  key | character string to encode
  milliseconds | length of each DTMF tone in milliseconds

## Member Function Documentation

void PDTMFEncoder::AddTone | ( | double | frequency1,
|  | double | frequency2 = `0`,
|  | unsigned | milliseconds = `DefaultToneLen` |
| ) |  |  |

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

void PDTMFEncoder::AddTone | ( | char | ch,
|  | unsigned | milliseconds = `DefaultToneLen` |
| ) |  |  |

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

Parameters:

  ch | character to encode
  milliseconds | length of DTMF tone in milliseconds

void PDTMFEncoder::AddTone | ( | const char * | str,
|  | unsigned | milliseconds = `DefaultToneLen` |
| ) |  |  |

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

Parameters:

  str | string to encode
  milliseconds | length of DTMF tone in milliseconds

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:

  i | index 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.

void PDTMFEncoder::GenerateDialTone | ( |  | ) | `[inline]`

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

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.

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

- dtmf.h