#include <CSL_Core.h>

Public Member Functions | |
| UnitGenerator (unsigned rate=CGestalt::frameRate(), unsigned chans=1) | |
| virtual | ~UnitGenerator () |
| Destructor. | |
| 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 | |
| RingBuffer * | mOutputCache |
| my past output ring buffer (only used in case of fan-out) | |
| unsigned | mSequence |
| the highest-seen buffer seq number | |
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.
| 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] |
Destructor.
| unsigned csl::UnitGenerator::frameRate | ( | ) | [inline] |
References mFrameRate.
Referenced by csl::CASoundFile::dump(), csl::SoundCue::dump(), csl::Abst_SoundFile::dump(), and csl::Filter::init().
| void csl::UnitGenerator::setFrameRate | ( | unsigned | rate | ) | [inline] |
| virtual unsigned csl::UnitGenerator::numChannels | ( | ) | [inline, virtual] |
References mNumChannels.
Referenced by csl::AmbisonicMixer::addInput(), csl::AmbisonicDecoder::asPseudoInverse(), csl::BlockResizer::BlockResizer(), csl::AmbisonicUnitGenerator::channelIndexer(), csl::Port::checkBuffer(), csl::AmbisonicRotator::initialize(), csl::AmbisonicDecoder::initialize(), csl::AmbisonicUnitGenerator::invChannelIndexer(), and csl::Mixer::nextBuffer().
| void csl::UnitGenerator::setNumChannels | ( | unsigned | ch | ) | [inline] |
get/set the receiver's number of outputs
References mNumChannels.
Referenced by csl::BinauralPanner::BinauralPanner(), csl::Spatializer::Spatializer(), csl::VBAP::speakerLayoutChanged(), and csl::VBAP::VBAP().
| BufferCopyPolicy csl::UnitGenerator::copyPolicy | ( | ) | [inline] |
References mCopyPolicy.
| void csl::UnitGenerator::setCopyPolicy | ( | BufferCopyPolicy | ch | ) | [inline] |
get/set the receiver's buffer copy policy
References mCopyPolicy.
Referenced by csl::AmbisonicPanner::AmbisonicPanner(), csl::BinauralPanner::BinauralPanner(), csl::AmbisonicUnitGenerator::initOrder(), csl::Noise::Noise(), csl::PinkNoise::PinkNoise(), csl::Spatializer::Spatializer(), and csl::VBAP::VBAP().
| void UnitGenerator::nextBuffer | ( | Buffer & | outputBuffer | ) | throw (CException) [virtual] |
get a buffer of Frames -- this is the core CSL "pull" function; the given buffer can be written into, and a changed() message is sent.
Reimplemented in csl::Instrument, csl::Microphone, csl::RemoteStream, csl::Abst_SoundFile, csl::SoundCue, csl::LSoundFile, csl::FanOut, csl::Splitter, csl::Joiner, csl::RingBufferTap, csl::RingBuffer, csl::BufferStream, csl::Stereoverb, csl::InOut, csl::Mixer, csl::Panner, csl::NtoMPanner, csl::StereoWidth, csl::DelayLine, csl::GrainPlayer, csl::FFT, csl::IFFT, csl::SpatialSource, csl::DelayLine, and csl::BlockResizer.
References csl_max, csl::kCopy, csl::kExpand, csl::kIgnore, and csl::logMsg().
Referenced by csl::SpatialSource::nextBuffer(), csl::DistanceSimulator::nextBuffer(), csl::AmbisonicMixer::nextBuffer(), csl::Mixer::nextBuffer(), csl::BufferStream::nextBuffer(), csl::RingBufferTap::nextBuffer(), csl::Controllable::pullInput(), csl::PAIO::test(), and csl::FileIO::writeNextBuffer().
| void UnitGenerator::nextBuffer | ( | Buffer & | outputBuffer, | |
| unsigned | outBufNum | |||
| ) | throw (CException) [virtual] |
really compute the next buffer given an offset base channel; this is called by nextBuffer, possibly multiple times
Reimplemented in csl::RingBufferTap, csl::BufferStream, csl::StaticVariable, csl::DynamicVariable, csl::BinaryOp, csl::AddOp, csl::MulOp, csl::Clipper, csl::Filter, csl::Moog, csl::FIR, csl::Freeverb, csl::Convolver, csl::FDN, csl::LPCAnalyzer, csl::LPCFilter, csl::RtpReceiver, csl::RtpSender, csl::LineSegment, csl::Envelope, csl::RandEnvelope, csl::KarplusString, csl::Lorenz, csl::WhiteNoise, csl::PinkNoise, csl::WavetableOscillator, csl::CompOrCacheOscillator, csl::Sine, csl::Sawtooth, csl::Square, csl::Impulse, csl::SimpleSine, csl::SineAsPhased, csl::SineAsScaled, csl::Window, csl::AmbisonicEncoder, csl::AmbisonicDecoder, csl::AmbisonicPanner, csl::AmbisonicMixer, csl::AmbisonicRotator, csl::BinauralPanner, csl::DistanceSimulator, csl::Spatializer, csl::SpatialSource, csl::VBAP, and csl::ThreadedReader.
| 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] |
query whether I'm currently active (Envelopes can go inactive)
Reimplemented in csl::Instrument, csl::Abst_SoundFile, csl::SoundCue, csl::Effect, csl::Envelope, and csl::RandEnvelope.
Referenced by csl::Mixer::activeSources(), csl::Port::isActive(), csl::Instrument::isActive(), csl::VBAP::nextBuffer(), csl::BinauralPanner::nextBuffer(), csl::AmbisonicMixer::nextBuffer(), and csl::Mixer::nextBuffer().
| void UnitGenerator::addOutput | ( | UnitGenerator * | ugen | ) |
add to or return the UGen vector of outputs
References csl::Buffer::allocateBuffers(), csl::CGestalt::maxBufferFrames(), csl::RingBuffer::mBuffer, mNumChannels, mNumOutputs, mOutputCache, mOutputs, and csl::Buffer::setSize().
Referenced by csl::Controllable::addInput(), csl::AmbisonicRotator::initialize(), csl::AmbisonicDecoder::initialize(), csl::AmbisonicEncoder::setInput(), and csl::IO::setRoot().
| void UnitGenerator::removeOutput | ( | UnitGenerator * | ugen | ) |
References mNumOutputs, and mOutputs.
Referenced by csl::IO::clearRoot(), csl::AmbisonicEncoder::setInput(), csl::AmbisonicDecoder::~AmbisonicDecoder(), and csl::AmbisonicRotator::~AmbisonicRotator().
| 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] |
pretty-print the receiver
Reimplemented in csl::Abst_SoundFile, csl::SoundCue, csl::CASoundFile, csl::BinaryOp, csl::Clipper, csl::Filter, csl::Mixer, csl::LineSegment, csl::Envelope, csl::RandEnvelope, csl::KarplusString, csl::Lorenz, csl::Noise, csl::Oscillator, csl::SumOfSines, csl::SineAsPhased, csl::SineAsScaled, csl::Window, csl::AmbisonicPanner, csl::SpatialSource, and csl::VBAP.
References csl::logMsg(), and mOutputs.
Referenced by csl::Port::dump(), and dumpTest().
| void UnitGenerator::zeroBuffer | ( | Buffer & | outputBuffer, | |
| unsigned | outBufNum | |||
| ) | [protected] |
utility method to zero out an outputBuffer
References csl::Buffer::mMonoBufferByteSize, and csl::Buffer::monoBuffer().
unsigned csl::UnitGenerator::mFrameRate [protected] |
the frame rate -- initialized to be the default by the constructor
Referenced by csl::RtpSender::createRtpSession(), csl::RtpReceiver::createRtpSession(), csl::DelayLine::delayTime(), csl::Lorenz::dump(), csl::Abst_SoundFile::durationInSecs(), frameRate(), csl::Filter::init(), csl::LSoundFile::initFromSndfile(), csl::JSoundFile::initFromSndfile(), csl::CASoundFile::initFromSndfile(), csl::RandEnvelope::nextSegment(), csl::SquareBL::nextWaveInto(), csl::SumOfSines::nextWaveInto(), csl::CASoundFile::openForRead(), csl::DelayLine::setDelayTime(), setFrameRate(), csl::Abst_SoundFile::setStartSec(), csl::Abst_SoundFile::setStopSec(), csl::Moog::setupCoeffs(), csl::Notch::setupCoeffs(), csl::Formant::setupCoeffs(), and csl::Butter::setupCoeffs().
unsigned csl::UnitGenerator::mNumChannels [protected] |
my "expected" number of output channels
Referenced by csl::AmbisonicMixer::addInput(), csl::AdditiveInstrument::AdditiveInstrument(), addOutput(), csl::Mixer::allocateOpBuffer(), csl::AmbisonicDecoder::asProjection(), csl::AmbisonicDecoder::asPseudoInverse(), csl::BasicFMInstrument::BasicFMInstrument(), csl::BlockResizer::BlockResizer(), csl::Abst_SoundFile::channels(), csl::LSoundFile::checkBuffer(), csl::Abst_SoundFile::checkBuffer(), csl::LSoundFile::initFromSndfile(), csl::JSoundFile::initFromSndfile(), csl::AmbisonicRotator::initialize(), csl::AmbisonicMixer::initialize(), csl::AmbisonicDecoder::initialize(), csl::AmbisonicEncoder::initialize(), csl::SndFileInstrument::initialize(), csl::AmbisonicUnitGenerator::initOrder(), csl::RemoteStream::initPacket(), csl::AmbisonicDecoder::makeInPhase(), csl::AmbisonicDecoder::makeMaxRE(), csl::Abst_SoundFile::mergeToMono(), csl::Mixer::Mixer(), numChannels(), csl::CASoundFile::openForRead(), csl::Panner::Panner(), csl::LSoundFile::readBufferFromFile(), csl::JSoundFile::readBufferFromFile(), csl::CASoundFile::readBufferFromFile(), csl::RemoteStream::RemoteStream(), setNumChannels(), and csl::AmbisonicRotator::~AmbisonicRotator().
BufferCopyPolicy csl::UnitGenerator::mCopyPolicy [protected] |
the policy I use if asked for more or fewer channels
Referenced by copyPolicy(), csl::LPCAnalyzer::LPCAnalyzer(), csl::LPCFilter::LPCFilter(), and setCopyPolicy().
UGenVector csl::UnitGenerator::mOutputs [protected] |
the vector of my output UGens
Reimplemented in csl::FanOut.
Referenced by addOutput(), dump(), outputs(), and removeOutput().
unsigned csl::UnitGenerator::mNumOutputs [protected] |
RingBuffer* csl::UnitGenerator::mOutputCache [protected] |
unsigned csl::UnitGenerator::mSequence [protected] |
the highest-seen buffer seq number
1.5.8