aflibAudioMixer Class Reference

Audio Mixing class. More...

#include <aflibAudioMixer.h>

Inheritance diagram for aflibAudioMixer:

aflibAudio aflibChain aflibMemCache aflibAudioStereoToMono List of all members.

Public Member Functions

 aflibAudioMixer (aflibAudio &audio)
 Constructor that requires a parent.
 aflibAudioMixer ()
 Constructor that does not require a parent.
 ~aflibAudioMixer ()
 Destructor.
aflibStatus addMix (int input, int in_chan, int out_chan, int amp)
 Adds a mix element.
aflibStatus delMix (int input, int in_chan, int out_chan)
 Deletes a mix element.
void delAllMix ()
 Deletes all mix elements.
int getNumOfMixs ()
 Returns the current number of active mix elements.
aflibStatus getMix (int mix_num, int &input, int &in_chan, int &out_chan, int &amp)
 Returns information on a specific mix element.
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.
bool isDataSizeSupported (aflib_data_size size)
bool isEndianSupported (aflib_data_endian end)
bool isSampleRateSupported (int &rate)

Detailed Description

Audio Mixing class.

This class provides for mixing 1 or more inputs together to a single output.

It is derived from aflibAudio and thus can be used in a chain. It will mix any number of channels, inputs to one output. The output can have multiple channels. It will also allow one to adjust the amplitude of each input. This class will force each input to have the same characteristics such as sample rate, data size and endian. If they are not then it will rely on the aflibAudio chain to automatically convert the data. The sample rate will be converted to the highest value for all inputs. The data size will also be converted to the largest size amoungst the inputs. The output will then be this selection of values. The mixing is performed by mapping inputs to outputs. This is done with the addMix function. Additional parents can be added by using the addParent call in the aflibChain base class. The ID returned from this call should be used for the addMix call. The parent passed in the constructor has an ID of 1. If a parent is removed then all mixes that reference this input will be removed.


Member Function Documentation

aflibStatus aflibAudioMixer::addMix int  input,
int  in_chan,
int  out_chan,
int  amp
 

Adds a mix element.

This will add an element to be mixed. Any input specified must exist.

If an input was passed to the aflibAudioMixer constructor then that input is number 1. Use the return value from addParent there on.

The amplitude can be specified as any value between 1 and 100. This corresponds to 1 and 100 percent of full scale.

The in_chan is the channel number of the input to use. The out_chan is the same but indicates the output channel to use. The first channel for inputs and outputs start at 0. For example to mix a stereo input to a mono output one would call addMix twice with (1, 0, 0, 100) & (1, 1, 0, 100). This would take channels 0 and 1 of input 1, and output both to channel 0.

If inputs differ in their configuration then the output configuration will be the greater of eachs configs. See the documentation for setInputConfig for exactly how this is done.

If the mix was added successfully then AFLIB_SUCCESS will be returned. A mix with same input, in_chan, out_chan values will replace the old values.

void aflibAudioMixer::delAllMix  ) 
 

Deletes all mix elements.

This will delele all current mix elements.

aflibStatus aflibAudioMixer::delMix int  input,
int  in_chan,
int  out_chan
 

Deletes a mix element.

This will delele a current mix element. If successful then AFLIB_SUCCESS will be returned else if the item was not found then AFLIB_NOT_FOUND will be returned.

aflibStatus aflibAudioMixer::getMix int  mix_num,
int &  input,
int &  in_chan,
int &  out_chan,
int &  amp
 

Returns information on a specific mix element.

This will retrieve the current values for a specific mix element. One should call getNumOfMixes first. Mix numbers start at 1.

void aflibAudioMixer::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.


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