41 float distance = this->distance();
51 mIntensityCue->compute(distance);
52 mIntensityCue->process(outputBuffer);
55 mAirAbsorptionCue->compute(distance);
56 mAirAbsorptionCue->process(outputBuffer);
58 mPositionChanged = ((
SpatialSource *) inputSound)->positionChanged();
71 for (
unsigned k = 0; k < numFrames; k++)
72 *outputPtr++ *=
mGain;
88 float cutoffFreq = 22000 * 9/distance;
89 float w = 2.0 * frameRate;
92 cutoffFreq *= 2.0F *
CSL_PI;
93 Norm = 1.0 / (cutoffFreq + w);
94 mBCoeff = (w - cutoffFreq) * Norm;
103 for (
unsigned i = 0; i < numFrames; i++) {
sample * SampleBuffer
1-channel buffer data type, vector of (sample)
AirAbsorptionCue * mAirAbsorptionCue
virtual void compute(float distance)
virtual ~AirAbsorptionCue()
unsigned mNumFrames
num frames used in each buffer
virtual bool positionChanged()
Returns wether the sound source position changed since last block call.
virtual void process(Buffer &aBuffer)
Process each sample in the buffer, applying the filter.
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
virtual void compute(float distance)
Calculate the filter coefficients.
CPoint * mPosition
source position
virtual SampleBuffer buffer(unsigned bufNum)
convenience accessors for sample buffers
IntensityAttenuationCue * mIntensityCue
Sound attenuation due to increasing distance. This "Base" Class uses the inverse square law...
virtual void nextBuffer(Buffer &outputBuffer)
get a buffer of Frames – this is the core CSL "pull" function; the given buffer can be written into...
Simulates the frequency dependent air absorption using a one pole/zero lowpass filter.
CPoint * position(unsigned channelNum=0)
Returns the distance from the center.
virtual void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
really compute the next buffer given an offset base channel; this is called by nextBuffer, possibly multiple times
Temp Spatial Sound Source.
static unsigned frameRate()
default frame rate
virtual void process(Buffer &aBuffer)
UnitGenerator * mUGen
my unit generator (pointer or NULL)
DistanceSimulator(UnitGenerator &source)
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Port – used to represent constant, control-rate or signal inputs and outputs in named maps; holds a ...
void addInput(CSL_MAP_KEY name, UnitGenerator &ugen)
Plug in a unit generator to the named input slot.
PortMap mInputs
the map of my inputs or controls (used by the mix-in classes)
Base class of CSL exceptions (written upper-case). Has a string message.