#include <aflibAudio.h>
Inheritance diagram for aflibAudio::
Public Methods | |
virtual | ~aflibAudio () |
Destructor. | |
void | enable (bool enable) |
Enables or disables an object in a chain. More... | |
bool | getEnable () const |
Gets current state of object. More... | |
void | enableDataSizeConversion (bool enable) |
Enables or disables data size conversion. More... | |
void | enableEndianConversion (bool enable) |
Enables or disables endian conversion. More... | |
void | enableSampleRateConversion (bool enable) |
Enables or disables sample rate conversion. More... | |
void | enableChannelsConversion (bool enable) |
Enables or disables number of channels conversion. More... | |
virtual void | setInputConfig (const aflibConfig &cfg) |
Sets the input audio data configuration of an object. More... | |
virtual const aflibConfig& | getInputConfig () const |
Returns the input audio data configuration of an object. | |
virtual void | setOutputConfig (const aflibConfig &cfg) |
Sets the output audio data configuration of an object. More... | |
virtual const aflibConfig& | getOutputConfig () const |
Returns the output audio data configuration of an object. | |
virtual const char* | getName () const=0 |
Returns the name of the derived class, must be implemented by derived class. | |
virtual aflibStatus | compute_segment (list< aflibData *> &data, long long position=-1)=0 |
Work function, must be implemented by derived class. | |
virtual aflibData* | process (aflibStatus &ret_status, long long position, int &num_samples, bool free_memory=TRUE) |
Main processing function for pulling data thru an audio chain. More... | |
Protected Methods | |
aflibAudio () | |
Constructor. More... | |
aflibAudio (aflibAudio &audio) | |
Constructor. More... | |
void | convertSampleRate (aflibAudio &parent) |
void | convertChannels (aflibAudio &parent) |
void | convertData (aflibData &data) |
void | examineChain () |
bool | checkChain (const aflibAudio *audio) const |
void | preprocessChain (aflibAudio *audio, aflibAudio *child) |
virtual bool | isDataSizeSupported (aflib_data_size size) |
virtual bool | isEndianSupported (aflib_data_endian end) |
virtual bool | isSampleRateSupported (int &rate) |
virtual bool | isChannelsSupported (int &channels) |
void | incrementLevel () |
void | decrementLevel () |
This is the Base class that all objects will use that want to be used as audio objects with this library. It inherts functionality from the aflibChain class so that these objects can be used in a chain. It is also derived from aflibMemCache class. This provides memory caching for an object.
Two constructors are provided. A constructor with no parameters is provided that derived classes should call that can be used as the start of a chain. A mixing class for instance makes no sense to have a default contructor since it can't be used as the start of a chain. Most often the start of a chain will be a file or device object. The second constructor takes an aflibAudio object. This should be called by a derived class that could have a parent audio object feeding it. This will more than likely be almost all objects.
Function compute_segment is pure virtual so that all derived classes will have to implement it. There is no implementation in this base class. This is the function that derived classes implement that will do the work. This function will be passed a list of aflibData objects. One for each parent of the object. The order in the list is the same as the order from the getParents function. It will also be passed the position of the data. When done the function should return AFLIB_SUCCESS if success.
Function process is defined in this base class and should not be overriden except in certain circumstances. Such as an audio class with more than 1 input that needs special requirements. It provides the functionality to push data throught the chain. The user application can call process from any element in the chain. It will work its way back through the chain and when it gets to the start will start an aflibData object through the chain until arriving at and processing this object. This function might be the ideal place in the future to enable threading.
|
Destructor.
|
|
Constructor. This constructor is for derived classes that have no parent audio object. |
|
Constructor. This constructor is for derived classes that have a parent audio object. |
|
|
|
Work function, must be implemented by derived class.
Reimplemented in aflibAudioBWFilter, aflibAudioConstantSrc, aflibAudioEdit, aflibAudioFile, aflibAudioMemoryInput, aflibAudioMixer, aflibAudioRecorder, aflibAudioSampleRateCvt, and aflibAudioSpectrum. |
|
|
|
|
|
|
|
|
|
Enables or disables an object in a chain. This allows this node to be enabled or disabled. This assists in removing a node from a chain without having to destruct it. This is useful to enable an application to toggle a filter in and out for example. |
|
Enables or disables number of channels conversion. This allows the automatic channel conversion feature to be enabled or disabled. This is already enabled by default. If one does not want a node to perform a mixing operation to convert the number of channels then this can be set on a node to disable it. |
|
Enables or disables data size conversion. This allows the automatic data size conversion feature to be enabled or disabled. This is already enabled by default. If one does not want a node to perform a data size conversion then this can be set on a node to disable it. |
|
Enables or disables endian conversion. This allows the endian data conversion feature to be enabled or disabled. This is already enabled by default. If one does not want a node to perform an endian conversion then this can be set on a node to disable it. |
|
Enables or disables sample rate conversion. This allows the automatic sample rate conversion feature to be enabled or disabled. This is already enabled by default. If one does not want a node to perform a sample rate conversion then this can be set on a node to disable it. |
|
|
|
Gets current state of object. This allows one to determine if an object is Enabled or Disabled. TRUE means that the object is currently enabled. |
|
Returns the input audio data configuration of an object.
Reimplemented in aflibAudioFile. |
|
Returns the name of the derived class, must be implemented by derived class.
Reimplemented in aflibAudioBWFilter, aflibAudioConstantSrc, aflibAudioEdit, aflibAudioFile, aflibAudioMemoryInput, aflibAudioMixer, aflibAudioPitch, aflibAudioRecorder, aflibAudioSampleRateCvt, aflibAudioSpectrum, and aflibAudioStereoToMono. |
|
Returns the output audio data configuration of an object.
Reimplemented in aflibAudioFile. |
|
|
|
Reimplemented in aflibAudioEdit, and aflibAudioFile. |
|
Reimplemented in aflibAudioBWFilter, aflibAudioEdit, aflibAudioFile, aflibAudioMixer, and aflibAudioSampleRateCvt. |
|
Reimplemented in aflibAudioEdit, aflibAudioFile, and aflibAudioMixer. |
|
Reimplemented in aflibAudioEdit, aflibAudioFile, and aflibAudioMixer. |
|
|
|
Main processing function for pulling data thru an audio chain. This is the main processing function for pulling data thru an audio chain. It can be called from any aflibAudio derived object. Users should call the process function at the end of a chain. This function will then call each process function in an audio chain until the start of the chain is reached. When the start of the chain is reached then an aflibData object of the proper size will be allocated and each aflibAudio derived objects compute_segment function will be called to process the data until the end of the chain is reached. This implementation will handle multiple parents automatically. It will request data from the same position and size from each parent of an object. It data of a different size or position is needed from each parent then this will need to be overriden in the derived class. This is not recommended. The first parameter will return a status to the caller. If everything worked OK then AFLIB_SUCCESS will be returned. The second is a position parameter. This indicates at which position in an audio source to read data from. This is a suggestion. It will be ignored if reading from an audio device or from an audio format that does not support random access, like mp3. The third parameter is the number of samples to pull thru the chain. If 0 is passed then the library will pick the size. This is a suggestion. It will return the actual number of samples used when pulling data thru the chain. If the caller passes FALSE to free_memory then the pointer to the aflibData class containing the data will be returned. It is then the responsibility of the calling app to free this memory using delete. If no parameter is passed then it will not be returned by default. Instead NULL will be returned. Reimplemented in aflibAudioEdit, and aflibAudioSampleRateCvt. |
|
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 in aflibAudioBWFilter, aflibAudioEdit, aflibAudioFile, aflibAudioMixer, aflibAudioPitch, aflibAudioSampleRateCvt, aflibAudioSpectrum, and aflibAudioStereoToMono. |
|
Sets the output audio data configuration of an object. This is a virtual function that derived classes can override if needed. Most derived classes will not need to override this function but can simply call it to store the output audio configuration. It is virtual so that it can be overriden by the aflibAudioFile class which needs to implement its own. Reimplemented in aflibAudioFile. |