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 Member Functions

 aflibAudioSpectrum (aflibAudio &audio)
 Constuctor with an audio parent.
 ~aflibAudioSpectrum ()
 Destructor.
bool setParameters (int num_samples, int resp_per_sec, int channels)
 Sets parameters for the audio spectrum class.
void setPowerMeterCallback (powermeter_callback func_ptr)
 Enables and disables power meter callback.
void setAudioSpectrumCallback (spectrum_callback func_ptr)
 Enables and disables audio spectrum callback.
void setInputConfig (const aflibConfig &cfg)
 Sets the input audio data configuration of an object.
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.

Protected Member Functions

virtual void setPowerMeter (double *)
virtual void setAudioSpectrum (int, double *)

Protected Attributes

bool _pm
bool _spectrum

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.


Member Function Documentation

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 on Tue Jan 16 12:42:56 2007 for Open Source Audio Library Project by  doxygen 1.4.6