- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::Audio::CAudioBuffer Class Reference

Inheritance diagram for Exponent::Audio::CAudioBuffer:

List of all members.

## Detailed Description

A stereo audio buffer.

Deprecated:
  Soon to be removed.. i dont advise you use this class
  See also:
    TAudioBuffer

Wraps up a stereo double audio buffer
NOTE : Class is aggressively inlined for improved performance

Date:
  31/01/2005

Author:
  Paul Chana

Version:
  1.0.0 Initial version

  1.0.1 Added RMS functions

  1.0.2 Added Default constructor

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
  CAudioBuffer.hpp,v 1.7 2007/02/08 21:08:09 paul Exp

Definition at line 46 of file CAudioBuffer.hpp.

## Public Types

- enum EStereoChannels {
  e_left = 0,
  e_right,
  e_mono = 1,
  e_stereo
  }
    Enumerations with defaults for stereo and mono information. More...

## Public Member Functions

- void FORCEINLINE accumulateInToFloatData (float **output, const long numberOfSamples)
- void FORCEINLINE applyTanhLimiting ()
- CAudioBuffer ()
- CAudioBuffer (const long bufferSize)
- void FORCEINLINE changeGain (const double volume)
- void FORCEINLINE clearWaveForm ()
- void FORCEINLINE copyToFloatBufferFromWaveData (float **waveData, const long numberOfSamples)
- void FORCEINLINE denormal (const long numberOfSamples)
- const double ** getAudioData () const
- long getBufferSize () const
- FORCEINLINE double * getChannel (const long channel)
- void getMaxSamples (double &left, double &right)
- double ** getMutableAudioData () const
- FORCEINLINE double getSample (const long channel, const long index)
- void initialise (const long bufferSize)
- void FORCEINLINE mergeChannels ()
- void FORCEINLINE mergeToBuffer (double *output, const long numberOfSamples)
- void FORCEINLINE mergeWithBuffer (CAudioBuffer *buffer)
- void reInitialise (const long bufferSize)
- void FORCEINLINE setFromAudioBuffer (CAudioBuffer *buffer)
- void FORCEINLINE setWaveDataFromFloatData (float **waveData, const long numberOfSamples)
- void FORCEINLINE setWaveDataFromFloatDataAndDenormal (float **waveData, const long numberOfSamples)
- void uninitialise ()
- virtual ~CAudioBuffer ()

## Static Public Member Functions

- static FORCEINLINE double computeRMS (const float *buffer, const long numberOfSamplesToProcess)
- static FORCEINLINE double computeRMS (const double *buffer, const long numberOfSamplesToProcess)

## Static Public Attributes

- static const double CAUDIO_BUFFER_DENORMAL

## Protected Attributes

- long m_bufferSize
- double ** m_waveData

## Member Enumeration Documentation

enum Exponent::Audio::CAudioBuffer::EStereoChannels

Enumerations with defaults for stereo and mono information.

Enumerator:

  e_left | Left channel
  e_right | Right channel
  e_mono | Mono signal
  e_stereo | Stereo signal

Definition at line 66 of file CAudioBuffer.hpp.

## Constructor & Destructor Documentation

Exponent::Audio::CAudioBuffer::CAudioBuffer | ( | const long | bufferSize | ) |

Construction

Parameters:

  | bufferSize | The size of the audio buffer to create in samples

Exponent::Audio::CAudioBuffer::CAudioBuffer | ( |  | ) |

Construction

virtual Exponent::Audio::CAudioBuffer::~CAudioBuffer | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

void FORCEINLINE Exponent::Audio::CAudioBuffer::accumulateInToFloatData | ( | float ** | output,
|  | const long | numberOfSamples |
| ) |  |  | `[inline]`

Merge in to passed output

Parameters:

  | output | The buffer to output to
  | numberOfSamples | The number of samples to process

Definition at line 197 of file CAudioBuffer.hpp.

References m_waveData.

void FORCEINLINE Exponent::Audio::CAudioBuffer::applyTanhLimiting | ( |  | ) | `[inline]`

Apply a tanh limiter to the signal. Applied to whole buffer

See also:
  CMathTools

Definition at line 362 of file CAudioBuffer.hpp.

References m_bufferSize, and m_waveData.

