iso::synth::Buffer Class Reference

storage for audio data More...

#include <iso_synth_buffer.h>

Inherited by iso::synth::Channel, iso::synth::Frame, iso::synth::RingBuffer, and iso::synth::Sample.

Inheritance diagram for iso::synth::Buffer:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Buffer ()
 default contructor
 Buffer (sample pValue)
 paramater based contructor
 Buffer (unsigned int pFrameCount, unsigned int pChannelCount)
 paramater based contructor
 Buffer (unsigned int pFrameCount, unsigned int pChannelCount, sample pValue)
 paramater based contructor
 Buffer (unsigned int pFrameCount, unsigned int pChannelCount, const sample *pValues)
 paramater based contructor
 Buffer (unsigned int pFrameCount, unsigned int pChannelCount, double p1, double p2,...)
 paramater based contructor
 Buffer (const Buffer &pBuffer)
 copy constructor
 Buffer (const serialize::SerializeData &pSerializeData) throw (serialize::SerializeException)
 serialization based constructor
virtual ~Buffer ()
 destructor
virtual serialize::SerializeData serialize (const String &pSerialName=sClassName) const
 create serializeData for buffer
sampledata ()
 return buffer values
const sampledata () const
 return buffer values
virtual const Bufferoperator= (const Buffer &pBuffer) throw (SynthException)
 assignment operator
virtual sample operator= (sample pValue)
 set content of buffer to one value
virtual bool operator== (const Buffer &pBuffer) const
 comparison operator
unsigned int frameCount () const
 return number of frames
unsigned int channelCount () const
 returns number of channels
virtual sample operator() (unsigned int pFrameIndex, unsigned int pChannelIndex) const throw (SynthException)
 returns sample at frame and channel
void clip ()
 clips buffer samples to the range of -1.0 to 1.0
sample operator() (sample pFrameIndex, unsigned int pChannelIndex) const throw (SynthException)
 returns interpolated sample value
virtual void setSize (unsigned int pFrameCount, unsigned int pChannelCount) throw (SynthException)
 change buffer size
virtual void setFrameCount (unsigned int pFrameCount) throw (SynthException)
 change number of frames
virtual void setChannelCount (unsigned int pChannelCount) throw (SynthException)
 change number of channels
virtual void appendFrames (const Buffer &pBuffer) throw (SynthException)
 append frames from pBuffer to buffer
virtual void appendChannels (const Buffer &pBuffer) throw (SynthException)
 append channels from pBuffer to buffer
virtual const Bufferoperator+= (sample pSample)
 += operator
virtual const Bufferoperator *= (sample pSample)
 *= operator
virtual const Bufferoperator+= (const Buffer &pBuffer) throw (SynthException)
 += operator
virtual const Bufferoperator *= (const Buffer &pBuffer) throw (SynthException)
 *= operator
virtual String info () const
 obtain textual buffer information

Static Public Member Functions

static serialize::Serializable * deSerialize (const serialize::SerializeData &pSerializeData) throw (serialize::SerializeException)
 create buffer from SerializeData
static void deinterleave (Buffer &pSourceBuffer, Buffer &pTargetBuffer) throw (SynthException)
 transforms an interleaves source buffer into a non-interleaved target buffer
static void interleave (Buffer &pSourceBuffer, Buffer &pTargetBuffer) throw (SynthException)
 transforms a non-interleaved source buffer into an interleaved target buffer

Static Public Attributes

static const String sClassName
 default name

Protected Member Functions

virtual void setDim (unsigned int p_dim)
 set dimension of vector

Protected Attributes

unsigned int mFrameCount
 frame count
unsigned int mChannelCount
 channel count

Static Protected Attributes

static unsigned int sFrameCount
 default frame count
static unsigned int sChannelCount
 default channel count

Friends

std::ostream & operator<< (std::ostream &pOstream, const Buffer &pBuffer)
 print buffer information

Detailed Description

storage for audio data

audio data

The buffer class stores an arbitrary number of channels and frames of audio or control data in non-interleaved format.
i.e. when iterating over a buffers content, the channel index is the slow changing variable and the frame index is the fast changing variable
The buffer's internal datatype are samples.

Created by Daniel Bisig on 02/19/06.


Constructor & Destructor Documentation

Buffer::Buffer (  ) 

default contructor

Buffer::Buffer ( sample  pValue  ) 

paramater based contructor

Parameters:
pValue value to fill buffer width

