CSL 5.2

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Protected Attributes
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 SampleBuffer * | buffers ()
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 | ) |
| inline virtual

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::setSize | ( | unsigned | numChannels,
|  | unsigned | numFrames
| ) |  |
| inherited

Definition at line 54 of file CSL_Core.cpp.

References csl::Buffer::freeBuffers(), csl::Buffer::mAreBuffersAllocated, csl::Buffer::mBuffers, csl::Buffer::mDidIAllocateBuffers, csl::Buffer::mIsPopulated, csl::Buffer::mMonoBufferByteSize, csl::Buffer::mNumAlloc, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

Referenced by csl::Mixer::allocateOpBuffer(), csl::BlockResizer::BlockResizer(), csl::Buffer::Buffer(), csl::Abst_SoundFile::checkBuffer(), csl::Port::checkBuffer(), csl::DelayLine::DelayLine(), csl::WavetableOscillator::fillSine(), csl::KarplusString::initDelayLine(), csl::PAIO::initialize(), csl::WaveShaper::initWaveTable(), csl::DecodedFile::mergeBuffers(), csl::FileIO::open(), csl::VSTIO::processReplacing(), csl::Window::setSize(), csl::SpatialPanner::SpatialPanner(), and csl::WavetableOscillator::WavetableOscillator().

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().

void Buffer::allocateBuffers | ( |  | ) | throw (MemoryError)
| inherited

fcn to malloc storage buffers

Definition at line 95 of file CSL_Core.cpp.

References csl::logMsg(), csl::Buffer::mAreBuffersAllocated, csl::Buffer::mBuffers, csl::Buffer::mDidIAllocateBuffers, csl::Buffer::mNumAlloc, csl::Buffer::mNumChannels, csl::Buffer::mNumFrames, and SAFE_MALLOC.

Referenced by csl::DecodedFile::addBuffer(), csl::UnitGenerator::addOutput(), csl::Mixer::allocateOpBuffer(), csl::BinauralPanner::BinauralPanner(), csl::BlockResizer::BlockResizer(), csl::Abst_SoundFile::checkBuffer(), csl::Port::checkBuffer(), csl::Buffer::checkBuffers(), csl::CompOrCacheOscillator::createCache(), csl::MP3File::decodeMP3(), csl::FFT::FFT(), csl::WavetableOscillator::fillSine(), csl::Filter::init(), csl::RemoteIO::init_io(), csl::KarplusString::initDelayLine(), csl::AmbisonicMixer::initialize(), csl::WaveShaper::initWaveTable(), csl::DecodedFile::mergeBuffers(), csl::Abst_SoundFile::mergeToMono(), csl::FileIO::open(), csl::PAIO::open(), csl::Port::Port(), csl::RingBuffer::RingBuffer(), csl::Window::setSize(), csl::SpatialPanner::SpatialPanner(), and csl::PAIO::test().

void Buffer::freeBuffers | ( |  | ) |
| inherited

fcn to free them

Definition at line 112 of file CSL_Core.cpp.

References csl::kLogError, csl::logMsg(), csl::Buffer::mAreBuffersAllocated, csl::Buffer::mBuffers, csl::Buffer::mDidIAllocateBuffers, csl::Buffer::mNumAlloc, csl::Buffer::mNumChannels, and csl::Buffer::mNumFrames.

Referenced by csl::Abst_SoundFile::checkBuffer(), csl::Port::checkBuffer(), csl::PAIO::close(), csl::FileIO::close(), csl::Abst_SoundFile::freeBuffer(), csl::DecodedFile::mergeBuffers(), csl::FileIO::open(), csl::PAIO::open(), csl::Window::setSize(), csl::Buffer::setSize(), csl::WavetableOscillator::setWaveform(), csl::BlockResizer::~BlockResizer(), csl::Buffer::~Buffer(), csl::Mixer::~Mixer(), csl::SpatialPanner::~SpatialPanner(), csl::WavetableOscillator::~WavetableOscillator(), and csl::Window::~Window().

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::zeroBuffers | ( |  | ) |
| inherited

fill all data with 0

Definition at line 142 of file CSL_Core.cpp.