void FORCEINLINE Exponent::Audio::CAudioBuffer::changeGain | ( | const double | volume | ) | `[inline]`

Change the gain

Parameters:

  | volume | The volume

Definition at line 340 of file CAudioBuffer.hpp.

References m_bufferSize, and m_waveData.

void FORCEINLINE Exponent::Audio::CAudioBuffer::clearWaveForm | ( |  | ) | `[inline]`

Zero the wave form

Definition at line 146 of file CAudioBuffer.hpp.

References m_bufferSize, and m_waveData.

static FORCEINLINE double Exponent::Audio::CAudioBuffer::computeRMS | ( | const float * | buffer,
|  | const long | numberOfSamplesToProcess |
| ) |  |  | `[inline, static]`

Compute the RMS envelope value

Parameters:

  | buffer | The buffer to compute it on (expects size 32)
  | numberOfSamplesToProcess | <= the size of buffer

Return values:

  | double | The RMS value

Definition at line 409 of file CAudioBuffer.hpp.

static FORCEINLINE double Exponent::Audio::CAudioBuffer::computeRMS | ( | const double * | buffer,
|  | const long | numberOfSamplesToProcess |
| ) |  |  | `[inline, static]`

Compute the RMS envelope value

Parameters:

  | buffer | The buffer to compute it on (expects size 32)
  | numberOfSamplesToProcess | <= the size of buffer

Return values:

  | double | The RMS value

Definition at line 379 of file CAudioBuffer.hpp.

void FORCEINLINE Exponent::Audio::CAudioBuffer::copyToFloatBufferFromWaveData | ( | float ** | waveData,
|  | const long | numberOfSamples |
| ) |  |  | `[inline]`

Copy to a float wave

Parameters:

  | waveData | The buffer to copy to
  | numberOfSamples | The number of samples to copy

Definition at line 304 of file CAudioBuffer.hpp.

References m_waveData.

void FORCEINLINE Exponent::Audio::CAudioBuffer::denormal | ( | const long | numberOfSamples | ) | `[inline]`

Denormal this buffer of audio

Parameters:

  | numberOfSamples | How many samples to data should be denormaled?

Definition at line 325 of file CAudioBuffer.hpp.

References CAUDIO_BUFFER_DENORMAL, and m_waveData.

const double** Exponent::Audio::CAudioBuffer::getAudioData | ( |  | ) | const`[inline]`

Get a constant raw wave information

Return values:

  | double** | The audio data

Definition at line 105 of file CAudioBuffer.hpp.

References m_waveData.

long Exponent::Audio::CAudioBuffer::getBufferSize | ( |  | ) | const`[inline]`

Get the blocksize

Return values:

  | long | The buffer size

Definition at line 239 of file CAudioBuffer.hpp.

References m_bufferSize.

Referenced by mergeWithBuffer(), and setFromAudioBuffer().

FORCEINLINE double* Exponent::Audio::CAudioBuffer::getChannel | ( | const long | channel | ) | `[inline]`

Get channel data

Parameters:

  | channel | The channel you want - NOT RANGE CHECKED!

Return values:

  | double* | The channel data

Definition at line 112 of file CAudioBuffer.hpp.

References m_waveData.

Referenced by mergeWithBuffer(), and setFromAudioBuffer().

void Exponent::Audio::CAudioBuffer::getMaxSamples | ( | double & | left,
|  | double & | right |
| ) |  |  |

Get the maximum samples for each channel

Parameters:

  | left | filled with the left channels samples
  | right | filled with the right channels samples

double** Exponent::Audio::CAudioBuffer::getMutableAudioData | ( |  | ) | const`[inline]`

Get the raw wave information

Return values:

  | double** | The mutable audio data

Definition at line 99 of file CAudioBuffer.hpp.

References m_waveData.

FORCEINLINE double Exponent::Audio::CAudioBuffer::getSample | ( | const long | channel,
|  | const long | index |
| ) |  |  | `[inline]`

Get a specific sample - not recommended for high speed

Parameters:

  | channel | The channel to get the sample from
  | index | The sample index to get

Return values:

  | double | The sample

Definition at line 120 of file CAudioBuffer.hpp.

References m_waveData.

