Exponent::Audio::TAudioBuffer< TypeName > Class Template Reference

Inheritance diagram for Exponent::Audio::TAudioBuffer< TypeName >:

Exponent::Basics::CCountedObject Exponent::Basics::ICountedObject List of all members.

Detailed Description

template<typename TypeName>
class Exponent::Audio::TAudioBuffer< TypeName >

Template'd audio data collection.

Date:
07/04/2006
Author:
Paul Chana
Version:
1.0.0 Initial version
Note:
All contents of this source code are copyright 2005 Exp Digital Uk.
This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
Certain sections of this code may come from other sources. They are credited where applicable.
If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk
Id
TAudioBuffer.hpp,v 1.9 2007/02/08 21:08:09 paul Exp

Definition at line 36 of file TAudioBuffer.hpp.

Public Types

Public Member Functions

Protected Attributes


Member Typedef Documentation

template<typename TypeName>
Exponent::Audio::TAudioBuffer< TypeName >::TAudioBufferPointer

Typdefed Automatic pointer to an audio buffer.

Definition at line 52 of file TAudioBuffer.hpp.


Constructor & Destructor Documentation

template<typename TypeName>
Exponent::Audio::TAudioBuffer< TypeName >::TAudioBuffer (  )  [inline]

Construction

Definition at line 59 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_bufferSize, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples, and NULL_POINTER.

template<typename TypeName>
virtual Exponent::Audio::TAudioBuffer< TypeName >::~TAudioBuffer (  )  [inline, virtual]

Destruction

Definition at line 70 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::uninitialise().


Member Function Documentation

template<typename TypeName>
void Exponent::Audio::TAudioBuffer< TypeName >::clearBuffer (  )  [inline]

Clear the audio data, sets all to zero

Definition at line 128 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, and Exponent::Audio::TAudioBuffer< TypeName >::m_bufferSize.

Referenced by Exponent::Audio::TAudioBuffer< TypeName >::initialise().

template<typename TypeName>
bool Exponent::Audio::TAudioBuffer< TypeName >::copySamples ( const TypeName *  buffer,
const unsigned long  numberOfSamples 
) [inline]

Copy a certain number of samples from a buffer

Parameters:
buffer The buffer to copy. Assumed to be in correct interleaved format
numberOfSamples The total number of samples (must be <= m_numberOfSamples * m_numberOfChannels)
Return values:
bool True if copied properly, false otherwise

Definition at line 386 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples.

template<typename TypeName>
void Exponent::Audio::TAudioBuffer< TypeName >::denormal (  )  [inline]

Denormal the audio data

Definition at line 316 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, and Exponent::Audio::TAudioBuffer< TypeName >::m_bufferSize.

template<typename TypeName>
FORCEINLINE unsigned long Exponent::Audio::TAudioBuffer< TypeName >::getBufferSize (  )  const [inline]

Get teh size of the buffer

Return values:
unsigned long The total size of the buffer

Definition at line 232 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_bufferSize.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::readData(), and Exponent::Audio::TAiffFileFormat< TypeName >::readData().

template<typename TypeName>
const TypeName* Exponent::Audio::TAudioBuffer< TypeName >::getChannel ( const unsigned long  index  )  const [inline]

Get a specific channel

Parameters:
index The channel required
Return values:
const TypeName* A pointer to the starting sample of this channel
note that this may not necessarilly be the first sample in the actual audio
data (due to interleaving) and you should not increment automatically by 1
as the frame size may be bigger
See also:
getSampleFrameSize

Definition at line 161 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels.

Referenced by Exponent::Audio::TAudioBuffer< TypeName >::operator[]().

template<typename TypeName>
const TypeName* Exponent::Audio::TAudioBuffer< TypeName >::getData (  )  const [inline]

Get a pointer to the start of the data

Return values:
const TypeName* A pointer to the data

Definition at line 192 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::writeData(), and Exponent::Audio::TAiffFileFormat< TypeName >::writeData().

template<typename TypeName>
TypeName Exponent::Audio::TAudioBuffer< TypeName >::getMaximumSample ( const unsigned long  channel  )  const [inline]

Get the maximum sample in the entre buffer

Parameters:
channel The channel to check
Return values:
TypeName The maximum sample

Definition at line 249 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples.

template<typename TypeName>
TypeName Exponent::Audio::TAudioBuffer< TypeName >::getMinimumSample ( const unsigned long  channel  )  const [inline]

Get the maximum sample in the entre buffer

Parameters:
channel The channel to check if -1 all channels are check
Return values:
TypeName The maximum sample

Definition at line 270 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples.

template<typename TypeName>
TypeName* Exponent::Audio::TAudioBuffer< TypeName >::getMutableChannel ( const unsigned long  index  )  [inline]

Get a specific channel