References csl::Buffer::mAreBuffersAllocated, csl::Buffer::mAreBuffersZero, csl::Buffer::mBuffers, csl::Buffer::mMonoBufferByteSize, and csl::Buffer::mNumChannels.

Referenced by csl::Filter::clear(), csl::AmbisonicEncoder::nextBuffer(), csl::Controllable::pullInput(), and csl::FileIO::writeNextBuffer().

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
| ) |  |
| virtual inherited

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
| ) |  |
| virtual inherited

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::buffer | ( | unsigned | bufNum | ) |
| inline virtual inherited

Definition at line 134 of file CSL_Core.h.

References csl::Buffer::mBuffers.

Referenced by csl::Abst_SoundFile::buffer(), csl::Window::fillWindow(), csl::RectangularWindow::fillWindow(), csl::TriangularWindow::fillWindow(), csl::HammingWindow::fillWindow(), csl::HannWindow::fillWindow(), csl::BlackmanWindow::fillWindow(), csl::BlackmanHarrisWindow::fillWindow(), csl::WelchWindow::fillWindow(), csl::Abst_SoundFile::mergeToMono(), csl::InOut::nextBuffer(), csl::AmbisonicRotator::nextBuffer(), csl::AmbisonicEncoder::nextBuffer(), csl::AmbisonicDecoder::nextBuffer(), csl::Port::nextFrame(), csl::IntensityAttenuationCue::process(), csl::AirAbsorptionCue::process(), csl::VSTIO::processReplacing(), csl::Effect::pullInput(), csl::CASoundFile::readBufferFromFile(), RenderCallback(), csl::WavetableOscillator::setWaveform(), csl::Window::window(), and csl::DecodedFile::writeBuffer().

virtual SampleBuffer* csl::Buffer::buffers | ( |  | ) |
| inline virtual inherited

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 | ) |
| inline virtual inherited

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,
|  | SampleBuffer | sPtr
| ) |  |
| inline virtual inherited

Definition at line 138 of file CSL_Core.h.

References csl::Buffer::mBuffers.

Referenced by csl::JUCEIO::audioDeviceIOCallback(), csl::WavetableOscillator::fillSine(), csl::HRTF::HRTF(), csl::Abst_SoundFile::mergeToMono(), csl::Joiner::nextBuffer(), csl::VSTIO::processReplacing(), csl::WavetableOscillator::setWaveform(), testWaveTableFromFile(), and testWavetableInterpolation().

virtual void csl::Buffer::setBuffer | ( | unsigned | bufNum,
|  | unsigned | offset,
|  | sample | samp
| ) |  |
| inline virtual inherited

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::mNumChannels
| inherited

num channels in buffer (num mono buffers)

Definition at line 94 of file CSL_Core.h.

Referenced by csl::Buffer::allocateBuffers(), csl::Port::checkBuffer(), csl::Buffer::fillWith(), csl::Buffer::freeBuffers(), csl::AUIO::getInput(), csl::IO::getInput(), JackCallback(), csl::DecodedFile::mergeBuffers(), csl::Port::nextFrame(), RenderCallback(), csl::Buffer::setSize(), csl::Buffer::setSizeOnly(), csl::WavetableOscillator::setWaveform(), and csl::Buffer::zeroBuffers().

unsigned csl::Buffer::mNumFrames
| inherited

num frames used in each buffer

Definition at line 95 of file CSL_Core.h.

