#include <aflibAudioEdit.h>
Inheritance diagram for aflibAudioEdit::
Public Methods | |
aflibAudioEdit (aflibAudio &audio) | |
Constructor - requires an aflibAudio object. More... | |
~aflibAudioEdit () | |
Destructor. | |
void | addSegment (int input, long long input_start_position, long long input_stop_position, long long output_insert_position, double factor=1.0) |
Add an audio clip using samples. More... | |
void | addSegment (int input, double input_start_seconds, double input_stop_seconds, double output_insert_seconds, double factor=1.0) |
Add an audio clip using seconds. More... | |
void | removeSegment (int seg_num) |
Remove an audio clip segment by segment number. More... | |
void | removeSegment (long long output_start_position, long long output_stop_position) |
Remove an audio clip segment by samples. More... | |
void | removeSegment (double output_start_seconds, double output_stop_seconds) |
Remove an audio clip segment by seconds. More... | |
int | getNumberOfSegments () |
Gets the current number of segments that are in the audio clip list. | |
void | getSegment (int segment_number, int &input, long long &input_start_position, long long &input_stop_position, long long &output_start_position, long long &output_stop_position, double &factor) |
Retrieves information for an audio clip segment by samples. More... | |
void | getSegment (int segment_number, int &input, double &input_start_seconds, double &input_stop_seconds, double &output_start_seconds, double &output_stop_seconds, double &factor) |
Retrieves information for an audio clip segment by seconds. More... | |
aflibUndoRedo | getUndoRedoStatus () const |
Not Yet Implemented. | |
void | performUndoRedo () |
Not Yet Implemented. | |
aflibStatus | compute_segment (list< aflibData *> &data, long long position=-1) |
Main work function. More... | |
aflibData* | process (aflibStatus &ret_status, long long position, int &num_samples, bool free_memory=TRUE) |
Main process function. More... | |
const char* | getName () const |
Returns the name of the derived class. | |
void | parentWasDestroyed (int parent_id) |
Callback to notify derived class when parent was destroyed. More... | |
void | parentWasAdded (int parent_id) |
Callback to notify derived class when parent was added. More... | |
void | setInputConfig (const aflibConfig &cfg) |
Sets the input and output audio data configuration of this object. More... | |
bool | isDataSizeSupported (aflib_data_size size) |
bool | isEndianSupported (aflib_data_endian end) |
bool | isSampleRateSupported (int &rate) |
bool | isChannelsSupported (int &channels) |
This is a class that simplifies audio editing. This is derived from the aflibAudio base class so it can be used in an audio chain. This is a complex class that aids the application programmer in writing an audio editing program. It can accept multiple inputs and allows the user to add audio clip segments, remove audio clip segments, and add or remove inputs. One can use this object in a chain so that the output of this object can be output to an audio file or device for output. Once the clip information is stored in this class it will automatically get the audio input from the correct input and route it to the output. We also provide our own process function instead of using the base classes since we need to retrieve data from different inputs. One other current limitiation is that if a data segment that is passed to the process function spans clips from different inputs then only the input in the furst clip will be used. This will be changed in the furture as well.
ADDING AND REMOVING INPUTS One can add or remove inputs to this class. The constructor does require one input. An ID number is returned when additional inputs are added. The first input specified should be assumed to have an ID of 1. When an input is removed any audio clips that are obtained from this input will be removed. If all inputs are removed then FALSE will be sent to the enable function of the aflibAudio base class to disable this object from the chain. When an input is added this object will be enabled again. The functions to add and remove inputs are provided by the aflibChain base class:
int addParent();
void removeParent();
ADDING AND REMOVING AUDIO SEGMENTS Adding and removing segments is the heart of this object. This in effect allows one to map inputs to the output of this object. A typical application would be to have only one input and then add a segment that contains the entire audio segment of the input. Then the user can remove certain audio segments of this input. This makes the output look like one continuous audio stream without the segments that have been removed. The APIs here allow one to specify segments in either samples or segments. If one uses doubles then the specifcation is assumed to be seconds and if long long then samples. One can also remove a segment by the segment number. One should verify the segment number first thought as segment numbers can change after segments are added, removed, or inputs removed. The functions to add and remove segments are:
void addSegment(
int input,
long long input_start_position,
long long input_stop_position,
long long output_insert_position);
void addSegment(
int input,
double input_start_seconds,
double input_stop_seconds,
double output_insert_seconds);
void removeSegment(int seg_num);
void removeSegment(
long long output_start_position,
long long output_stop_position);
void removeSegment(
double output_start_seconds,
double output_stop_seconds);
OBTAINING INFORMATION Several functions exist to get information on the audio segment data. One can get the total number of current segments and then one can obtain the data for any particular segment in either seconds or samples. Segments start at number 1.
int getNumberOfSegments();
void getSegment(
int segment_number,
int& input,
long long& input_start_position,
long long& input_stop_position,
long long& output_start_position,
long long& output_stop_position);
void getSegment(
int segment_number,
int& input,
double& input_start_seconds,
double& input_stop_seconds,
double& output_start_seconds,
double& output_stop_seconds);
UNDO / REDO In the future Undo / Redo capability will be added to undo the last audio segment addition or deletion.
|
Constructor - requires an aflibAudio object. User must create this object with at least one input. The ID for this input can be assumed to be 1. |
|
Destructor.
|
|
Add an audio clip using seconds. This function will add a new segment at the position specified. If will push out all data after this insertion point in the existing audio clip array. This function allows one to specify the positions in seconds. |
|
Add an audio clip using samples. This function will add a new segment at the position specified. If will push out all data after this insertion point in the existing audio clip array. This function allows one to specify the positions as samples. |
|
Main work function. We don't do any real processing of the data. We actually only route the data. Reimplemented from aflibAudio. |
|
Returns the name of the derived class.
Reimplemented from aflibAudio. |
|
Gets the current number of segments that are in the audio clip list.
|
|
Retrieves information for an audio clip segment by seconds. This function will retrieve the information for a particular audio clip segment. This will allow the user to determine the input and output start and stop positions in seconds. The segment numbers start with 1. |
|
Retrieves information for an audio clip segment by samples. This function will retrieve the information for a particular audio clip segment. This will allow the user to determine the input and output start and stop positions in samples. The segment numbers start with 1. |
|
Not Yet Implemented.
|
|
Reimplemented from aflibAudio. |
|
Reimplemented from aflibAudio. |
|
Reimplemented from aflibAudio. |
|
Reimplemented from aflibAudio. |
|
Callback to notify derived class when parent was added. This is a callback that derived classes override to get notified when a parent is added. It will not get called when a parent is set in the constructor. Reimplemented from aflibChain. |
|
Callback to notify derived class when parent was destroyed. This is a callback that derived classes override to get notified when a parent was removed from an object Reimplemented from aflibChain. |
|
Not Yet Implemented.
|
|
Main process function. Since we have to deal with multiple inputs we override the base classes process function with our own. This will retrieve the audio data from the proper input based on position. It is responsible for mapping the output sample position to the correct input and its sample position. See the base class aflibAudio::process for what the process function is suppose to do. Reimplemented from aflibAudio. |
|
Remove an audio clip segment by seconds. This function allows one to remove an audio segment by specifing a start and stop seconds position. This segment can span one or more audio segments. These seconds are referenced to the current output. |
|
Remove an audio clip segment by samples. This function allows one to remove an audio segment by specifing a start and stop samples position. This segment can span one or more audio segments. These samples are referenced to the current output. |
|
Remove an audio clip segment by segment number. This function allows one to remove a segment from the audio clip list by its ssegment number. One should verify the segment first with a call to getSegment. Segment numbers can change when ever there is a change made. |
|
Sets the input and output audio data configuration of this object. This function overrides the aflibAudio base class function. It will change the total samples in the output audio configuration. It will also select the best output based on the inputs. Any conversion that needs to be done will be done. This allows mixing of inputs with different sample rates, endian layouts, channels, and data sizes. Reimplemented from aflibAudio. |