CSL
6.0
|
BufferCMap is a Sample buffer with channel map and count. More...
#include <CSL_Core.h>
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 SampleBuffer * | buffers () |
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... | |
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.
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.
|
inlinevirtual |
Pointer accessor uses channel map.
Reimplemented from csl::Buffer.
Definition at line 202 of file CSL_Core.h.
References csl::Buffer::mBuffers.
|
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.
|
inherited |
Definition at line 75 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(), CSLServerComponent::audioDeviceIOCallback(), CSLMIDIComponent::audioDeviceIOCallback(), CSLAbstComponent::audioDeviceIOCallback(), csl::BlockResizer::BlockResizer(), csl::Buffer::Buffer(), csl::IO::capture_off(), csl::IO::capture_on(), csl::Abst_SoundFile::checkBuffer(), csl::Port::checkBuffer(), csl::DelayLine::DelayLine(), csl::WavetableOscillator::fillSine(), csl::KarplusString::initDelayLine(), csl::PAIO::initialize(), csl::WaveShaper::initWaveTable(), csl::FileIO::open(), csl::VSTIO::processReplacing(), csl::Window::setSize(), csl::SpatialPanner::SpatialPanner(), and csl::WavetableOscillator::WavetableOscillator().
|
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.
|
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().
|
inherited |
fcn to malloc storage buffers
Definition at line 122 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::UnitGenerator::addOutput(), csl::Mixer::allocateOpBuffer(), csl::BinauralPanner::BinauralPanner(), csl::BlockResizer::BlockResizer(), csl::IO::capture_on(), csl::Abst_SoundFile::checkBuffer(), csl::Port::checkBuffer(), csl::Buffer::checkBuffers(), csl::CompOrCacheOscillator::createCache(), csl::FFT::FFT(), csl::WavetableOscillator::fillSine(), csl::Filter::init(), csl::RemoteIO::init_io(), csl::KarplusString::initDelayLine(), csl::AmbisonicMixer::initialize(), csl::WaveShaper::initWaveTable(), csl::Abst_SoundFile::mergeToMono(), csl::FileIO::open(), csl::PAIO::open(), csl::Port::Port(), CSLServerComponent::recordOnOff(), CSLAbstComponent::recordOnOff(), CSLComponent::recordOnOff(), csl::RingBuffer::RingBuffer(), csl::Window::setSize(), csl::SpatialPanner::SpatialPanner(), and csl::PAIO::test().
|
inherited |
fcn to free them
Definition at line 141 of file CSL_Core.cpp.
References csl::kLogError, csl::logMsg(), csl::Buffer::mAreBuffersAllocated, csl::Buffer::mBuffers, csl::Buffer::mDidIAllocateBuffers, csl::Buffer::mMonoBufferByteSize, 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::FileIO::open(), csl::PAIO::open(), csl::Window::setSize(), csl::Buffer::setSize(), csl::WavetableOscillator::setWaveform(), csl::BlockResizer::~BlockResizer(), csl::Buffer::~Buffer(), CSLAbstComponent::~CSLAbstComponent(), CSLComponent::~CSLComponent(), CSLServerComponent::~CSLServerComponent(), csl::Mixer::~Mixer(), csl::SpatialPanner::~SpatialPanner(), csl::WavetableOscillator::~WavetableOscillator(), and csl::Window::~Window().
|
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.
|
inherited |
fill all data with 0
Definition at line 173 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().
|
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.
|
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.
|
inherited |
Definition at line 250 of file CSL_Core.cpp.
Referenced by csl::Abst_SoundFile::mergeToMono(), and csl::Buffer::readFromFile().
|
inherited |
copy the "header" fields of a buffer
Definition at line 235 of file CSL_Core.cpp.
References csl::logMsg().
|
inherited |
import data from the given buffer
Definition at line 270 of file CSL_Core.cpp.
References csl_min, csl::kLogError, and csl::logMsg().
|
inherited |
same with write offset
Definition at line 300 of file CSL_Core.cpp.
References csl_min, csl::kLogError, and csl::logMsg().
|
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().
|
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.
|
inherited |
convert the sample rate using libSampleRate
Referenced by csl::Abst_SoundFile::convertRate().
|
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.
|
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.
|
inlinevirtualinherited |
Definition at line 155 of file CSL_Core.h.
References csl::Buffer::mBuffers.
Referenced by csl::JSoundFile::readBufferFromFile(), and csl::WavetableOscillator::setWaveform().
|
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().
|
inlinevirtualinherited |
Definition at line 158 of file CSL_Core.h.
References csl::Buffer::mBuffers.
Referenced by csl::JUCEIO::audioDeviceIOCallback(), CSLAbstComponent::audioDeviceIOCallback(), csl::WavetableOscillator::fillSine(), csl::HRTF::HRTF(), csl::Abst_SoundFile::mergeToMono(), csl::Joiner::nextBuffer(), csl::VSTIO::processReplacing(), csl::Convolver2::setIRData(), csl::WavetableOscillator::setWaveform(), testWaveTableFromFile(), and testWavetableInterpolation().
|
inlinevirtualinherited |
Definition at line 159 of file CSL_Core.h.
References csl::Buffer::mBuffers.
|
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.
|
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.
|
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().
|
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.
|
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.
|
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.
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().
|
inherited |
num channels in buffer (num mono buffers)
Definition at line 112 of file CSL_Core.h.
Referenced by csl::Buffer::allocateBuffers(), csl::Buffer::avg(), csl::Buffer::buffer(), csl::Port::checkBuffer(), csl::Buffer::fillWith(), csl::Buffer::freeBuffers(), csl::AUIO::getInput(), csl::IO::getInput(), JackCallback(), csl::Buffer::max(), csl::Buffer::min(), csl::Port::nextFrame(), csl::Buffer::normalize(), RenderCallback(), csl::Buffer::rms(), csl::Buffer::scaleBy(), csl::Buffer::setSize(), csl::Buffer::setSizeOnly(), csl::WavetableOscillator::setWaveform(), and csl::Buffer::zeroBuffers().
|
inherited |
num frames used in each buffer
Definition at line 113 of file CSL_Core.h.
Referenced by csl::Buffer::allocateBuffers(), csl::JUCEIO::audioDeviceIOCallback(), CSLServerComponent::audioDeviceIOCallback(), CSLAbstComponent::audioDeviceIOCallback(), CSLComponent::audioDeviceIOCallback(), csl::Buffer::avg(), csl::Buffer::canStore(), csl::Abst_SoundFile::checkBuffer(), csl::Port::checkBuffer(), csl::Abst_SoundFile::convertRate(), csl::CompOrCacheOscillator::createCache(), csl::RingBufferTap::duration(), csl::Buffer::duration(), csl::Buffer::fillWith(), csl::Buffer::freeBuffers(), csl::AUIO::getInput(), csl::IO::getInput(), csl::LSoundFile::isCached(), csl::Abst_SoundFile::isCached(), JackCallback(), csl::Buffer::max(), csl::Abst_SoundFile::mergeToMono(), csl::Buffer::min(), csl::AmbisonicRotator::nextBuffer(), csl::AmbisonicEncoder::nextBuffer(), csl::AmbisonicDecoder::nextBuffer(), csl::Buffer::normalize(), pa_callback(), csl::IntensityAttenuationCue::process(), csl::AirAbsorptionCue::process(), csl::Controllable::pullInput(), csl::Buffer::readFromFile(), CSLServerComponent::recordOnOff(), CSLAbstComponent::recordOnOff(), CSLComponent::recordOnOff(), RenderCallback(), csl::Buffer::rms(), csl::Buffer::scaleBy(), csl::RingBufferTap::setOffset(), csl::Buffer::setSize(), csl::Buffer::setSizeOnly(), csl::WavetableOscillator::setWaveform(), csl::WavetableOscillator::WavetableOscillator(), and csl::FileIO::writeNextBuffer().
|
inherited |
num frames in each buffer
Definition at line 114 of file CSL_Core.h.
Referenced by csl::Buffer::allocateBuffers(), csl::Abst_SoundFile::cacheSize(), csl::Buffer::canStore(), csl::Buffer::freeBuffers(), csl::Buffer::samplePtrFor(), csl::Buffer::setSize(), and csl::WavetableOscillator::setWaveform().
|
inherited |
size of each buffer in bytes
Definition at line 115 of file CSL_Core.h.
Referenced by csl::Buffer::freeBuffers(), csl::Buffer::setSize(), csl::Buffer::setSizeOnly(), csl::WavetableOscillator::setWaveform(), csl::UnitGenerator::zeroBuffer(), and csl::Buffer::zeroBuffers().
|
inherited |
sequential serial number
Definition at line 116 of file CSL_Core.h.
|
inherited |
the buffer's most recent timestamp
Definition at line 117 of file CSL_Core.h.
|
inherited |
are the buffers allocated?
Definition at line 120 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().
|
inherited |
who allocated my data buffers?
Definition at line 121 of file CSL_Core.h.
Referenced by csl::Buffer::allocateBuffers(), csl::WavetableOscillator::fillSine(), csl::Buffer::freeBuffers(), load_filter_data(), csl::Abst_SoundFile::mergeToMono(), csl::Buffer::readFromFile(), RenderCallback(), csl::Buffer::setSize(), csl::WavetableOscillator::setWaveform(), and csl::Buffer::~Buffer().
|
inherited |
does the buffer have data?
Definition at line 122 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().
|
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().
|
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().
|
protectedinherited |
the storage vector – pointers to (SampleBuffer) buffers
Definition at line 182 of file CSL_Core.h.
Referenced by csl::Buffer::allocateBuffers(), CSLServerComponent::audioDeviceIOCallback(), CSLMIDIComponent::audioDeviceIOCallback(), csl::Buffer::avg(), csl::Buffer::buffer(), buffer(), csl::Buffer::buffers(), csl::Buffer::fillWith(), csl::Buffer::freeBuffers(), csl::Buffer::max(), csl::Buffer::min(), csl::Buffer::normalize(), RenderCallback(), csl::Buffer::rms(), csl::Buffer::samplePtrFor(), csl::Buffer::scaleBy(), csl::Buffer::setBuffer(), csl::Buffer::setBuffers(), csl::Buffer::setSize(), and csl::Buffer::zeroBuffers().