Parameters:
index The channel required
Return values:
TypeName* A pointer to the starting sample of this channel
note that this may not necessarilly be the first sample in the actual audio
data (due to interleaving) and you should not increment automatically by 1
as the frame size may be bigger
See also:
getSampleFrameSize

Definition at line 179 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels.

template<typename TypeName>
TypeName* Exponent::Audio::TAudioBuffer< TypeName >::getMutableData (  )  [inline]

Get a pointer to the start of the data

Return values:
TypeName* A pointer to the data

Definition at line 205 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::readData(), and Exponent::Audio::TAiffFileFormat< TypeName >::readData().

template<typename TypeName>
FORCEINLINE unsigned long Exponent::Audio::TAudioBuffer< TypeName >::getNumberOfChannels (  )  const [inline]

Get the number of audio channels

Return values:
unsigned long The number of channels

Definition at line 220 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::writeData(), Exponent::Audio::TAiffFileFormat< TypeName >::writeData(), and Exponent::Audio::TAudioFile< TypeName >::writeFile().

template<typename TypeName>
FORCEINLINE unsigned long Exponent::Audio::TAudioBuffer< TypeName >::getNumberOfSamples (  )  const [inline]

Get the number of audio samples per channel

Return values:
unsigned long The number of samples per channel

Definition at line 226 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples.

Referenced by Exponent::Audio::TWaveFileFormat< TypeName >::writeData(), Exponent::Audio::TAiffFileFormat< TypeName >::writeData(), and Exponent::Audio::TAudioFile< TypeName >::writeFile().

template<typename TypeName>
FORCEINLINE TypeName Exponent::Audio::TAudioBuffer< TypeName >::getRMSLevel ( const unsigned long  channel,
const unsigned long  numberOfSamples,
const unsigned long  startSample = 0 
) const [inline]

Get the RMS level of a particular channel

Parameters:
channel The channel to check if -1 all channels are check
numberOfSamples The number of samples to process
startSample The sample to start on
Return values:
TypeName The RMS value of the buffer in the range 0 - 1

Definition at line 293 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::getSampleFrameSize(), Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples.

template<typename TypeName>
FORCEINLINE unsigned long Exponent::Audio::TAudioBuffer< TypeName >::getSampleFrameSize (  )  const [inline]

Each block of audio samples is interleaved with the other channels samples in to a frame
When processing you need to increment each channel point by a certain amount to move to its next sample
That value is the sample frame size returned here

Return values:
unsigned long The size of a sample frame

Definition at line 240 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels.

Referenced by Exponent::Audio::TAudioBuffer< TypeName >::getRMSLevel().

template<typename TypeName>
bool Exponent::Audio::TAudioBuffer< TypeName >::initialise ( const unsigned long  numberOfSamples,
const unsigned long  numberOfChannels 
) [inline]

Initialise with a specific number of samples and channels. Implies clearBuffer()

Parameters:
numberOfSamples The length of each channel in samples
numberOfChannels The number of channels in the audio buffer
Return values:
bool True if initialised properly, false otherwise

Definition at line 84 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::clearBuffer(), Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_bufferSize, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples, and Exponent::Audio::TAudioBuffer< TypeName >::uninitialise().

template<typename TypeName>
bool Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelsToMono (  )  [inline]

Merge all the channels to mono at a level commensurate to the number of channels

Return values:
bool True if sucessfully merged or mono channel, false on errors

Definition at line 335 of file TAudioBuffer.hpp.

References FREE_POINTER, Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_bufferSize, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples.

template<typename TypeName>
bool Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelToBuffer ( double *  buffer,
const unsigned long  startSample,
const unsigned long  numberOfSamples,
const unsigned long  channel 
) [inline]

Merge a channel to the passed audio buffer

Parameters:
buffer The output audio buffer
startSample The starting sample in this buffer
numberOfSamples The number of samples to process
channel The audio channel to merge
Return values:
bool True if happened properly, false otherwise
Note:
startSample + numberOfSamples must be <= m_numberOfSamples

Definition at line 454 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples.

template<typename TypeName>
bool Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelToBuffer ( float *  buffer,
const unsigned long  startSample,
const unsigned long  numberOfSamples,
const unsigned long  channel 
) [inline]

Merge a channel to the passed audio buffer

Parameters:
buffer The output audio buffer
startSample The starting sample in this buffer
numberOfSamples The number of samples to process
channel The audio channel to merge
Return values:
bool True if happened properly, false otherwise
Note:
startSample + numberOfSamples must be <= m_numberOfSamples

Definition at line 411 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples.

template<typename TypeName>
const TypeName* Exponent::Audio::TAudioBuffer< TypeName >::operator[] ( const long  index  )  const [inline]

Get a channel

Parameters:
index The channel required
Return values:
const TypeName* The buffer or NULL on error
See also:
getChannel

Definition at line 145 of file TAudioBuffer.hpp.

References Exponent::Audio::TAudioBuffer< TypeName >::getChannel().

