Jamoma API  0.6.0.a19
TTLowpassTwoPole.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFilterLib
4  *
5  * @brief #TTLowpassTwoPole is a 2-Pole Lowpass Filter Object.
6  *
7  * @details
8  *
9  * @authors Timothy Place, Trond Lossius
10  *
11  * @copyright Copyright © 2008, Timothy Place @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 
17 #ifndef __TT_LOWPASS_TWOPOLE_H__
18 #define __TT_LOWPASS_TWOPOLE_H__
19 
20 #include "TTDSP.h"
21 
22 
23 /** A resonant two-pole, no-zero, lowpass filter. Based on the Hal Chamberlin book. */
26 
27 protected:
28 
29  TTFloat64 mFrequency; ///< filter cutoff frequency
30  TTFloat64 mResonance; ///< filter resonance
31  TTFloat64 mCoefficientA; ///< filter coefficient
32  TTFloat64 mCoefficientB; ///< filter coefficient
33  TTFloat64 mCoefficientC; ///< filter coefficient
34  TTFloat64 mRadians; ///< filter cutoff frequence expressed in radians
35  TTFloat64 mNegOneOverResonance; ///< -1 / attrResonance
36  TTSampleVector mFeedback1; ///< previous output sample for each channel
37  TTSampleVector mFeedback2; ///< 2nd previous output sample for each channel
38 
39 
40  // Notifications
41  TTErr updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&);
42  TTErr updateSampleRate(const TTValue& oldSampleRate, TTValue&);
43 
44  /** This algorithm uses an IIR filter, meaning that it relies on feedback. If the filter should
45  * not be producing any signal (such as turning audio off and then back on in a host) or if the
46  * feedback has become corrupted (such as might happen if a NaN is fed in) then it may be
47  * neccesary to clear the filter by calling this method.
48  * @return Returns a TTErr error code. */
49  TTErr clear();
50  // Attributes
51  TTErr setFrequency(const TTValue& value);
52  TTErr setResonance(const TTValue& value);
53 
54  void calculateCoefficients();
55  /** Standard single value calculate method as used by DSP objects. */
56  inline TTErr calculateValue(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel);
57 
58  /** Standard audio processing method as used by TTBlue objects. */
60 
61 
62  /** Unit Tests
63  @param returnedTestInfo Used to return test information
64  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
65  */
66  virtual TTErr test(TTValue& returnedTestInfo);
67 };
68 
69 
70 #endif // __TT_LOWPASS_TWOPOLE_H__
TTFloat64 mCoefficientC
filter coefficient
TTErr clear()
This algorithm uses an IIR filter, meaning that it relies on feedback.
A resonant two-pole, no-zero, lowpass filter.
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTFloat64 mFrequency
filter cutoff frequency
virtual TTErr test(TTValue &returnedTestInfo)
Unit Tests.
TTFloat64 mResonance
filter resonance
Jamoma DSP Library.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
TTFloat64 mRadians
filter cutoff frequence expressed in radians
TTFloat64 mCoefficientB
filter coefficient
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
TTFloat64 mNegOneOverResonance
-1 / attrResonance
std::vector< TTSampleValue > TTSampleVector
A TTSampleVector is simply a pointer to the first of an array of TTSampleValues.
Definition: TTBase.h:233
TTFloat64 mCoefficientA
filter coefficient
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Standard audio processing method as used by TTBlue objects.
TTSampleVector mFeedback2
2nd previous output sample for each channel
TTSampleVector mFeedback1
previous output sample for each channel
A simple container for an array of TTAudioSignal pointers.
long TTPtrSizedInt
An integer that is the same size as a pointer.
Definition: TTBase.h:240
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt channel)
Standard single value calculate method as used by DSP objects.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34