32 #define FILTER_MAX_COEFFICIENTS (16) // seems reasonable?
52 #define BW_HIGH_PASS 1
53 #define BW_BAND_PASS 2
54 #define BW_BAND_STOP 3
55 #define BW_LOW_SHELF 4
56 #define BW_HIGH_SHELF 5
64 #define DECLARE_FILTER_CONTROLS \
65 Port * freqPort = mInputs[CSL_FILTER_FREQUENCY]; \
66 Port * bwPort = mInputs[CSL_FILTER_AMOUNT]
70 #define LOAD_FILTER_CONTROLS \
71 if (freqPort) Controllable::pullInput(freqPort, numFrames); \
72 if (bwPort) Controllable::pullInput(bwPort, numFrames)
103 Filter(
unsigned num_b,
unsigned num_a = 1);
118 void init(
unsigned a,
unsigned b);
142 Butter (FilterType type,
float cutoff);
143 Butter (FilterType type,
float center,
float bandwidth);
164 Biquad (FilterType type,
float freq,
float Q,
float dB = 0.0f);
sample * SampleBuffer
1-channel buffer data type, vector of (sample)
Buffer * mPrevInputs
arrays of past input and output samples
unsigned mBNum
number of coeffs in b
virtual void setupCoeffs()
float mBCoeff[FILTER_MAX_COEFFICIENTS]
array of numerator coeffs
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
Effect – mix-in for classes that have unit generators as inputs (like filters).
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
really compute the next buffer given an offset base channel; this is called by nextBuffer, possibly multiple times
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
really compute the next buffer given an offset base channel; this is called by nextBuffer, possibly multiple times
Notch(UnitGenerator &in, float center_freq, float radius)
constructors & destructor
float mFrame
to keep hold of sample rate for calculating coeffs
void setAmount(UnitGenerator &amount)
set the receiver's amount to a UGen or a float
Filter: the canonical-form n-pole/m-zero filter class.
float Q
ctr frq (Hz), peak (dB), Q(uality) factor
Notch Filter with poles at +-z and complex conjugate zeros at +-omega.
Controllable – superclass of the mix-ins that add control or signal inputs. This holds onto a map of...
~FrequencyAmount()
Destructor.
void dump()
log information about myself
Scalable – mix-in class with scale and offset control inputs (may be constants or generators)...
Allpass Filter with a pole and a zero at equal frequency and straddling the unit circle. Allows all freqs to pass through but messes with phases.
int mFilterType
flag as to what kind of filter I am
General-purpose Biquad IIR (2nd order recursive) filter. This is simplified and optimized, but doesn't support dynamic or scalable controls. It uses inst vars rather than arrays for the coefficients. NB: peak gain (dB) is used only for the peak and shelf types)
#define FILTER_MAX_COEFFICIENTS
Filters.h – CSL filter classes.
FrequencyAmount()
Constructors.
unsigned mANum
number of coeffs in a
Filter()
Generic Filter class with scalable order and generic next_buffer method that implememnts the canonica...
void setFrequency(UnitGenerator &frequency)
set the receiver's frequency to a UGen or a float
Butterworth IIR (2nd order recursive) filter.
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
UnitGenerator * mCoeffUGen
Moog-style resonant VCF class.
~Filter()
Filter destructor frees temp memory.
Allpass(UnitGenerator &in, float coeff)
float mACoeff[FILTER_MAX_COEFFICIENTS]
array of denominator coeffs
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
void clear(void)
clears the input/output buffers
void init(unsigned a, unsigned b)
shared initialization function
FrequencyAmount – mix-in class with frequency and amount (BW) control inputs (may be constants or ge...
Butter()
Butterworth IIR (2nd order recursive) filter. This operates upon a buffer of frames of amplitude samp...
Base class of CSL exceptions (written upper-case). Has a string message.