template<typename TypeName>
void Exponent::Audio::TAudioBuffer< TypeName >::uninitialise (  )  [inline]

Clear and delete all buffers

Definition at line 110 of file TAudioBuffer.hpp.

References FREE_ARRAY_POINTER, Exponent::Audio::TAudioBuffer< TypeName >::m_buffer, Exponent::Audio::TAudioBuffer< TypeName >::m_bufferSize, Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels, and Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples.

Referenced by Exponent::Audio::TAudioBuffer< TypeName >::initialise(), and Exponent::Audio::TAudioBuffer< TypeName >::~TAudioBuffer().


Member Data Documentation

template<typename TypeName>
TypeName* Exponent::Audio::TAudioBuffer< TypeName >::m_buffer [protected]

The actual audio data

Definition at line 488 of file TAudioBuffer.hpp.

Referenced by Exponent::Audio::TAudioBuffer< TypeName >::clearBuffer(), Exponent::Audio::TAudioBuffer< TypeName >::copySamples(), Exponent::Audio::TAudioBuffer< TypeName >::denormal(), Exponent::Audio::TAudioBuffer< TypeName >::getChannel(), Exponent::Audio::TAudioBuffer< TypeName >::getData(), Exponent::Audio::TAudioBuffer< TypeName >::getMaximumSample(), Exponent::Audio::TAudioBuffer< TypeName >::getMinimumSample(), Exponent::Audio::TAudioBuffer< TypeName >::getMutableChannel(), Exponent::Audio::TAudioBuffer< TypeName >::getMutableData(), Exponent::Audio::TAudioBuffer< TypeName >::getRMSLevel(), Exponent::Audio::TAudioBuffer< TypeName >::initialise(), Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelsToMono(), Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelToBuffer(), Exponent::Audio::TAudioBuffer< TypeName >::TAudioBuffer(), and Exponent::Audio::TAudioBuffer< TypeName >::uninitialise().

template<typename TypeName>
unsigned long Exponent::Audio::TAudioBuffer< TypeName >::m_bufferSize [protected]

Size of the buffer

Definition at line 491 of file TAudioBuffer.hpp.

Referenced by Exponent::Audio::TAudioBuffer< TypeName >::clearBuffer(), Exponent::Audio::TAudioBuffer< TypeName >::denormal(), Exponent::Audio::TAudioBuffer< TypeName >::getBufferSize(), Exponent::Audio::TAudioBuffer< TypeName >::initialise(), Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelsToMono(), Exponent::Audio::TAudioBuffer< TypeName >::TAudioBuffer(), and Exponent::Audio::TAudioBuffer< TypeName >::uninitialise().

template<typename TypeName>
unsigned long Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfChannels [protected]

The number of channels

Definition at line 490 of file TAudioBuffer.hpp.

Referenced by Exponent::Audio::TAudioBuffer< TypeName >::copySamples(), Exponent::Audio::TAudioBuffer< TypeName >::getChannel(), Exponent::Audio::TAudioBuffer< TypeName >::getMaximumSample(), Exponent::Audio::TAudioBuffer< TypeName >::getMinimumSample(), Exponent::Audio::TAudioBuffer< TypeName >::getMutableChannel(), Exponent::Audio::TAudioBuffer< TypeName >::getNumberOfChannels(), Exponent::Audio::TAudioBuffer< TypeName >::getRMSLevel(), Exponent::Audio::TAudioBuffer< TypeName >::getSampleFrameSize(), Exponent::Audio::TAudioBuffer< TypeName >::initialise(), Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelsToMono(), Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelToBuffer(), Exponent::Audio::TAudioBuffer< TypeName >::TAudioBuffer(), and Exponent::Audio::TAudioBuffer< TypeName >::uninitialise().

template<typename TypeName>
unsigned long Exponent::Audio::TAudioBuffer< TypeName >::m_numberOfSamples [protected]

The number of samples per channel

Definition at line 489 of file TAudioBuffer.hpp.

Referenced by Exponent::Audio::TAudioBuffer< TypeName >::copySamples(), Exponent::Audio::TAudioBuffer< TypeName >::getMaximumSample(), Exponent::Audio::TAudioBuffer< TypeName >::getMinimumSample(), Exponent::Audio::TAudioBuffer< TypeName >::getNumberOfSamples(), Exponent::Audio::TAudioBuffer< TypeName >::getRMSLevel(), Exponent::Audio::TAudioBuffer< TypeName >::initialise(), Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelsToMono(), Exponent::Audio::TAudioBuffer< TypeName >::mergeChannelToBuffer(), Exponent::Audio::TAudioBuffer< TypeName >::TAudioBuffer(), and Exponent::Audio::TAudioBuffer< TypeName >::uninitialise().


Infinity API - Exponent::Audio::TAudioBuffer< TypeName > Class Template Reference generated on 7 Mar 2007