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

aflibAudioMixer Class Reference

Audio Mixing class. More...

#include <aflibAudioMixer.h>

Inheritance diagram for aflibAudioMixer::

aflibAudio aflibChain aflibMemCache aflibAudioStereoToMono List of all members.

Public Methods

 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. More...

aflibStatus delMix (int input, int in_chan, int out_chan)
 Deletes a mix element. More...

void delAllMix ()
 Deletes all mix elements. More...

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

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 form an 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 in input will be removed.


Constructor & Destructor Documentation

aflibAudioMixer::aflibAudioMixer ( aflibAudio & audio )
 

Constructor that requires a parent.

aflibAudioMixer::aflibAudioMixer ( )
 

Constructor that does not require a parent.

aflibAudioMixer::~aflibAudioMixer ( )
 

Destructor.


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. The first input is number 1. 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, 50) & (1, 1, 0, 50). This would take channels 0 and 1 of input 1, divide each by two, and add both together and output as channel 0. If inputs differ in their configuration then they will be configure to the greater of eachs configs. 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.

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

Work function, must be implemented by derived class.

Reimplemented from aflibAudio.

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.

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

Returns the name of the derived class.

Reimplemented from aflibAudio.

Reimplemented in aflibAudioStereoToMono.

int aflibAudioMixer::getNumOfMixs ( )
 

Returns the current number of active mix elements.

bool aflibAudioMixer::isDataSizeSupported ( aflib_data_size size ) [virtual]
 

Reimplemented from aflibAudio.

bool aflibAudioMixer::isEndianSupported ( aflib_data_endian end ) [virtual]
 

Reimplemented from aflibAudio.

bool aflibAudioMixer::isSampleRateSupported ( int & rate ) [virtual]
 

Reimplemented from aflibAudio.

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.

Reimplemented in aflibAudioStereoToMono.


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