Buffer::Buffer ( unsigned int  pFrameCount,
unsigned int  pChannelCount 
)

paramater based contructor

Parameters:
pFrameCount frame count
pChannelCount channel count

Buffer::Buffer ( unsigned int  pFrameCount,
unsigned int  pChannelCount,
sample  pValue 
)

paramater based contructor

Parameters:
pFrameCount frame count
pChannelCount channel count
pValue value to fill buffer width

Buffer::Buffer ( unsigned int  pFrameCount,
unsigned int  pChannelCount,
const sample pValues 
)

paramater based contructor

Parameters:
pFrameCount frame count
pChannelCount channel count
pValues values to fill buffer with

Buffer::Buffer ( unsigned int  pFrameCount,
unsigned int  pChannelCount,
double  p1,
double  p2,
  ... 
)

paramater based contructor

Parameters:
pFrameCount frame count
pChannelCount channel count
p1 start of a list of values to fill buffer with (make sure the number of values equals the number of channels)
p2 next element in list of values to fill buffer with (make sure the number of values equals the number of channels)

Buffer::Buffer ( const Buffer pBuffer  ) 

copy constructor

Parameters:
pBuffer buffer to copy properties from

Buffer::Buffer ( const serialize::SerializeData &  pSerializeData  )  throw (serialize::SerializeException)

serialization based constructor

Parameters:
pSerializeData serialization data
Exceptions:
SerializeException failed to create buffer

Buffer::~Buffer (  )  [virtual]

destructor


Member Function Documentation

serialize::SerializeData Buffer::serialize ( const String pSerialName = sClassName  )  const [virtual]

create serializeData for buffer

Returns:
serializeData

Reimplemented in iso::synth::Channel, iso::synth::Frame, iso::synth::RingBuffer, and iso::synth::Sample.

serialize::Serializable * Buffer::deSerialize ( const serialize::SerializeData &  pSerializeData  )  throw (serialize::SerializeException) [static]

create buffer from SerializeData

Parameters:
pSerializeData SerializeData
Returns:
Serializable
Exceptions:
SerializeException incompatible SerializeData

Reimplemented in iso::synth::Channel, iso::synth::Frame, iso::synth::RingBuffer, and iso::synth::Sample.

sample * Buffer::data (  ) 

return buffer values

Returns:
buffer values

const sample * Buffer::data (  )  const

return buffer values

Returns:
buffer values

const Buffer & Buffer::operator= ( const Buffer pBuffer  )  throw (SynthException) [virtual]

assignment operator

Parameters:
pBuffer buffer to copy properties from
Returns:
buffer
Exceptions:
SynthException frameCount or channelCount doesn't match

Reimplemented in iso::synth::Channel, iso::synth::Frame, and iso::synth::Sample.

sample Buffer::operator= ( sample  pValue  )  [virtual]

set content of buffer to one value

Parameters:
pValue value to fill the buffer with

Reimplemented in iso::synth::Frame.

bool Buffer::operator== ( const Buffer pBuffer  )  const [virtual]

comparison operator

Parameters:
pBuffer buffer to which the comparison is made to
Returns:
true, if ChannelCount and FrameCount of both buffers are identical, otherwise false

Reimplemented in iso::synth::Channel, and iso::synth::Frame.

unsigned int Buffer::frameCount (  )  const

return number of frames

Returns:
number of frames

unsigned int Buffer::channelCount (  )  const

returns number of channels

Returns:
number of channels

sample Buffer::operator() ( unsigned int  pFrameIndex,
unsigned int  pChannelIndex 
) const throw (SynthException) [virtual]

returns sample at frame and channel

Parameters:
pFrameIndex frame index
pChannelIndex channel index
Returns:
sample

void Buffer::clip (  ) 

clips buffer samples to the range of -1.0 to 1.0

sample Buffer::operator() ( sample  pFrameIndex,
unsigned int  pChannelIndex 
) const throw (SynthException)

returns interpolated sample value

Parameters:
pFrameIndex selected frame
pChannelIndex selected channel
Returns:
interpolated sample value
performs linear interpolation between two neighboring buffer indexes

void Buffer::deinterleave ( Buffer pSourceBuffer,
Buffer pTargetBuffer 
) throw (SynthException) [static]

transforms an interleaves source buffer into a non-interleaved target buffer

