Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

aflibAudioSpectrum Class Reference

Audio spectrum display and power meter class. More...

#include <aflibAudioSpectrum.h>

Inheritance diagram for aflibAudioSpectrum::

aflibAudio aflibChain aflibMemCache List of all members.

Public Methods

 aflibAudioSpectrum (aflibAudio &audio)
 Constuctor with an audio parent. More...

 ~aflibAudioSpectrum ()
 Destructor.

bool setParameters (int num_samples, int resp_per_sec, int channels)
 Sets parameters for the audio spectrum class. More...

void setPowerMeterCallback (powermeter_callback func_ptr)
 Enables and disables power meter callback. More...

void setAudioSpectrumCallback (spectrum_callback func_ptr)
 Enables and disables audio spectrum callback. More...

void setInputConfig (const aflibConfig &cfg)
 Sets the input audio data configuration of an object. More...

aflibStatus compute_segment (list< aflibData *> &data, long long position=-1)
 Work function, must be implemented by derived class.

const char* getName () const
 Returns the name of the derived class.


Detailed Description

Audio spectrum display and power meter class.

This is a class that is derived from aflibAudio so that it can be put in a chain. It allows the user to display a power meter (ie signal strength) or a spectrum display. The number of elements in the spectrum display is changeable. The user can have either or both at the same time. It also provides the ability to change the number of updates that occur. It also supports more than one channel.


Constructor & Destructor Documentation

aflibAudioSpectrum::aflibAudioSpectrum ( aflibAudio & audio )
 

Constuctor with an audio parent.

This will setup for 4 responses per second and 16 samples with 1 channel. No callbacks are enabled.

aflibAudioSpectrum::~aflibAudioSpectrum ( )
 

Destructor.


Member Function Documentation

aflibStatus aflibAudioSpectrum::compute_segment ( list< aflibData *> & data,
long long position = -1 ) [virtual]
 

Work function, must be implemented by derived class.

Reimplemented from aflibAudio.

const char * aflibAudioSpectrum::getName ( ) const [inline, virtual]
 

Returns the name of the derived class.

Reimplemented from aflibAudio.

void aflibAudioSpectrum::setAudioSpectrumCallback ( spectrum_callback func_ptr )
 

Enables and disables audio spectrum callback.

This function allows one to register a callback that will get called whenever there is data processed showing what the audio spectrum is. It will be called based on the responses per second that was set in the setParamters call. The user must register a function that receives an int and a double array: func(int array_size, *double array); The first value passed will be the size of the array passed. Users should not read beyond this size. The array values passed will be in decibels. When func is called users should copy the data if they wish to save it as the memory will go out of scope when func is exitted. In order to turn off the callback pass NULL to this function.

void aflibAudioSpectrum::setInputConfig ( const aflibConfig & cfg ) [virtual]
 

Sets the input audio data configuration of an object.

This is a virtual function that derived classes can override if needed. It allows the caller to set the configuration of the audio data of an object. By default it saves the output audio configuration to be the same as the input data configuration that is passed in. This should be sufficient for most derived classes. For those classes that will have a change from the output to input config mapping then this function should be overriden and the output config processed and saved.

Reimplemented from aflibAudio.

bool aflibAudioSpectrum::setParameters ( int num_samples,
int resp_per_sec,
int channels )
 

Sets parameters for the audio spectrum class.

This allows the user to set the number of samples to be returned for the spectrum callback. It also determines the size of the fft that is done for both the spectrum and power meter callbacks. The number of samples must be a power of 2 upto 512. Another words, valid values are: 2, 4, 8, 16, 32, 64, 128, 256, 512. It also allows the user to set the number of times the callback functions will get called a second. There are limits to how large this value can be. It also depends on the sample rate of the audio stream. Good values would be 10 or less. If an invalid number of samples is set then FALSE will be returned.

void aflibAudioSpectrum::setPowerMeterCallback ( powermeter_callback func_ptr )
 

Enables and disables power meter callback.

This function allows one to register a callback that will get called whenever there is data processed showing what the power is. It will be called based on the responses per second that was set in the setParamters call. The user must register a function that receives a double: func(double val); The value passed will be in decibels. In order to turn off the callback pass NULL to this function.


The documentation for this class was generated from the following files:
Generated at Tue Aug 7 22:18:07 2001 for Open Source Audio Library Project by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001