Audio class with the Data Buffer, information about it (SampleRate, BeginTime), and methods to insert and get Audio chunks. More...
#include <Audio.hxx>
Public Member Functions | |
Audio () | |
Audio (const Audio &prototype, const bool shareData=false, const bool deep=true) | |
__COMMON_DYNAMIC_TYPE (Audio, 3) | |
__COMMON_DYN_ATTRIBUTE (0, public, TData, SampleRate) protected | |
Sample rate in Hz. | |
bool | LoadSampleRate (CLAM::Storage &s) |
__COMMON_DYN_ATTRIBUTE (1, public, TTime, BeginTime) protected | |
Temporal Tags for audio chunk in miliseconds. | |
bool | LoadBeginTime (CLAM::Storage &s) |
__COMMON_DYN_ATTRIBUTE (2, public, DataArray, Buffer) protected | |
The Audio buffer. | |
bool | LoadBuffer (CLAM::Storage &s) |
~Audio () | |
int | GetSize () const |
TTime | GetEndTime () const |
Getter for the end time in miliseconds. | |
TTime | GetDuration () const |
Method for getting the total duration of Buffer. | |
void | SetSize (int s) |
Resizes the array buffers to a size in samples. | |
void | SetEndTime (TTime time) |
void | ResizeToEndTime (TTime time) |
Resizes the array buffer to last from the begin time until the specified time position (time in miliseconds). | |
void | SetDuration (TTime duration) |
void | ResizeToDuration (TTime duration) |
Resizes the array buffer to last the specified time duration (miliseconds). | |
void | GetAudioChunk (TTime beginTime, TTime endTime, Audio &chunk, bool configureChunk=true) const |
Method for copying an audio chunk out of the existing data. | |
void | GetAudioChunk (TIndex beginIndex, TIndex endIndex, Audio &chunk, bool configureChunk=true) const |
Method for copying an audio chunk out of the existing data. | |
void | GetAudioSlice (TTime beginTime, TTime endTime, Audio &slice, bool configureSlice=true) const |
Method for copying an audio "slice" out of the existing data. | |
void | GetAudioSlice (TIndex beginIndex, TIndex endIndex, Audio &slice, bool configureSlice=true) const |
Method for getting an audio "slice" out of the existing data. | |
void | SetAudioChunk (TTime beginTime, const Audio &chunk) |
Method for setting an audio chunk of the audio out of an existing chunk. | |
void | SetAudioChunk (TIndex beginIndex, const Audio &chunk) |
Method for setting an audio chunk of the audio out of an existing chunk. | |
Protected Member Functions | |
void | DefaultInit () |
The concrete dynamic type constructor calls DefaultInit(). |
Audio class with the Data Buffer, information about it (SampleRate, BeginTime), and methods to insert and get Audio chunks.
You can also get 'slices' that's an audio that maps to some other audio's data.
Definition at line 48 of file Audio.hxx.
CLAM::Audio::Audio | ( | const Audio & | prototype, | |
const bool | shareData = false , |
|||
const bool | deep = true | |||
) | [inline] |
CLAM::Audio::__COMMON_DYN_ATTRIBUTE | ( | 2 | , | |
public | , | |||
DataArray | , | |||
Buffer | ||||
) | [inline] |
CLAM::Audio::__COMMON_DYN_ATTRIBUTE | ( | 1 | , | |
public | , | |||
TTime | , | |||
BeginTime | ||||
) | [inline] |
CLAM::Audio::__COMMON_DYN_ATTRIBUTE | ( | 0 | , | |
public | , | |||
TData | , | |||
SampleRate | ||||
) | [inline] |
CLAM::Audio::__COMMON_DYNAMIC_TYPE | ( | Audio | , | |
3 | ||||
) |
void Audio::DefaultInit | ( | void | ) | [protected] |
The concrete dynamic type constructor calls DefaultInit().
This allows user to initialize his/her object. But we define DefaultInit() here because we don't want to force writting one DefaultInit() function for each concrete dynamic type. If a dynamic type concrete class defines some (not-default) constructors, this should also call the DefaultInit().
Reimplemented from CLAM::DynamicType.
Definition at line 40 of file Audio.cxx.
References CLAM::DynamicType::UpdateData().
void Audio::GetAudioChunk | ( | TIndex | beginIndex, | |
TIndex | endIndex, | |||
Audio & | chunk, | |||
bool | configureChunk = true | |||
) | const |
Method for copying an audio chunk out of the existing data.
beginIndex | Beginning of the chunk inside the Buffer. | |
endIndex | Ending of the chunk inside the Buffer | |
chunk | The Audio data chunk | |
configureChunk | Optional parameter to set the configuration of the chunk. True by default. |
Definition at line 135 of file Audio.cxx.
References CLAM_ASSERT, GetSize(), and SetSize().
void Audio::GetAudioChunk | ( | TTime | beginTime, | |
TTime | endTime, | |||
Audio & | chunk, | |||
bool | configureChunk = true | |||
) | const |
Method for copying an audio chunk out of the existing data.
Time in milliseconds.
beginTime | Beginning of the chunk in time measure. | |
endTime | Ending of the chunk in time measure. | |
chunk | The Audio data chunk | |
configureChunk | Optional parameter to set the configuration of the chunk. True by default. |
Definition at line 100 of file Audio.cxx.
Referenced by CLAM::SpectralSynthesis::Do(), and CLAM::SpectralAnalysis::Do().
void Audio::GetAudioSlice | ( | TIndex | beginIndex, | |
TIndex | endIndex, | |||
Audio & | slice, | |||
bool | configureSlice = true | |||
) | const |
Method for getting an audio "slice" out of the existing data.
The difference between slices and chunks is that slices don't own any memory.
beginIndex | Beginning of the chunk inside the Buffer. | |
endIndex | Ending of the chunk inside the Buffer | |
slice | The Audio slice | |
configureSlice | Optional parameter to set the configuration of the slice. True by default. |
Definition at line 112 of file Audio.cxx.
References CLAM_ASSERT, GetSize(), CLAM::Array< T >::SetPtr(), SetSize(), and CLAM::Array< T >::SetSize().
void Audio::GetAudioSlice | ( | TTime | beginTime, | |
TTime | endTime, | |||
Audio & | slice, | |||
bool | configureSlice = true | |||
) | const |
Method for copying an audio "slice" out of the existing data.
The difference between slices Time in miliseconds. and chunks is that slices don't own any memory.
beginTime | Beginning of the chunk in time measure. | |
endTime | Ending of the chunk in time measure. | |
slice | The Audio data slice | |
configureSlice | Optional parameter to set the configuration of the slice. True by default. |
TTime CLAM::Audio::GetDuration | ( | ) | const [inline] |
TTime CLAM::Audio::GetEndTime | ( | ) | const [inline] |
int CLAM::Audio::GetSize | ( | ) | const [inline] |
Definition at line 67 of file Audio.hxx.
Referenced by CLAM::BinaryAudioOp< Multiply< TData > >::Check(), CLAM::MonoAudioFileWriter::ConcreteConfigure(), CLAM::SpectralAnalysis::Do(), CLAM::SimpleOscillator::Do(), CLAM::Oscillator::Do(), CLAM::BinaryAudioOp< Multiply< TData > >::Do(), CLAM::AudioBufferAmplifier::Do(), CLAM::AudioAmplifier::Do(), GetAudioChunk(), GetAudioSlice(), GetDuration(), GetEndTime(), SetAudioChunk(), and SetSize().
bool CLAM::Audio::LoadBeginTime | ( | CLAM::Storage & | s | ) | [inline] |
bool CLAM::Audio::LoadBuffer | ( | CLAM::Storage & | s | ) | [inline] |
bool CLAM::Audio::LoadSampleRate | ( | CLAM::Storage & | s | ) | [inline] |
void Audio::ResizeToDuration | ( | TTime | duration | ) |
Resizes the array buffer to last the specified time duration (miliseconds).
duration | The required duration for the buffer once resized |
Definition at line 85 of file Audio.cxx.
References SetSize().
Referenced by SetDuration().
void Audio::ResizeToEndTime | ( | TTime | time | ) |
Resizes the array buffer to last from the begin time until the specified time position (time in miliseconds).
time | End time of the buffer once resized |
Definition at line 59 of file Audio.cxx.
References Round(), and SetSize().
Referenced by SetEndTime().
Method for setting an audio chunk of the audio out of an existing chunk.
beginIndex | Beginning location of the chunk in the Buffer. | |
chunk | The Audio data chunk to insert |
Definition at line 199 of file Audio.cxx.
References CLAM_ASSERT, and GetSize().
void Audio::SetDuration | ( | TTime | duration | ) |
Definition at line 79 of file Audio.cxx.
References CLAM_WARNING, and ResizeToDuration().
void Audio::SetEndTime | ( | TTime | time | ) |
Definition at line 53 of file Audio.cxx.
References CLAM_WARNING, and ResizeToEndTime().
void Audio::SetSize | ( | int | s | ) |
Resizes the array buffers to a size in samples.
Increases or shrinks by the end of the buffer preserving the data. If size increases, new samples are set to 0.
s | The new size in samples |
Definition at line 65 of file Audio.cxx.
References CLAM_ASSERT, and GetSize().
Referenced by CLAM::SpectralAnalysis::Do(), CLAM::AudioBufferAmplifier::Do(), GetAudioChunk(), GetAudioSlice(), ResizeToDuration(), and ResizeToEndTime().