21 #define thisTTClass TTBandpassButterworth2
22 #define thisTTClassName "bandpass.butterworth.2"
23 #define thisTTClassTags "dspFilterLib, audio, processor, filter, bandpass, butterworth"
43 setAttributeValue(kTTSym_maxNumChannels, arguments);
44 setAttributeValue(
TT(
"frequency"), 1000.0);
45 setAttributeValue(
TT(
"q"), 50.0);
52 TTBandpassButterworth2::~TTBandpassButterworth2()
76 TTErr TTBandpassButterworth2::clear()
89 calculateCoefficients();
94 TTErr TTBandpassButterworth2::setQ(
const TTValue& newValue)
97 calculateCoefficients();
102 void TTBandpassButterworth2::calculateCoefficients()
111 mC = 1. / tan(
kTTPi*(mBw/
sr) );
113 mA0 = 1. / (1. + mC);
117 mB2 = mA0 * (mC - 1.);
123 y = mA0*x + mA2*
mX2[channel] - mB1*
mY1[channel] -
mB2*
mY2[channel];
125 mX2[channel] =
mX1[channel];
127 mY2[channel] =
mY1[channel];
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Standard audio processing method as used by TTBlue objects.
TTChannelCount mMaxNumChannels
This is the maximum number of channels that can be guaranteed to work.
TTFOUNDATION_EXPORT const TTFloat64 kTTTwoPi
Pre-calculated value of pi * 2.
#define setProcessMethod(methodName)
A convenience macro to be used by subclasses for setting the process method.
TTFloat64 mB2
filter coefficients. a1=0 and hence ignored
TTErr setFrequency(const TTValue &value)
Setter for the frequency attribute.
TTBandpassButterworth2 is a second-order Butterworth bandpass filter.
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt channel)
Standard single value calculate method as used by DSP objects.
double TTFloat64
64 bit floating point number
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
#define setCalculateMethod(methodName)
A convenience macro to be used by subclasses for setting the calculate method.
TTFloat64 mQ
filter resonance
#define addAttributeProperty(attributeName, propertyName, initialValue)
A convenience macro to be used for registering properties of attributes.
TTErr updateMaxNumChannels(const TTValue &oldMaxNumChannels, TTValue &)
Receives notifications when there are changes to the inherited mMaxNumChannels attribute.
TTFloat64 mFrequency
filter cutoff frequency
TTSampleVector mY2
Output sample n-2.
A simple container for an array of TTAudioSignal pointers.
long TTPtrSizedInt
An integer that is the same size as a pointer.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
#define addAttributeWithSetter(name, type)
A convenience macro to be used by subclasses for registering attributes with a custom setter...
#define addMessage(name)
A convenience macro to be used by subclasses for registering messages.
TTFOUNDATION_EXPORT const TTFloat64 kTTPi
[doxygenAppendixC_constExample]
TTSampleVector mX2
Input sample n-2.
TTSampleVector mX1
Input sample n-1.
[doxygenAppendixC_copyExample]
#define addUpdates(updateName)
An 'update' is a message sent to a subclass instance from its parent class.
TTSampleVector mY1
Output sample n-1.
TTUInt32 sr
Current sample rate being used by this object.