csl::UnitGenerator Class Reference

forward declaration More...

#include <CSL_Core.h>

Inheritance diagram for csl::UnitGenerator:

csl::Model csl::AmbisonicUnitGenerator csl::BlockResizer csl::BufferStream csl::DelayLine csl::Effect csl::Envelope csl::GrainPlayer csl::IFFT csl::Instrument csl::KarplusString csl::LineSegment csl::Lorenz csl::Microphone csl::Mixer csl::Noise csl::Oscillator csl::RemoteStream csl::RingBufferTap csl::RtpReceiver csl::SimpleSine csl::SineAsPhased csl::SineAsScaled csl::SoundCue csl::Spatializer csl::SpatialPanner csl::SpatialSource csl::StaticVariable csl::Window

List of all members.

Public Member Functions

 UnitGenerator (unsigned rate=CGestalt::frameRate(), unsigned chans=1)
virtual ~UnitGenerator ()
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) throw (CException)
virtual void nextBuffer (Buffer &outputBuffer, unsigned outBufNum) throw (CException)
virtual bool isFixed ()
 query whether I'm fixed (StaticVariable overrides this)
virtual bool isActive ()
 query whether I'm currently active (Envelopes can go inactive)
void addOutput (UnitGenerator *ugen)
 add to or return the UGen vector of outputs
void removeOutput (UnitGenerator *ugen)
UGenVector outputs ()
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

Protected Member Functions

void zeroBuffer (Buffer &outputBuffer, unsigned outBufNum)
 utility method to zero out an outputBuffer

Protected Attributes

unsigned mFrameRate
 the frame rate -- initialized to be the default by the constructor
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
 my past output ring buffer (only used in case of fan-out)
unsigned mSequence
 the highest-seen buffer seq number

Detailed Description

forward declaration

UnitGenerator -- the core of CSL; all unit generators inherit from this class.

These have members for their sample rate and number of channels, and know their outputs. The main operation is the nextBuffer() method, which is overridden in many of the subclasses.

If more than 1 output is used, these can handle fan-out automatically, either synchronous (as in loops in a graph) or async (as in separate call-back threads). The mOutputCache RingBuffer may hold some large number of past samples, and can use nextBuffer() to do n-way fan-out either synchronously or with differing buffer sizes or callback rates.

UnitGenerator inherits from Model, meaning that it has to send this->changed((void *) dataBuffer) from within its nextBuffer method so that dependent objects (like signal views) can get notification when it computes samples. This mechanism could also be used for signal flow.

Constructor & Destructor Documentation

UnitGenerator::UnitGenerator ( unsigned  rate = CGestalt::frameRate(),
unsigned  chans = 1 

Constructors (UGens are mono by default) defaults to mono and maxBlockSize if not specified.

virtual csl::UnitGenerator::~UnitGenerator (  )  [inline, virtual]


Member Function Documentation

unsigned csl::UnitGenerator::frameRate (  )  [inline]

void csl::UnitGenerator::setFrameRate ( unsigned  rate  )  [inline]

get/set the receiver's frame rate

References mFrameRate.

virtual unsigned csl::UnitGenerator::numChannels (  )  [inline, virtual]

void csl::UnitGenerator::setNumChannels ( unsigned  ch  )  [inline]

BufferCopyPolicy csl::UnitGenerator::copyPolicy (  )  [inline]

References mCopyPolicy.

void csl::UnitGenerator::setCopyPolicy ( BufferCopyPolicy  ch  )  [inline]

void UnitGenerator::nextBuffer ( Buffer outputBuffer  )  throw (CException) [virtual]

void UnitGenerator::nextBuffer ( Buffer outputBuffer,
unsigned  outBufNum 
) throw (CException) [virtual]

virtual bool csl::UnitGenerator::isFixed (  )  [inline, virtual]

query whether I'm fixed (StaticVariable overrides this)

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

virtual bool csl::UnitGenerator::isActive (  )  [inline, virtual]

void UnitGenerator::addOutput ( UnitGenerator ugen  ) 

void UnitGenerator::removeOutput ( UnitGenerator ugen  ) 

UGenVector csl::UnitGenerator::outputs (  )  [inline]

References mOutputs.

virtual void csl::UnitGenerator::setValue ( sample  theValue  )  [inline, virtual]

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

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

virtual sample csl::UnitGenerator::value (  )  [inline, virtual]

Reimplemented in csl::StaticVariable.

void UnitGenerator::dump ( void   )  [virtual]

void UnitGenerator::zeroBuffer ( Buffer outputBuffer,
unsigned  outBufNum 
) [protected]

utility method to zero out an outputBuffer

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

Member Data Documentation

unsigned csl::UnitGenerator::mFrameRate [protected]

unsigned csl::UnitGenerator::mNumChannels [protected]

the policy I use if asked for more or fewer channels

Referenced by copyPolicy(), csl::LPCAnalyzer::LPCAnalyzer(), csl::LPCFilter::LPCFilter(), and setCopyPolicy().

the vector of my output UGens

Reimplemented in csl::FanOut.

Referenced by addOutput(), dump(), outputs(), and removeOutput().

unsigned csl::UnitGenerator::mNumOutputs [protected]

the number of outputs

Referenced by addOutput(), and removeOutput().

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

Referenced by addOutput().

unsigned csl::UnitGenerator::mSequence [protected]

the highest-seen buffer seq number

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

Generated on Thu Sep 17 23:14:17 2009 for CSL by  doxygen 1.5.8