CSL  5.2
csl::RingBuffer Class Reference

RingBuffer is the storage + a default reader. More...

#include <RingBuffer.h>

+ Inheritance diagram for csl::RingBuffer:

List of all members.

Public Member Functions

 RingBuffer ()
 Constructors.
 RingBuffer (unsigned int nmChannels, unsigned int nmFrames)
 RingBuffer (UnitGenerator &input, unsigned int nmChannels, unsigned int nmFrames)
unsigned seekTo (int position) throw (CException)
void setLoopStart (unsigned frame)
 These loop setters allow for variable buffer lengths by varying the points where the buffer writes.
void setLoopEnd (unsigned frame)
 Calls the setLoopStart of it's tap.
void nextBuffer (Buffer &outputBuffer) throw (CException)
 Calls the setLoopEnd of it's tap.
void writeBuffer (Buffer &inputBuffer) throw (CException)
 Write a buffer of data into the ring buffer.
void sumIntoBuffer (Buffer &inputBuffer) throw (CException)
 Do an adding write of data into the ring buffer.
void destructiveNextBuffer (Buffer &outputBuffer) throw (CException)
 Read a buffer zeroing as you go.
void writeBuffer (Buffer &inputBuffer, unsigned bufNum) throw (CException)
 write to the receiver
void sumIntoBuffer (Buffer &inputBuffer, unsigned bufNum) throw (CException)
virtual bool isActive ()
 am I active?
void setInput (UnitGenerator &inp)
 set the receiver's input generator
void setInline ()
 set the Effect to be inline
unsigned frameRate ()
void setFrameRate (unsigned rate)
 get/set the receiver's frame rate
virtual unsigned numChannels ()
void setNumChannels (unsigned ch)
 get/set the receiver's number of outputs
BufferCopyPolicy copyPolicy ()
void setCopyPolicy (BufferCopyPolicy ch)
 get/set the receiver's buffer copy policy
virtual void nextBuffer (Buffer &outputBuffer, unsigned outBufNum) throw (CException)
 really compute the next buffer given an offset base channel; this is called by nextBuffer, possibly multiple times
virtual bool isFixed ()
 query whether I'm fixed (StaticVariable overrides this)
void addOutput (UnitGenerator *ugen)
 add to or return the UGen vector of outputs
void removeOutput (UnitGenerator *ugen)
UGenVector outputs ()
virtual unsigned numOutputs ()
bool checkFanOut (Buffer &outputBuffer) throw (CException)
 check for fan-out and copy previous buffer; return true if fanning out
void handleFanOut (Buffer &outputBuffer) throw (CException)
virtual void setValue (sample theValue)
 set/get the value (not allowed in the abstract, useful for static values)
virtual sample value ()
virtual void dump ()
 pretty-print the receiver
void attachObserver (Observer *)
 (possibly notify obersvers on my death)
void detachObserver (Observer *)
void changed (void *argument)
 this is what I send to myself to notify my observers; It's not overridden in general. It results in the observers receiving update() calls < override evaluate to filter updates to the observer map
virtual int evaluate (void *argument)
PortgetPort (CSL_MAP_KEY name)
void setScale (UnitGenerator &scale)
 set the receiver's scale member to a UGen or a float
void setScale (float scale)
void setOffset (UnitGenerator &offset)
 set the receiver's offset member to a UGen or a float
void setOffset (float offset)
virtual void trigger ()
 trigger passed on here
void isScaled ()
 answer whether scale = 1 & offset = 0

Public Attributes

unsigned mCurrentWriteFrame
 state – users can manipulate my internal tap and buffer
Buffer mBuffer
RingBufferTap mTap
 internal tap so a RingBuffer can also be a a UnitGenerator
bool isInline
 whether to use input or buffer as source

Protected Member Functions

void pullInput (Buffer &outputBuffer) throw (CException)
void pullInput (unsigned numFrames) throw (CException)
 trigger passed on here
