CSL  6.0
csl::BufferCMap Class Reference

BufferCMap is a Sample buffer with channel map and count. More...

#include <CSL_Core.h>

+ Inheritance diagram for csl::BufferCMap:

Public Member Functions

 BufferCMap ()
 Constructors: default is useless. More...
 
 BufferCMap (unsigned numChannels, unsigned numFrames)
 ask for a given number of "virtual" channels More...
 
 BufferCMap (unsigned numChannels, unsigned realNumChannels, unsigned numFrames)
 
 ~BufferCMap ()
 Destructor. More...
 
SampleBuffer buffer (unsigned bufNum)
 Pointer accessor uses channel map. More...
 
float duration ()
 answer the buffer's duration in seconds More...
 
void setSize (unsigned numChannels, unsigned numFrames)
 
void setSizeOnly (unsigned numChannels, unsigned numFrames)
 this version doesn't even allocate the pointers More...
 
void checkBuffers () throw (MemoryError)
 allocate if not already there More...
 
void allocateBuffers () throw (MemoryError)
 fcn to malloc storage buffers More...
 
void freeBuffers ()
 fcn to free them More...
 
bool canStore (unsigned numFrames)
 answer whether the recevei can store numFrames more frames More...
 
void zeroBuffers ()
 fill all data with 0 More...
 
void fillWith (sample value)
 fill data with the given value More...
 
void scaleBy (sample value)
 scale the samples by the given value More...
 
void copyFrom (Buffer &src) throw (RunTimeError)
 
void copyHeaderFrom (Buffer &source) throw (RunTimeError)
 copy the "header" fields of a buffer More...
 
void copySamplesFrom (Buffer &src) throw (RunTimeError)
 import data from the given buffer More...
 
void copySamplesFromTo (Buffer &src, unsigned offset) throw (RunTimeError)
 same with write offset More...
 
void copyOnlySamplesFrom (Buffer &src) throw (RunTimeError)
 import data from the given buffer More...
 
bool readFromFile (char *fname)
 read a buffer from a snd file; answer success More...
 
csl::Status convertRate (int fromRate, int toRate)
 convert the sample rate using libSampleRate More...
 
virtual SampleBuffer samplePtrFor (unsigned channel, unsigned offset)
 answer a samp ptr with offset More...
 
virtual SampleBuffer samplePtrFor (unsigned channel, unsigned offset, unsigned maxFrame)
 answer a samp ptr tested for extent (offset + maxFrame) More...
 
virtual SampleBufferbuffers ()
 
virtual void setBuffers (SampleBuffer *sPtr)
 Set the buffer pointer (rare; used in joiners) More...
 
virtual void setBuffer (unsigned bufNum, SampleBuffer sPtr)
 
virtual void setBuffer (unsigned bufNum, unsigned offset, sample samp)
 
float normalize (float maxVal)
 normalize the buffer(s) to the given max; answer the prior max More...
 
float normalize (float maxVal, float from, float to)
 normalize the given region only More...
 
float rms (unsigned chan, unsigned from, unsigned to)
 Buffer Sample Processing (optional). One could also easily add Buffer operators, such as (Buffer + Buffer) or (Buffer * Buffer) More...
 
float avg (unsigned chan, unsigned from, unsigned to)
 get the average of the samples More...
 
float max (unsigned chan, unsigned from, unsigned to)
 get the max of the absolute val of the samples More...
 
float min (unsigned chan, unsigned from, unsigned to)
 get the min of the samples More...
 

Public Attributes

unsigned mRealNumChannels
 the actual number of channels used More...
 
std::vector< int > mChannelMap
 the map between virtual and real channels More...
 
unsigned mNumChannels
 num channels in buffer (num mono buffers) More...
 
unsigned mNumFrames
 num frames used in each buffer More...
 
unsigned mNumAlloc
 num frames in each buffer More...
 
unsigned mMonoBufferByteSize
 size of each buffer in bytes More...
 
unsigned mSequence
 sequential serial number More...
 
Timestamp mTimestamp
 the buffer's most recent timestamp More...
 
bool mAreBuffersAllocated
 are the buffers allocated? More...
 
bool mDidIAllocateBuffers
 who allocated my data buffers? More...
 
bool mIsPopulated
 does the buffer have data? More...
 
bool mAreBuffersZero
 have the buffers been zeroed out? More...
 
BufferContentType mType
 Data type flag set the internal size variables (no buffer allocation takes place) More...
 

Protected Attributes

SampleBufferVector mBuffers
 the storage vector – pointers to (SampleBuffer) buffers More...
 

