CLAM::Audio Class Reference

Audio class with the Data Buffer, information about it (SampleRate, BeginTime), and methods to insert and get Audio chunks. More...

#include <Audio.hxx>

List of all members.

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

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.


Constructor & Destructor Documentation

CLAM::Audio::Audio (  )  [inline]

Definition at line 50 of file Audio.hxx.

CLAM::Audio::Audio ( const Audio prototype,
const bool  shareData = false,
const bool  deep = true 
) [inline]

Definition at line 50 of file Audio.hxx.

Audio::~Audio (  ) 

Definition at line 36 of file Audio.cxx.


Member Function Documentation

CLAM::Audio::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
DataArray  ,
Buffer   
) [inline]

The Audio buffer.

Definition at line 57 of file Audio.hxx.

CLAM::Audio::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
TTime  ,
BeginTime   
) [inline]

Temporal Tags for audio chunk in miliseconds.

Definition at line 55 of file Audio.hxx.

CLAM::Audio::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
TData  ,
SampleRate   
) [inline]

Sample rate in Hz.

Definition at line 53 of file Audio.hxx.

CLAM::Audio::__COMMON_DYNAMIC_TYPE ( Audio  ,
 
)
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 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.

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

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

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

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 105 of file Audio.cxx.

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

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

int CLAM::Audio::GetSize (  )  const [inline]
bool CLAM::Audio::LoadBeginTime ( CLAM::Storage s  )  [inline]

Definition at line 55 of file Audio.hxx.

bool CLAM::Audio::LoadBuffer ( CLAM::Storage s  )  [inline]

Definition at line 57 of file Audio.hxx.

bool CLAM::Audio::LoadSampleRate ( CLAM::Storage s  )  [inline]

Definition at line 53 of file Audio.hxx.

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

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

Definition at line 59 of file Audio.cxx.

References Round(), and SetSize().

Referenced by SetEndTime().

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 199 of file Audio.cxx.

References CLAM_ASSERT, and GetSize().

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 194 of file Audio.cxx.

void Audio::SetDuration ( TTime  duration  ) 
Deprecated:
use ResizeToDuration instead

Definition at line 79 of file Audio.cxx.

References CLAM_WARNING, and ResizeToDuration().

void Audio::SetEndTime ( TTime  time  ) 
Deprecated:
use ResizeToEndTime instead

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.

Todo:
Document how data in the buffer is discarded
Parameters:
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().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.3