void Exponent::Audio::CAudioBuffer::initialise | ( | const long | bufferSize | ) |

Initialise the audio data (deletes old buffers)

Parameters:

  | bufferSize | The size of the audio buffer to use

void FORCEINLINE Exponent::Audio::CAudioBuffer::mergeChannels | ( |  | ) | `[inline]`

Merge left and right

Definition at line 158 of file CAudioBuffer.hpp.

References m_bufferSize, and m_waveData.

void FORCEINLINE Exponent::Audio::CAudioBuffer::mergeToBuffer | ( | double * | output,
|  | const long | numberOfSamples |
| ) |  |  | `[inline]`

Merge and store in the passed buffer

Parameters:

  | output | The output buffer
  | numberOfSamples | The number of samples to process

Exceptions:

  | CException | If the output buffer is NULL

Definition at line 217 of file CAudioBuffer.hpp.

References m_waveData.

void FORCEINLINE Exponent::Audio::CAudioBuffer::mergeWithBuffer | ( | CAudioBuffer * | buffer | ) | `[inline]`

Merge with another buffer

Parameters:

  | buffer | The buffer to merge with

Exceptions:

  | CException | thrown if the bufer to be merged with has a different sized buffer

Definition at line 171 of file CAudioBuffer.hpp.

References e_left, e_right, getBufferSize(), getChannel(), m_bufferSize, and m_waveData.

void Exponent::Audio::CAudioBuffer::reInitialise | ( | const long | bufferSize | ) |

Uninit then init

Parameters:

  | bufferSize | The size of the audio buffer to use

void FORCEINLINE Exponent::Audio::CAudioBuffer::setFromAudioBuffer | ( | CAudioBuffer * | buffer | ) | `[inline]`

Set from another audiobuffer

Parameters:

  | buffer | The buffer to copy

Exceptions:

  | CException | thrown if the bufer to be merged with has a different sized buffer

Definition at line 248 of file CAudioBuffer.hpp.

References e_left, e_right, getBufferSize(), getChannel(), m_bufferSize, and m_waveData.

void FORCEINLINE Exponent::Audio::CAudioBuffer::setWaveDataFromFloatData | ( | float ** | waveData,
|  | const long | numberOfSamples |
| ) |  |  | `[inline]`

Set the audio data from float data

Parameters:

  | waveData | The data to copy
  | numberOfSamples | The number of samples to process

Definition at line 264 of file CAudioBuffer.hpp.

References m_waveData.

void FORCEINLINE Exponent::Audio::CAudioBuffer::setWaveDataFromFloatDataAndDenormal | ( | float ** | waveData,
|  | const long | numberOfSamples |
| ) |  |  | `[inline]`

Set the audio data from float data and denormal

Parameters:

  | waveData | The data to copy
  | numberOfSamples | The number of samples to process

Definition at line 284 of file CAudioBuffer.hpp.

References CAUDIO_BUFFER_DENORMAL, and m_waveData.

void Exponent::Audio::CAudioBuffer::uninitialise | ( |  | ) |

Uninitialise the audio data

## Member Data Documentation

const double Exponent::Audio::CAudioBuffer::CAUDIO_BUFFER_DENORMAL`[static]`

Denormal value

Definition at line 58 of file CAudioBuffer.hpp.

Referenced by denormal(), and setWaveDataFromFloatDataAndDenormal().

long Exponent::Audio::CAudioBuffer::m_bufferSize`[protected]`

The buffer size

Definition at line 432 of file CAudioBuffer.hpp.

Referenced by applyTanhLimiting(), changeGain(), clearWaveForm(), getBufferSize(), mergeChannels(), mergeWithBuffer(), and setFromAudioBuffer().

double** Exponent::Audio::CAudioBuffer::m_waveData`[protected]`

The wave data

Definition at line 431 of file CAudioBuffer.hpp.

Referenced by accumulateInToFloatData(), applyTanhLimiting(), changeGain(), clearWaveForm(), copyToFloatBufferFromWaveData(), denormal(), getAudioData(), getChannel(), getMutableAudioData(), getSample(), mergeChannels(), mergeToBuffer(), mergeWithBuffer(), setFromAudioBuffer(), setWaveDataFromFloatData(), and setWaveDataFromFloatDataAndDenormal().