Detailed Description

BufferCMap is a Sample buffer with channel map and count.

The map is so that one can have (e.g.,) a buffer that stands for 3 channels within an 8-channel space

Definition at line 191 of file CSL_Core.h.

Constructor & Destructor Documentation

BufferCMap::BufferCMap ( )

Constructors: default is useless.

Buffer Sample Processing (optional)

Definition at line 625 of file CSL_Core.cpp.

BufferCMap::BufferCMap ( unsigned  numChannels,
unsigned  numFrames 
)

ask for a given number of "virtual" channels

Definition at line 627 of file CSL_Core.cpp.

BufferCMap::BufferCMap ( unsigned  numChannels,
unsigned  realNumChannels,
unsigned  numFrames 
)

Definition at line 631 of file CSL_Core.cpp.

BufferCMap::~BufferCMap ( )

Destructor.

Definition at line 635 of file CSL_Core.cpp.

Member Function Documentation

SampleBuffer csl::BufferCMap::buffer ( unsigned  bufNum)
inlinevirtual

Pointer accessor uses channel map.

Reimplemented from csl::Buffer.

Definition at line 202 of file CSL_Core.h.

References csl::Buffer::mBuffers.

float Buffer::duration ( )
inherited

answer the buffer's duration in seconds

Definition at line 114 of file CSL_Core.cpp.

References csl::CGestalt::frameRateF(), and csl::Buffer::mNumFrames.

void Buffer::setSizeOnly ( unsigned  numChannels,
unsigned  numFrames 
)
inherited

this version doesn't even allocate the pointers

Definition at line 99 of file CSL_Core.cpp.

References csl::Buffer::mMonoBufferByteSize, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

void Buffer::checkBuffers ( )
throw (MemoryError
)
inherited

allocate if not already there

Definition at line 107 of file CSL_Core.cpp.

References csl::Buffer::allocateBuffers(), and csl::Buffer::mAreBuffersAllocated.

Referenced by csl::VSTIO::processReplacing().

bool Buffer::canStore ( unsigned  numFrames)
inherited

answer whether the recevei can store numFrames more frames

Definition at line 197 of file CSL_Core.cpp.

References csl::Buffer::mNumAlloc, and csl::Buffer::mNumFrames.

void Buffer::fillWith ( sample  value)
inherited

fill data with the given value

Definition at line 203 of file CSL_Core.cpp.

References csl::Buffer::mAreBuffersZero, csl::Buffer::mBuffers, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

void Buffer::scaleBy ( sample  value)
inherited

scale the samples by the given value

Definition at line 219 of file CSL_Core.cpp.

References csl::Buffer::mAreBuffersZero, csl::Buffer::mBuffers, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

void Buffer::copyFrom ( Buffer src)
throw (RunTimeError
)
inherited

Definition at line 250 of file CSL_Core.cpp.

Referenced by csl::Abst_SoundFile::mergeToMono(), and csl::Buffer::readFromFile().

void Buffer::copyHeaderFrom ( Buffer source)
throw (RunTimeError
)
inherited

copy the "header" fields of a buffer

Definition at line 235 of file CSL_Core.cpp.

References csl::logMsg().

void Buffer::copySamplesFrom ( Buffer src)
throw (RunTimeError
)
inherited

import data from the given buffer

Definition at line 270 of file CSL_Core.cpp.

References csl_min, csl::kLogError, and csl::logMsg().

void Buffer::copySamplesFromTo ( Buffer src,
unsigned  offset 
)
throw (RunTimeError
)
inherited

same with write offset

Definition at line 300 of file CSL_Core.cpp.

References csl_min, csl::kLogError, and csl::logMsg().

void Buffer::copyOnlySamplesFrom ( Buffer src)
throw (RunTimeError
)
inherited

import data from the given buffer

same with write offset

Definition at line 286 of file CSL_Core.cpp.

References csl_min, csl::kLogError, and csl::logMsg().

Referenced by csl::FanOut::nextBuffer().

bool Buffer::readFromFile ( char *  fname)
inherited

read a buffer from a snd file; answer success

Definition at line 315 of file CSL_Core.cpp.

References csl::Buffer::copyFrom(), csl::kLogError, csl::logMsg(), csl::Buffer::mDidIAllocateBuffers, and csl::Buffer::mNumFrames.

csl::Status csl::Buffer::convertRate ( int  fromRate,
int  toRate 
)
inherited

convert the sample rate using libSampleRate

Referenced by csl::Abst_SoundFile::convertRate().

