CSL  5.2
csl::BufferCMap Class Reference

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. More...

#include <CSL_Core.h>

+ Inheritance diagram for csl::BufferCMap:

List of all members.

Public Member Functions

 BufferCMap ()
 Constructors: default is useless.
 BufferCMap (unsigned numChannels, unsigned numFrames)
 ask for a given number of "virtual" channels
 BufferCMap (unsigned numChannels, unsigned realNumChannels, unsigned numFrames)
 ~BufferCMap ()
 Destructor.
SampleBuffer monoBuffer (unsigned bufNum)
 Pointer accessor uses channel map.
void setSize (unsigned numChannels, unsigned numFrames)
void setSizeOnly (unsigned numChannels, unsigned numFrames)
 this version doesn't even allocate the pointers
void checkBuffers () throw (MemoryError)
 allocate if not already there
void allocateBuffers () throw (MemoryError)
 fcn to malloc storage buffers
void freeBuffers ()
 fcn to free them
bool canStore (unsigned numFrames)
 answer whether the recevei can store numFrames more frames
void zeroBuffers ()
 fill all data with 0
void fillWith (sample value)
 fill data with the given value
void copyFrom (Buffer &src) throw (RunTimeError)
void copyHeaderFrom (Buffer &source) throw (RunTimeError)
 copy the "header" fields of a buffer
void copySamplesFrom (Buffer &src) throw (RunTimeError)
 import data from the given buffer
void copySamplesFromTo (Buffer &src, unsigned offset) throw (RunTimeError)
 same with write offset
void copyOnlySamplesFrom (Buffer &src) throw (RunTimeError)
 import data from the given buffer
csl::Status convertRate (int fromRate, int toRate)
 convert the sample rate using libSampleRate
virtual SampleBuffer samplePtrFor (unsigned channel, unsigned offset)
 answer a samp ptr with offset
virtual SampleBuffer samplePtrFor (unsigned channel, unsigned offset, unsigned maxFrame)
 answer a samp ptr tested for extent (offset + maxFrame)
virtual SampleBuffer buffer (unsigned bufNum)
virtual SampleBufferbuffers ()
virtual void setBuffers (SampleBuffer *sPtr)
 Set the buffer pointer (rare; used in joiners)
virtual void setBuffer (unsigned bufNum, SampleBuffer sPtr)
virtual void setBuffer (unsigned bufNum, unsigned offset, sample samp)

Public Attributes

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

Protected Attributes

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

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 167 of file CSL_Core.h.


Constructor & Destructor Documentation

BufferCMap::BufferCMap ( )

Constructors: default is useless.

Buffer Sample Processing (optional)

Definition at line 477 of file CSL_Core.cpp.

BufferCMap::BufferCMap ( unsigned  numChannels,
unsigned  numFrames 
)

ask for a given number of "virtual" channels

Definition at line 479 of file CSL_Core.cpp.

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

Definition at line 483 of file CSL_Core.cpp.

BufferCMap::~BufferCMap ( )

Destructor.

Definition at line 487 of file CSL_Core.cpp.


Member Function Documentation

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

Pointer accessor uses channel map.

Reimplemented from csl::Buffer.

Definition at line 178 of file CSL_Core.h.

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

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

this version doesn't even allocate the pointers

Definition at line 78 of file CSL_Core.cpp.

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

Referenced by csl::CslRtpSession::OnRTPPacket().

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

allocate if not already there

Definition at line 86 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 166 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 172 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 202 of file CSL_Core.cpp.

Referenced by csl::Abst_SoundFile::mergeToMono(), and csl::MP3File::openForRead().

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

copy the "header" fields of a buffer

Definition at line 187 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 222 of file CSL_Core.cpp.

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

Referenced by csl::DecodedFile::mergeBuffers().

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

same with write offset

Definition at line 252 of file CSL_Core.cpp.

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

Referenced by csl::DecodedFile::mergeBuffers().

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

import data from the given buffer

same with write offset

Definition at line 238 of file CSL_Core.cpp.

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

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

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 152 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 158 of file CSL_Core.cpp.

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

virtual SampleBuffer* csl::Buffer::buffers ( )
inlinevirtualinherited

Definition at line 135 of file CSL_Core.h.

References csl::Buffer::mBuffers.

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

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

Set the buffer pointer (rare; used in joiners)

Definition at line 137 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 139 of file CSL_Core.h.

References csl::Buffer::mBuffers.


Member Data Documentation

unsigned csl::BufferCMap::mRealNumChannels

the actual number of channels used

Definition at line 174 of file CSL_Core.h.

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

the map between virtual and real channels

Definition at line 175 of file CSL_Core.h.

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

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

sequential serial number

Definition at line 98 of file CSL_Core.h.

Timestamp csl::Buffer::mTimestamp
inherited

the buffer's most recent timestamp

Definition at line 99 of file CSL_Core.h.

bool csl::Buffer::mAreBuffersZero
inherited

have the buffers been zeroed out?

Definition at line 104 of file CSL_Core.h.

Referenced by csl::Buffer::fillWith(), 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 105 of file CSL_Core.h.

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

SampleBufferVector csl::Buffer::mBuffers
protectedinherited

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