CLAM::Audio Class Reference

#include <Audio.hxx>

Inheritance diagram for CLAM::Audio:

CLAM::ProcessingData CLAM::DynamicType CLAM::Component

List of all members.


Detailed Description

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.

See also:
AudioDescriptors, Spectrum

Definition at line 48 of file Audio.hxx.


Public Member Functions

 DYNAMIC_TYPE_USING_INTERFACE (Audio, 3, ProcessingData)
 DYN_ATTRIBUTE (0, public, TData, SampleRate)
 Sample rate in Hz.
 DYN_ATTRIBUTE (1, public, TTime, BeginTime)
 Temporal Tags for audio chunk in miliseconds.
 DYN_ATTRIBUTE (2, public, DataArray, Buffer)
 The Audio buffer.
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().

Member Function Documentation

CLAM::Audio::DYNAMIC_TYPE_USING_INTERFACE ( Audio  ,
,
ProcessingData   
)

CLAM::Audio::DYN_ATTRIBUTE ( ,
public  ,
TData  ,
SampleRate   
)

Sample rate in Hz.

CLAM::Audio::DYN_ATTRIBUTE ( ,
public  ,
TTime  ,
BeginTime   
)

Temporal Tags for audio chunk in miliseconds.

CLAM::Audio::DYN_ATTRIBUTE ( ,
public  ,
DataArray  ,
Buffer   
)

The Audio buffer.

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

See also:
CopyInit()

Reimplemented from CLAM::DynamicType.

Definition at line 36 of file Audio.cxx.

References CLAM::DynamicType::UpdateData().

int CLAM::Audio::GetSize (  )  const [inline]

TTime CLAM::Audio::GetEndTime (  )  const [inline]

Getter for the end time in miliseconds.

Returns:
The current end time for the buffer size

Definition at line 71 of file Audio.hxx.

References GetSize().

TTime CLAM::Audio::GetDuration (  )  const [inline]

Method for getting the total duration of Buffer.

Returns:
The duration of the audio buffer in miliseconds

Definition at line 75 of file Audio.hxx.

References GetSize().

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.

Todo:
Document how data in the buffer is discarded
Parameters:
s The new size in samples

Definition at line 61 of file Audio.cxx.

References CLAM_ASSERT, and GetSize().

Referenced by CLAM::AudioFileMemoryLoader::ConcreteConfigure(), CLAM::SpectralAnalysis::Do(), CLAM::AudioWindowing::Do(), GetAudioChunk(), GetAudioSlice(), ResizeToDuration(), and ResizeToEndTime().

void Audio::SetEndTime ( TTime  time  ) 

Deprecated:
use ResizeToEndTime instead

Definition at line 49 of file Audio.cxx.

References CLAM_WARNING, and ResizeToEndTime().

void Audio::ResizeToEndTime ( TTime  time  ) 

Resizes the array buffer to last from the begin time until the specified time position (time in miliseconds).

Todo:
Document how data in the buffer is discarded
Parameters:
time End time of the buffer once resized
See also:
SetSize

Definition at line 55 of file Audio.cxx.

References Round(), and SetSize().

Referenced by SetEndTime().

void Audio::SetDuration ( TTime  duration  ) 

Deprecated:
use ResizeToDuration instead

Definition at line 75 of file Audio.cxx.

References CLAM_WARNING, and ResizeToDuration().

void Audio::ResizeToDuration ( TTime  duration  ) 

Resizes the array buffer to last the specified time duration (miliseconds).

Todo:
Document how data in the buffer is discarded
Parameters:
duration The required duration for the buffer once resized
See also:
SetSize

Definition at line 81 of file Audio.cxx.

References SetSize().

Referenced by SetDuration().

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.

Parameters:
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 96 of file Audio.cxx.

Referenced by CLAM::SpectralSynthesis::Do(), CLAM::SpectralAnalysis::Do(), and CLAM::AudioWindowing::Do().

void Audio::GetAudioChunk ( TIndex  beginIndex,
TIndex  endIndex,
Audio chunk,
bool  configureChunk = true 
) const

Method for copying an audio chunk out of the existing data.

Parameters:
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 131 of file Audio.cxx.

References CLAM_ASSERT, GetSize(), and 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.

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

Definition at line 101 of file Audio.cxx.

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.

Parameters:
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 108 of file Audio.cxx.

References CLAM_ASSERT, GetSize(), and SetSize().

void Audio::SetAudioChunk ( TTime  beginTime,
const Audio chunk 
)

Method for setting an audio chunk of the audio out of an existing chunk.

Time in miliseconds.

Parameters:
beginTime Beginning location of the chunk in the Buffer in time measure.
chunk The Audio data chunk to insert

Definition at line 190 of file Audio.cxx.

void Audio::SetAudioChunk ( TIndex  beginIndex,
const Audio chunk 
)

Method for setting an audio chunk of the audio out of an existing chunk.

Parameters:
beginIndex Beginning location of the chunk in the Buffer.
chunk The Audio data chunk to insert

Definition at line 195 of file Audio.cxx.

References CLAM_ASSERT, and GetSize().


The documentation for this class was generated from the following files:

Generated on Tue Aug 12 22:33:47 2008 for CLAM by  doxygen 1.5.5