sample * Buffer::samplePtrFor ( unsigned  channel,
unsigned  offset 
)
virtualinherited

answer a samp ptr with offset

answer a samp ptr tested for extent (offset + maxFrame)

Definition at line 183 of file CSL_Core.cpp.

References csl::Buffer::mBuffers.

sample * Buffer::samplePtrFor ( unsigned  channel,
unsigned  offset,
unsigned  maxFrame 
)
virtualinherited

answer a samp ptr tested for extent (offset + maxFrame)

answer whether the receiver can store numFrames more frames

Definition at line 189 of file CSL_Core.cpp.

References csl::Buffer::mBuffers, and csl::Buffer::mNumAlloc.

virtual SampleBuffer* csl::Buffer::buffers ( )
inlinevirtualinherited
virtual void csl::Buffer::setBuffers ( SampleBuffer sPtr)
inlinevirtualinherited

Set the buffer pointer (rare; used in joiners)

Definition at line 157 of file CSL_Core.h.

References csl::Buffer::mBuffers.

Referenced by csl::WavetableOscillator::setWaveform().

virtual void csl::Buffer::setBuffer ( unsigned  bufNum,
unsigned  offset,
sample  samp 
)
inlinevirtualinherited

Definition at line 159 of file CSL_Core.h.

References csl::Buffer::mBuffers.

float Buffer::normalize ( float  maxVal)
inherited

normalize the buffer(s) to the given max; answer the prior max

Definition at line 348 of file CSL_Core.cpp.

References csl::Buffer::mBuffers, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

float Buffer::normalize ( float  maxVal,
float  from,
float  to 
)
inherited

normalize the given region only

Definition at line 377 of file CSL_Core.cpp.

References csl::CGestalt::frameRateF(), csl::Buffer::mBuffers, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

sample Buffer::rms ( unsigned  chan,
unsigned  from,
unsigned  to 
)
inherited

Buffer Sample Processing (optional). One could also easily add Buffer operators, such as (Buffer + Buffer) or (Buffer * Buffer)

< get the root-mean-square of the samples

get the root-mean-square of the samples

get the average of the samples

Definition at line 465 of file CSL_Core.cpp.

References csl::Buffer::buffer(), csl::Buffer::mBuffers, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

Referenced by test_convolution_file().

sample Buffer::avg ( unsigned  chan,
unsigned  from,
unsigned  to 
)
inherited

get the average of the samples

get the max of the samples

Definition at line 483 of file CSL_Core.cpp.

References csl::Buffer::buffer(), csl::Buffer::mBuffers, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

sample Buffer::max ( unsigned  chan,
unsigned  from,
unsigned  to 
)
inherited

get the max of the absolute val of the samples

get the min of the samples

Definition at line 495 of file CSL_Core.cpp.

References csl::Buffer::buffer(), csl::Buffer::mBuffers, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

sample Buffer::min ( unsigned  chan,
unsigned  from,
unsigned  to 
)
inherited

get the min of the samples

Definition at line 509 of file CSL_Core.cpp.

References csl::Buffer::buffer(), csl::Buffer::mBuffers, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

Member Data Documentation

unsigned csl::BufferCMap::mRealNumChannels

the actual number of channels used

Definition at line 198 of file CSL_Core.h.

std::vector<int> csl::BufferCMap::mChannelMap

the map between virtual and real channels

Definition at line 199 of file CSL_Core.h.

Referenced by csl::InOut::InOut(), and csl::InOut::setChanMap().

unsigned csl::Buffer::mMonoBufferByteSize
inherited
unsigned csl::Buffer::mSequence
inherited

sequential serial number

Definition at line 116 of file CSL_Core.h.

Timestamp csl::Buffer::mTimestamp
inherited

the buffer's most recent timestamp

Definition at line 117 of file CSL_Core.h.

bool csl::Buffer::mAreBuffersZero
inherited

have the buffers been zeroed out?

Definition at line 123 of file CSL_Core.h.

Referenced by csl::Buffer::fillWith(), csl::Buffer::scaleBy(), csl::WavetableOscillator::setWaveform(), and csl::Buffer::zeroBuffers().

BufferContentType csl::Buffer::mType
inherited

Data type flag set the internal size variables (no buffer allocation takes place)

Definition at line 124 of file CSL_Core.h.

Referenced by csl::BinauralPanner::BinauralPanner(), csl::AmbisonicRotator::nextBuffer(), csl::AmbisonicEncoder::nextBuffer(), csl::AmbisonicDecoder::nextBuffer(), and csl::Controllable::pullInput().


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