Referenced by csl::DecodedFile::addBuffer(), csl::Buffer::allocateBuffers(), csl::JUCEIO::audioDeviceIOCallback(), csl::Buffer::canStore(), csl::Abst_SoundFile::checkBuffer(), csl::Port::checkBuffer(), csl::DecodedFile::checkBufferStack(), csl::Abst_SoundFile::convertRate(), csl::CompOrCacheOscillator::createCache(), csl::MP3File::decodeMP3(), csl::RingBufferTap::duration(), csl::BufferStream::duration(), csl::Buffer::fillWith(), csl::Buffer::freeBuffers(), csl::AUIO::getInput(), csl::IO::getInput(), csl::LSoundFile::isCached(), csl::Abst_SoundFile::isCached(), JackCallback(), csl::DecodedFile::mergeBuffers(), csl::Abst_SoundFile::mergeToMono(), csl::WaveShaper::mono_next_buffer(), csl::AmbisonicRotator::nextBuffer(), csl::AmbisonicEncoder::nextBuffer(), csl::AmbisonicDecoder::nextBuffer(), pa_callback(), csl::IntensityAttenuationCue::process(), csl::AirAbsorptionCue::process(), csl::Controllable::pullInput(), RenderCallback(), csl::RingBufferTap::setOffset(), csl::Buffer::setSize(), csl::Buffer::setSizeOnly(), csl::WavetableOscillator::setWaveform(), csl::WavetableOscillator::WavetableOscillator(), csl::DecodedFile::writeBuffer(), and csl::FileIO::writeNextBuffer().

unsigned csl::Buffer::mNumAlloc
| inherited

num frames in each buffer

Definition at line 96 of file CSL_Core.h.

Referenced by csl::Buffer::allocateBuffers(), csl::Abst_SoundFile::cacheSize(), csl::Buffer::canStore(), csl::DecodedFile::checkBufferStack(), csl::Buffer::freeBuffers(), csl::Buffer::samplePtrFor(), and csl::Buffer::setSize().

unsigned csl::Buffer::mMonoBufferByteSize
| inherited

size of each buffer in bytes

Definition at line 97 of file CSL_Core.h.

Referenced by csl::Buffer::setSize(), csl::Buffer::setSizeOnly(), csl::WavetableOscillator::setWaveform(), csl::UnitGenerator::zeroBuffer(), and csl::Buffer::zeroBuffers().

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::mAreBuffersAllocated
| inherited

are the buffers allocated?

Definition at line 101 of file CSL_Core.h.

Referenced by csl::Buffer::allocateBuffers(), csl::Abst_SoundFile::checkBuffer(), csl::Buffer::checkBuffers(), csl::PAIO::close(), csl::FileIO::close(), csl::WavetableOscillator::fillSine(), csl::Abst_SoundFile::freeBuffer(), csl::Buffer::freeBuffers(), csl::Abst_SoundFile::mergeToMono(), csl::FileIO::open(), csl::PAIO::open(), RenderCallback(), csl::Buffer::setSize(), csl::WavetableOscillator::setWaveform(), testWavetableInterpolation(), and csl::Buffer::zeroBuffers().

bool csl::Buffer::mDidIAllocateBuffers
| inherited

who allocated my data buffers?

Definition at line 102 of file CSL_Core.h.

Referenced by csl::Buffer::allocateBuffers(), csl::WavetableOscillator::fillSine(), csl::Buffer::freeBuffers(), csl::Abst_SoundFile::mergeToMono(), RenderCallback(), csl::Buffer::setSize(), csl::WavetableOscillator::setWaveform(), and csl::Buffer::~Buffer().

bool csl::Buffer::mIsPopulated
| inherited

does the buffer have data?

Definition at line 103 of file CSL_Core.h.

Referenced by csl::AmbisonicRotator::nextBuffer(), csl::AmbisonicEncoder::nextBuffer(), csl::AmbisonicDecoder::nextBuffer(), csl::Controllable::pullInput(), RenderCallback(), csl::Buffer::setSize(), and csl::WavetableOscillator::setWaveform().

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
| protected inherited

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

the storage vector – pointers to (SampleBuffer) buffers

Definition at line 139 of file CSL_Core.h.

Referenced by csl::Buffer::allocateBuffers(), csl::Buffer::buffer(), csl::Buffer::buffers(), csl::Buffer::fillWith(), csl::Buffer::freeBuffers(), csl::WaveShaper::mono_next_buffer(), csl::Buffer::monoBuffer(), monoBuffer(), RenderCallback(), csl::Buffer::samplePtrFor(), csl::Buffer::setBuffer(), csl::Buffer::setBuffers(), csl::Buffer::setSize(), and csl::Buffer::zeroBuffers().

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

- CSL/Kernel/CSL_Core.h
- CSL/Kernel/CSL_Core.cpp