void pullInput (Port *thePort, unsigned numFrames) throw (CException)
 method to read the control values (in case they're dynamic). this sends nextBuffer() to the input.
void pullInput (Port *thePort, Buffer &theBuffer) throw (CException)
virtual void trigger ()
 trigger passed on here get the input port
PortinPort ()
virtual void dump ()
 pretty-print the receiver's input/controls map
void zeroBuffer (Buffer &outputBuffer, unsigned outBufNum)
 utility method to zero out an outputBuffer
void addInput (CSL_MAP_KEY name, UnitGenerator &ugen)
 Plug in a unit generator to the named input slot.
void addInput (CSL_MAP_KEY name, float value)
 Plug in a float to the named input slot.

Protected Attributes

unsigned mTempCurrentWriteFrame
 Used in next buffer to save state between calls in the same block.
SampleBuffer mInputPtr
 A pointer to my input's data. method to read the input value.
unsigned mFrameRate
 trigger ignored here
unsigned mNumChannels
 my "expected" number of output channels
BufferCopyPolicy mCopyPolicy
 the policy I use if asked for more or fewer channels
UGenVector mOutputs
 the vector of my output UGens
unsigned mNumOutputs
 the number of outputs
BuffermOutputCache
 my past output ring buffer (only used in case of fan-out)
unsigned mSequence
 the highest-seen buffer seq number
PortMap mInputs
 the map of my inputs or controls (used by the mix-in classes)

Friends

class RingBufferTap
 Allow the RingBufferTap to access private members of this class.

Detailed Description

RingBuffer is the storage + a default reader.

Definition at line 56 of file RingBuffer.h.


Constructor & Destructor Documentation

RingBuffer::RingBuffer ( )

Constructors.

Definition at line 163 of file RingBuffer.cpp.

References mTap, and csl::RingBufferTap::setBuffer().

RingBuffer::RingBuffer ( unsigned int  nmChannels,
unsigned int  nmFrames 
)
RingBuffer::RingBuffer ( UnitGenerator input,
unsigned int  nmChannels,
unsigned int  nmFrames 
)

Member Function Documentation

unsigned RingBuffer::seekTo ( int  position) throw (CException)

Definition at line 213 of file RingBuffer.cpp.

void csl::RingBuffer::setLoopStart ( unsigned  frame)
inline

These loop setters allow for variable buffer lengths by varying the points where the buffer writes.

Definition at line 73 of file RingBuffer.h.

References mTap, and csl::RingBufferTap::setLoopStart().

void csl::RingBuffer::setLoopEnd ( unsigned  frame)
inline

Calls the setLoopStart of it's tap.

Definition at line 74 of file RingBuffer.h.

References mTap, and csl::RingBufferTap::setLoopEnd().

void RingBuffer::nextBuffer ( Buffer outputBuffer) throw (CException)
virtual

Calls the setLoopEnd of it's tap.

Various flavours of next buffer. Also the nextBuffer(Buffer &) has to be implemented to be able to hold state of the currentWriteFrame. Otherwise every time it's called by the super nextBuffer the currentWriteFrame would be incremented more and more, leading to erroneous results. Read a buffer from the ring buffer

Reimplemented from csl::UnitGenerator.

Definition at line 187 of file RingBuffer.cpp.

References CSL_INPUT, and csl::Effect::pullInput().

void RingBuffer::writeBuffer ( Buffer inputBuffer) throw (CException)
virtual

Write a buffer of data into the ring buffer.

Reimplemented from csl::Writeable.

Definition at line 199 of file RingBuffer.cpp.

References csl::Writeable::writeBuffer().

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

void RingBuffer::sumIntoBuffer ( Buffer inputBuffer) throw (CException)

Do an adding write of data into the ring buffer.

Definition at line 205 of file RingBuffer.cpp.

void RingBuffer::destructiveNextBuffer ( Buffer outputBuffer) throw (CException)

Read a buffer zeroing as you go.

Definition at line 195 of file RingBuffer.cpp.

void RingBuffer::writeBuffer ( Buffer inputBuffer,
unsigned  bufNum 
) throw (CException)
virtual

write to the receiver

Reimplemented from csl::Writeable.

Definition at line 225 of file RingBuffer.cpp.

References memcpy().

void RingBuffer::sumIntoBuffer ( Buffer inputBuffer,
unsigned  bufNum 
) throw (CException)

Definition at line 259 of file RingBuffer.cpp.

bool Effect::isActive ( )
virtualinherited

am I active?

Reimplemented from csl::UnitGenerator.

Reimplemented in csl::Joiner, and csl::Stereoverb.

Definition at line 951 of file CSL_Core.cpp.

References CSL_INPUT, csl::Port::isActive(), and csl::Controllable::mInputs.

Referenced by csl::Stereoverb::isActive().

void Effect::setInput ( UnitGenerator inp)
inherited

set the receiver's input generator

Definition at line 958 of file CSL_Core.cpp.

References csl::Controllable::addInput(), CSL_INPUT, csl::Effect::isInline, and csl::logMsg().

void csl::Effect::setInline ( )
inlineinherited

set the Effect to be inline

Definition at line 446 of file CSL_Core.h.

References csl::Effect::isInline.

void Effect::pullInput ( unsigned  numFrames) throw (CException)
protectedinherited

trigger passed on here

Definition at line 983 of file CSL_Core.cpp.

References csl::Buffer::buffer(), CSL_INPUT, csl::logMsg(), csl::Port::mBuffer, and csl::Controllable::pullInput().

void Controllable::pullInput ( Port thePort,
unsigned  numFrames 
) throw (CException)
protectedinherited

method to read the control values (in case they're dynamic). this sends nextBuffer() to the input.

Definition at line 695 of file CSL_Core.cpp.

References csl::kSamples, csl::logMsg(), csl::Buffer::mIsPopulated, csl::Buffer::mNumFrames, csl::Buffer::mType, csl::UnitGenerator::nextBuffer(), and csl::Buffer::zeroBuffers().

Referenced by csl::Panner::nextBuffer(), csl::NtoMPanner::nextBuffer(), and csl::Effect::pullInput().

void Controllable::pullInput ( Port thePort,
Buffer theBuffer 
) throw (CException)
protectedinherited

Definition at line 727 of file CSL_Core.cpp.

References csl::UnitGenerator::nextBuffer().

void Effect::trigger ( void  )
protectedvirtualinherited

trigger passed on here get the input port

Reimplemented from csl::UnitGenerator.

Reimplemented in csl::Joiner.

Definition at line 994 of file CSL_Core.cpp.

References CSL_INPUT, and csl::Controllable::mInputs.

Port* csl::Effect::inPort ( )
inlineprotectedinherited

Definition at line 455 of file CSL_Core.h.

References CSL_INPUT, and csl::Controllable::mInputs.

Referenced by csl::BinaryOp::dump(), and csl::BinaryOp::inputIsFixed().

void csl::UnitGenerator::setFrameRate ( unsigned  rate)
inlineinherited

get/set the receiver's frame rate

Definition at line 226 of file CSL_Core.h.

References csl::UnitGenerator::mFrameRate.

Referenced by m3_header().

void csl::UnitGenerator::setNumChannels ( unsigned  ch)
inlineinherited
BufferCopyPolicy csl::UnitGenerator::copyPolicy ( )
inlineinherited

Definition at line 231 of file CSL_Core.h.

References csl::UnitGenerator::mCopyPolicy.

void csl::UnitGenerator::setCopyPolicy ( BufferCopyPolicy  ch)
inlineinherited
virtual bool csl::UnitGenerator::isFixed ( )
inlinevirtualinherited

query whether I'm fixed (StaticVariable overrides this)

Reimplemented in csl::StaticVariable, and csl::BinaryOp.

Definition at line 247 of file CSL_Core.h.

UGenVector csl::UnitGenerator::outputs ( )
inlineinherited

Definition at line 253 of file CSL_Core.h.

References csl::UnitGenerator::mOutputs.

virtual unsigned csl::UnitGenerator::numOutputs ( )
inlinevirtualinherited

Definition at line 254 of file CSL_Core.h.

References csl::UnitGenerator::mNumOutputs.

bool UnitGenerator::checkFanOut ( Buffer outputBuffer) throw (CException)
inherited

check for fan-out and copy previous buffer; return true if fanning out

Definition at line 549 of file CSL_Core.cpp.

void UnitGenerator::handleFanOut ( Buffer outputBuffer) throw (CException)
inherited

Definition at line 563 of file CSL_Core.cpp.

References csl_max.

virtual void csl::UnitGenerator::setValue ( sample  theValue)
inlinevirtualinherited

set/get the value (not allowed in the abstract, useful for static values)

Reimplemented in csl::DynamicVariable, and csl::StaticVariable.

Definition at line 260 of file CSL_Core.h.

virtual sample csl::UnitGenerator::value ( )
inlinevirtualinherited

Reimplemented in csl::StaticVariable.

Definition at line 261 of file CSL_Core.h.

void Controllable::dump ( void  )
protectedvirtualinherited
void UnitGenerator::zeroBuffer ( Buffer outputBuffer,
unsigned  outBufNum 
)
protectedinherited

utility method to zero out an outputBuffer

Definition at line 513 of file CSL_Core.cpp.

References csl::Buffer::mMonoBufferByteSize, and csl::Buffer::monoBuffer().

void Model::attachObserver ( Observer o)
inherited

(possibly notify obersvers on my death)

register/remove observers

Definition at line 491 of file CGestalt.cpp.

References csl::logMsg(), csl::Observer::mKey, and csl::Observer::mPeriod.

Referenced by csl::SpatialPanner::setSpeakerLayout().

void Model::detachObserver ( Observer o)
inherited
void Model::changed ( void *  argument)
inherited

this is what I send to myself to notify my observers; It's not overridden in general. It results in the observers receiving update() calls < override evaluate to filter updates to the observer map

Definition at line 529 of file CGestalt.cpp.

References csl::logMsg().

Referenced by csl::SpeakerLayout::addSpeaker(), csl::MIDIIn::handleIncomingMidiMessage(), and csl::SpeakerLayout::setDefaultSpeakerLayout().

virtual int csl::Model::evaluate ( void *  argument)
inlinevirtualinherited

Reimplemented in csl::MIDIIn.

Definition at line 259 of file CGestalt.h.

Port * Controllable::getPort ( CSL_MAP_KEY  name)
inherited
void Controllable::addInput ( CSL_MAP_KEY  name,
float  value 
)
protectedinherited

Plug in a float to the named input slot.

Definition at line 754 of file CSL_Core.cpp.

References csl::logMsg(), csl::Controllable::mInputs, and csl::Port::mValue.

void Scalable::setScale ( float  scale)
inherited

Definition at line 894 of file CSL_Core.cpp.

References csl::Controllable::addInput(), CSL_SCALE, and csl::logMsg().

void Scalable::setOffset ( UnitGenerator offset)
inherited

set the receiver's offset member to a UGen or a float

Definition at line 901 of file CSL_Core.cpp.

References csl::Controllable::addInput(), CSL_OFFSET, and csl::logMsg().

void Scalable::setOffset ( float  offset)
inherited

Reimplemented in csl::RandEnvelope.

Definition at line 908 of file CSL_Core.cpp.

References csl::Controllable::addInput(), CSL_OFFSET, and csl::logMsg().

void Scalable::trigger ( void  )
virtualinherited

trigger passed on here

Reimplemented in csl::RandEnvelope, csl::Abst_SoundFile, csl::Envelope, and csl::KarplusString.

Definition at line 917 of file CSL_Core.cpp.

References CSL_OFFSET, CSL_SCALE, and csl::Controllable::mInputs.

void csl::Scalable::isScaled ( )
inherited

answer whether scale = 1 & offset = 0


Friends And Related Function Documentation

friend class RingBufferTap
friend

Allow the RingBufferTap to access private members of this class.

Definition at line 59 of file RingBuffer.h.


Member Data Documentation

unsigned csl::RingBuffer::mCurrentWriteFrame

state – users can manipulate my internal tap and buffer

Definition at line 65 of file RingBuffer.h.

Referenced by csl::DelayLine::delayLength(), and csl::RingBufferTap::setOffset().

Buffer csl::RingBuffer::mBuffer
unsigned csl::RingBuffer::mTempCurrentWriteFrame
protected

Used in next buffer to save state between calls in the same block.

Definition at line 87 of file RingBuffer.h.

bool csl::Effect::isInline
inherited

whether to use input or buffer as source

Definition at line 445 of file CSL_Core.h.

Referenced by csl::Effect::Effect(), csl::Effect::setInline(), and csl::Effect::setInput().

SampleBuffer csl::Effect::mInputPtr
protectedinherited

A pointer to my input's data. method to read the input value.

Definition at line 449 of file CSL_Core.h.

unsigned csl::UnitGenerator::mNumChannels
protectedinherited
BufferCopyPolicy csl::UnitGenerator::mCopyPolicy
protectedinherited

the policy I use if asked for more or fewer channels

Definition at line 269 of file CSL_Core.h.

Referenced by csl::UnitGenerator::copyPolicy(), and csl::UnitGenerator::setCopyPolicy().

UGenVector csl::UnitGenerator::mOutputs
protectedinherited
unsigned csl::UnitGenerator::mNumOutputs
protectedinherited

the number of outputs

Definition at line 271 of file CSL_Core.h.

Referenced by csl::UnitGenerator::addOutput(), csl::UnitGenerator::numOutputs(), and csl::UnitGenerator::removeOutput().

Buffer* csl::UnitGenerator::mOutputCache
protectedinherited

my past output ring buffer (only used in case of fan-out)

Definition at line 272 of file CSL_Core.h.

Referenced by csl::UnitGenerator::addOutput().

unsigned csl::UnitGenerator::mSequence
protectedinherited

the highest-seen buffer seq number

Definition at line 273 of file CSL_Core.h.


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