CLAM-Development  1.4.0
Public Member Functions | Protected Member Functions
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

 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.
 ~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.
- Public Member Functions inherited from CLAM::ProcessingData
 ProcessingData (const int n)
 Constructor of an object that will contain the number of attributes passed by parameter.
 ProcessingData (const ProcessingData &prototype, bool shareData=false, bool deep=true)
 Copy constructor of a ProcessingData object.
virtual ~ProcessingData ()
- Public Member Functions inherited from CLAM::DynamicType
 DynamicType (const int nAttr)
 Constructs a DynamicType object that can hold.
 DynamicType (const DynamicType &prototype, const bool shareData, const bool deepCopy)
 Copy constructor of a dynamic Type.
 DynamicType (const DynamicType &prototype)
virtual ~DynamicType ()
virtual const char * GetClassName () const =0
 Return the class name.
void CopyInit (const DynamicType &dt)
 This method allows custom code for the copy-constructor of a dynamic type, since the copy-constructor is macro expanded and can not be overwritted.
bool UpdateData ()
 Method used to resize the data space of the dynamic type, necessary when some AddXXX() / RemoveXXX() (where XXX is an attribute name) has been done.
unsigned GetNDynamicAttributes () const
const char * GetDynamicAttributeName (unsigned i)
virtual const std::type_info & GetTypeId (unsigned i) const =0
bool AttributeIsComponent (unsigned i) const
bool AttributeIsDynamictype (unsigned i) const
bool IsAttributeInstantiated (unsigned i) const
const void * GetAttributeAsVoidPtr (unsigned i) const
const ComponentGetAttributeAsComponent (unsigned i) const
ComponentGetAttributeAsComponent (unsigned i)
void FullfilsInvariant () const
virtual ComponentDeepCopy () const
void Debug () const
virtual void StoreOn (CLAM::Storage &storage) const
 Stores component's subitems on the given Storage.
virtual void LoadFrom (CLAM::Storage &storage)
 Loads component's subitems from the given Storage.
- Public Member Functions inherited from CLAM::Component
virtual ~Component ()

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

Audio::~Audio ( )

Definition at line 36 of file Audio.cxx.


Member Function Documentation

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

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.

CLAM::Audio::DYNAMIC_TYPE_USING_INTERFACE ( Audio  ,
,
ProcessingData   
)
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:
beginTimeBeginning of the chunk in time measure.
endTimeEnding of the chunk in time measure.
chunkThe Audio data chunk
configureChunkOptional parameter to set the configuration of the chunk. True by default.

Definition at line 100 of file Audio.cxx.

Referenced by CLAM::AudioWindowing::Do(), CLAM::SpectralAnalysis::Do(), and CLAM::SpectralSynthesis::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:
beginIndexBeginning of the chunk inside the Buffer.
endIndexEnding of the chunk inside the Buffer
chunkThe Audio data chunk
configureChunkOptional 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::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:
beginTimeBeginning of the chunk in time measure.
endTimeEnding of the chunk in time measure.
sliceThe Audio data slice
configureSliceOptional parameter to set the configuration of the slice. True by default.

Definition at line 105 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:
beginIndexBeginning of the chunk inside the Buffer.
endIndexEnding of the chunk inside the Buffer
sliceThe Audio slice
configureSliceOptional 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().

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
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:
durationThe 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:
timeEnd 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 ( TTime  beginTime,
const Audio chunk 
)

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

Time in miliseconds.

Parameters:
beginTimeBeginning location of the chunk in the Buffer in time measure.
chunkThe Audio data chunk to insert

Definition at line 194 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:
beginIndexBeginning location of the chunk in the Buffer.
chunkThe Audio data chunk to insert

Definition at line 199 of file Audio.cxx.

References CLAM_ASSERT, and GetSize().

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:
sThe new size in samples

Definition at line 65 of file Audio.cxx.

References CLAM_ASSERT, and GetSize().

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


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