Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

AudioBuffer< T > Class Template Reference

#include <Audio/AudioBuffer.H>

List of all members.


Detailed Description

template<class T>
class AudioBuffer< T >

AudioBuffer is a buffer of audio data.

AudioBuffer has copy-on-write/ref-counting semantics and automatic memory management, just like Image does. The template argument specifies the type of the audio data (typically, byte, or int16).

Definition at line 48 of file AudioBuffer.H.

Public Member Functions

Constructors, destructors, assignment
 AudioBuffer (const T *data, const uint nsampl, const uint nchan, const float freq)
 Constructor from raw data.
 AudioBuffer (const uint nsampl, const uint nchan, const float freq, InitPolicy init)
 Allocate memory for future data.
 AudioBuffer (const AudioBuffer< T > &A)
 Copy constructor.
AudioBuffer< T > & operator= (const AudioBuffer< T > &A)
 Assigment operator.
 AudioBuffer ()
 Empty constructor.
 ~AudioBuffer ()
 Destructor.
Access functions
uint nsamples () const
 Get number of samples.
uint nchans () const
 Get number of channels.
float freq () const
 Get sampling frequency in samples/s.
void setFreq (const float f)
 Set sampling frequency in samples/s.
const T & getVal (const uint sample, const uint channel)
 Get a sample.
uint size () const
 Get total data size in number of T's.
uint sizeBytes () const
 Get total data size in bytes.
const T * getDataPtr () const
 Get a read-only pointer to the raw data.
T * getDataPtr ()
 Get a read/write pointer to the raw data.


Constructor & Destructor Documentation

template<class T>
AudioBuffer< T >::AudioBuffer const T *  data,
const uint  nsampl,
const uint  nchan,
const float  freq
[inline]
 

Constructor from raw data.

Definition at line 122 of file AudioBuffer.H.

template<class T>
AudioBuffer< T >::AudioBuffer const uint  nsampl,
const uint  nchan,
const float  freq,
InitPolicy  init
[inline]
 

Allocate memory for future data.

Definition at line 130 of file AudioBuffer.H.

template<class T>
AudioBuffer< T >::AudioBuffer const AudioBuffer< T > &  A  )  [inline]
 

Copy constructor.

Definition at line 138 of file AudioBuffer.H.

template<class T>
AudioBuffer< T >::AudioBuffer  )  [inline]
 

Empty constructor.

Definition at line 155 of file AudioBuffer.H.

template<class T>
AudioBuffer< T >::~AudioBuffer  )  [inline]
 

Destructor.

Definition at line 162 of file AudioBuffer.H.


Member Function Documentation

template<class T>
float AudioBuffer< T >::freq  )  const [inline]
 

Get sampling frequency in samples/s.

Definition at line 177 of file AudioBuffer.H.

template<class T>
T * AudioBuffer< T >::getDataPtr  )  [inline]
 

Get a read/write pointer to the raw data.

Definition at line 210 of file AudioBuffer.H.

template<class T>
const T * AudioBuffer< T >::getDataPtr  )  const [inline]
 

Get a read-only pointer to the raw data.

Definition at line 205 of file AudioBuffer.H.

Referenced by AudioGrabber::grab(), readAudioWavFile(), and RadioDecoder::run().

template<class T>
const T & AudioBuffer< T >::getVal const uint  sample,
const uint  channel
[inline]
 

Get a sample.

Definition at line 187 of file AudioBuffer.H.

References ASSERT, AudioBuffer< T >::nchans(), and AudioBuffer< T >::nsamples().

Referenced by main().

template<class T>
uint AudioBuffer< T >::nchans  )  const [inline]
 

Get number of channels.

Definition at line 172 of file AudioBuffer.H.

Referenced by AudioBuffer< T >::getVal(), AudioBuffer< T >::size(), and AudioBuffer< T >::sizeBytes().

template<class T>
uint AudioBuffer< T >::nsamples  )  const [inline]
 

Get number of samples.

Definition at line 167 of file AudioBuffer.H.

Referenced by audiorecorder(), AudioBuffer< T >::getVal(), RadioDecoder::run(), AudioBuffer< T >::size(), and AudioBuffer< T >::sizeBytes().

template<class T>
AudioBuffer< T > & AudioBuffer< T >::operator= const AudioBuffer< T > &  A  )  [inline]
 

Assigment operator.

Definition at line 145 of file AudioBuffer.H.

References AudioBuffer< T >::itsFreq, and AudioBuffer< T >::itsHdl.

template<class T>
void AudioBuffer< T >::setFreq const float  f  )  [inline]
 

Set sampling frequency in samples/s.

Definition at line 182 of file AudioBuffer.H.

template<class T>
uint AudioBuffer< T >::size  )  const [inline]
 

Get total data size in number of T's.

This is nsamples * nchans

Definition at line 195 of file AudioBuffer.H.

References AudioBuffer< T >::nchans(), and AudioBuffer< T >::nsamples().

template<class T>
uint AudioBuffer< T >::sizeBytes  )  const [inline]
 

Get total data size in bytes.

This is nsamples * nchans * sizeof(T)

Definition at line 200 of file AudioBuffer.H.

References AudioBuffer< T >::nchans(), and AudioBuffer< T >::nsamples().

Referenced by AudioGrabber::grab().


The documentation for this class was generated from the following file:
Generated on Mon Nov 23 15:49:54 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4