Poster of Linux kernelThe best gift for a Linux geek
ost::AudioTone

ost::AudioTone

Section: C Library Functions (3) Updated: 1 May 2009
Local index Up
 

NAME

ost::AudioTone - The AudioTone class is used to create a frame of audio encoded single or dualtones.

 

SYNOPSIS


#include <audio2.h>

Inherits ost::Audio.

Inherited by ost::DTMFTones, ost::MFTones, and ost::TelTone.

 

Public Member Functions


Rate getRate (void)
Get the sample encoding rate being used for the tone generator.
size_t getSamples (void)
Get the frame size for the number of audio samples generated.
bool isSilent (void)
Test if the tone generator is currently set to silence.
virtual Linear getFrame (void)
Iterate the tone frame, and extract linear samples in native frame.
unsigned getFrames (Linear buffer, unsigned number)
This is used to copy one or more pages of framed audio quickly to an external buffer.
virtual bool isComplete (void)
See if at end of tone.
AudioTone (timeout_t duration=20, Rate rate=rate8khz)
Construct a silent tone generator of specific frame size.
AudioTone (unsigned f1, unsigned f2, Level l1, Level l2, timeout_t duration=20, Rate sample=rate8khz)
Construct a dual tone frame generator.
AudioTone (unsigned freq, Level level, timeout_t duration=20, Rate sample=rate8khz)
Construct a single tone frame generator.
virtual ~AudioTone ()
 

Protected Member Functions


void silence (void)
Set the frame to silent.
void reset (void)
Reset the tone generator completely.
void cleanup (void)
Cleanup for virtual destructors to use.
void single (unsigned freq, Level level)
Set frame to generate single tone.
void dual (unsigned f1, unsigned f2, Level l1, Level l2)
Set frame to generate dual tone.  

Protected Attributes


Rate rate

unsigned samples

Linear frame

double df1

double df2

double p1

double p2

Level m1

Level m2

bool silencer
 

Detailed Description

The AudioTone class is used to create a frame of audio encoded single or dualtones.

The frame will be iterated for each request, so a continual tone can be extracted by frame.

Author:

David Sugar <dyfet@ostel.com> audio tone generator class.

 

Constructor & Destructor Documentation

 

ost::AudioTone::AudioTone (timeout_t duration = 20, Rate rate = rate8khz)

Construct a silent tone generator of specific frame size.

Parameters:

duration of frame in milliseconds.
rate of samples.

 

ost::AudioTone::AudioTone (unsigned f1, unsigned f2, Level l1, Level l2, timeout_t duration = 20, Rate sample = rate8khz)

Construct a dual tone frame generator.

Parameters:

f1 frequency of tone 1.
f2 frequency of tone 2.
l1 level of tone 1.
l2 level of tone 2.
duration of frame in milliseconds.
sample rate being generated.

 

ost::AudioTone::AudioTone (unsigned freq, Level level, timeout_t duration = 20, Rate sample = rate8khz)

Construct a single tone frame generator.

Parameters:

freq of tone.
level of tone.
duration of frame in milliseconds.
sample rate being generated.

 

virtual ost::AudioTone::~AudioTone () [virtual]

 

Member Function Documentation

 

void ost::AudioTone::cleanup (void) [protected]

Cleanup for virtual destructors to use.

 

void ost::AudioTone::dual (unsigned f1, unsigned f2, Level l1, Level l2) [protected]

Set frame to generate dual tone.

Parameters:

f1 frequency of tone 1
f2 frequency of tone 2
l1 level of tone 1
l2 level of tone 2

 

virtual Linear ost::AudioTone::getFrame (void) [virtual]

Iterate the tone frame, and extract linear samples in native frame.

If endian flag passed, then convert for standard endian representation (byte swap) if needed.

Returns:

pointer to samples.

Reimplemented in ost::TelTone, ost::DTMFTones, and ost::MFTones.  

unsigned ost::AudioTone::getFrames (Linear buffer, unsigned number)

This is used to copy one or more pages of framed audio quickly to an external buffer.

Returns:

number of frames copied.

Parameters:

buffer to copy into.
number of frames requested.

 

Rate ost::AudioTone::getRate (void) [inline]

Get the sample encoding rate being used for the tone generator.

Returns:

sample rate in samples per second.

 

size_t ost::AudioTone::getSamples (void) [inline]

Get the frame size for the number of audio samples generated.

Returns:

number of samples processed in frame.

 

virtual bool ost::AudioTone::isComplete (void) [virtual]

See if at end of tone.

This is used for non-continues audio tones, or to detect 'break' events.

Returns:

true if end of data.

Reimplemented in ost::TelTone, ost::DTMFTones, and ost::MFTones.  

bool ost::AudioTone::isSilent (void)

Test if the tone generator is currently set to silence.

Returns:

true if generator set for silence.

 

void ost::AudioTone::reset (void) [protected]

Reset the tone generator completely.

Produces silence.,  

void ost::AudioTone::silence (void) [protected]

Set the frame to silent.

 

void ost::AudioTone::single (unsigned freq, Level level) [protected]

Set frame to generate single tone.

Parameters:

freq of tone.
level of tone.

 

Member Data Documentation

 

double ost::AudioTone::df1 [protected]

 

double ost::AudioTone::df2 [protected]

 

Linear ost::AudioTone::frame [protected]

 

Level ost::AudioTone::m1 [protected]

 

Level ost::AudioTone::m2 [protected]

 

double ost::AudioTone::p1 [protected]

 

double ost::AudioTone::p2 [protected]

 

Rate ost::AudioTone::rate [protected]

 

unsigned ost::AudioTone::samples [protected]

 

bool ost::AudioTone::silencer [protected]

 

Author

Generated automatically by Doxygen for ccAudio from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Protected Member Functions
Protected Attributes
Detailed Description
Constructor & Destructor Documentation
ost::AudioTone::AudioTone (timeout_t duration = 20, Rate rate = rate8khz)
ost::AudioTone::AudioTone (unsigned f1, unsigned f2, Level l1, Level l2, timeout_t duration = 20, Rate sample = rate8khz)
ost::AudioTone::AudioTone (unsigned freq, Level level, timeout_t duration = 20, Rate sample = rate8khz)
virtual ost::AudioTone::~AudioTone () [virtual]
Member Function Documentation
void ost::AudioTone::cleanup (void) [protected]
void ost::AudioTone::dual (unsigned f1, unsigned f2, Level l1, Level l2) [protected]
virtual Linear ost::AudioTone::getFrame (void) [virtual]
unsigned ost::AudioTone::getFrames (Linear buffer, unsigned number)
Rate ost::AudioTone::getRate (void) [inline]
size_t ost::AudioTone::getSamples (void) [inline]
virtual bool ost::AudioTone::isComplete (void) [virtual]
bool ost::AudioTone::isSilent (void)
void ost::AudioTone::reset (void) [protected]
void ost::AudioTone::silence (void) [protected]
void ost::AudioTone::single (unsigned freq, Level level) [protected]
Member Data Documentation
double ost::AudioTone::df1 [protected]
double ost::AudioTone::df2 [protected]
Linear ost::AudioTone::frame [protected]
Level ost::AudioTone::m1 [protected]
Level ost::AudioTone::m2 [protected]
double ost::AudioTone::p1 [protected]
double ost::AudioTone::p2 [protected]
Rate ost::AudioTone::rate [protected]
unsigned ost::AudioTone::samples [protected]
bool ost::AudioTone::silencer [protected]
Author

This document was created by man2html, using the manual pages.
Time: 21:51:50 GMT, April 16, 2011