Parameters:
pSourceBuffer interleaved source buffer
pTargetBuffer non-interleaved target buffer
Exceptions:
SynthException buffers don't possess same number of frames and channels

void Buffer::interleave ( Buffer pSourceBuffer,
Buffer pTargetBuffer 
) throw (SynthException) [static]

transforms a non-interleaved source buffer into an interleaved target buffer

Parameters:
pSourceBuffer non-interleaved source buffer
pTargetBuffer interleaved target buffer
Exceptions:
SynthException buffers don't possess same number of frames and channels

void Buffer::setSize ( unsigned int  pFrameCount,
unsigned int  pChannelCount 
) throw (SynthException) [virtual]

change buffer size

Parameters:
pFrameCount new frame count
pChannelCount new channel count
Exceptions:
SynthException never throws an exception

Reimplemented in iso::synth::Channel, iso::synth::Frame, and iso::synth::Sample.

void Buffer::setFrameCount ( unsigned int  pFrameCount  )  throw (SynthException) [virtual]

change number of frames

Parameters:
pFrameCount new frameCount
Exceptions:
SynthException never throws an exception

Reimplemented in iso::synth::Frame, and iso::synth::Sample.

void Buffer::setChannelCount ( unsigned int  pChannelCount  )  throw (SynthException) [virtual]

change number of channels

Parameters:
pChannelCount new channelCount
Exceptions:
SynthException never throws an exception

Reimplemented in iso::synth::Channel, and iso::synth::Sample.

void Buffer::appendFrames ( const Buffer pBuffer  )  throw (SynthException) [virtual]

append frames from pBuffer to buffer

Parameters:
pBuffer 
Exceptions:
SynthException channelCount doesn't match

Reimplemented in iso::synth::Frame, and iso::synth::Sample.

void Buffer::appendChannels ( const Buffer pBuffer  )  throw (SynthException) [virtual]

append channels from pBuffer to buffer

Parameters:
pBuffer 
Exceptions:
SynthException frameCount doesn't match

Reimplemented in iso::synth::Channel, and iso::synth::Sample.

const Buffer & Buffer::operator+= ( sample  pSample  )  [virtual]

+= operator

Parameters:
pSample sample value to be added
Returns:
resulting buffer

Reimplemented in iso::synth::Frame.

const Buffer & Buffer::operator *= ( sample  pSample  )  [virtual]

*= operator

Parameters:
pSample sample value to be multiplied
Returns:
resulting buffer

Reimplemented in iso::synth::Frame.

const Buffer & Buffer::operator+= ( const Buffer pBuffer  )  throw (SynthException) [virtual]

+= operator

Parameters:
pBuffer buffer to be added
Returns:
resulting buffer
Exceptions:
SynthException buffers don't possess same number of frames and channels

Reimplemented in iso::synth::Channel, iso::synth::Frame, and iso::synth::Sample.

const Buffer & Buffer::operator *= ( const Buffer pBuffer  )  throw (SynthException) [virtual]

*= operator

Parameters:
pBuffer buffer to be multiplied
Returns:
resulting buffer
Exceptions:
SynthException buffers don't possess same number of frames and channels

Reimplemented in iso::synth::Channel, iso::synth::Frame, and iso::synth::Sample.

String Buffer::info (  )  const [virtual]

obtain textual buffer information

Returns:
String containing buffer information

Reimplemented in iso::synth::Channel, iso::synth::Frame, iso::synth::RingBuffer, and iso::synth::Sample.

void Buffer::setDim ( unsigned int  p_dim  )  [protected, virtual]

set dimension of vector

Parameters:
p_dim new vector dimension
original values are preserved as far as possible. when vector dimension increases, new elements contain zero when vector dimension decreases, previous values at positions that are beyond new dimension


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  pOstream,
const Buffer pBuffer 
) [friend]

print buffer information


Member Data Documentation

const String Buffer::sClassName [static]

default name

Reimplemented in iso::synth::Channel, iso::synth::Frame, iso::synth::RingBuffer, and iso::synth::Sample.

unsigned int Buffer::sFrameCount [static, protected]

default frame count

unsigned int Buffer::sChannelCount [static, protected]

default channel count

unsigned int iso::synth::Buffer::mFrameCount [protected]

frame count

unsigned int iso::synth::Buffer::mChannelCount [protected]

channel count


The documentation for this class was generated from the following files:
Generated on Fri Feb 25 14:18:41 2011 for synth by  doxygen 1.5.1