Jamoma API  0.6.0.a19
TTLowpassFourPole.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFilterLib
4  *
5  * @brief #TTLowpassFourPole is a 4-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_FOURPOLE_H__
18 #define __TT_LOWPASS_FOURPOLE_H__
19 
20 #include "TTDSP.h"
21 
22 
23 /** A resonant two-pole, no-zero, lowpass filter. Based on moog-variation2 @ musicdsp.org. */
26 
27 protected:
28 
29  TTFloat64 mFrequency; ///< filter cutoff frequency
30  TTFloat64 mQ; ///< filter resonance -- range is best between 1.0 and 16.0
31  TTFloat64 mDeciResonance; ///< attrResonance * 0.1
32  TTFloat64 mCoefficientF; ///< filter coefficient
33  TTFloat64 mCoefficientSquaredF; ///< mCoefficientF * mCoefficientF
34  TTFloat64 mOneMinusCoefficientF; ///< 1 - mCoefficientF
35  TTFloat64 mCoefficientFB; ///< filter coefficient
36  TTFloat64 mCoefficientG; ///< filter coefficient
37 
38  TTSampleVector mX1; ///< previous input sample for each channel
39  TTSampleVector mX2; ///< 2nd previous input sample for each channel
40  TTSampleVector mX3; ///< 3rd previous input sample for each channel
41  TTSampleVector mX4; ///< 4th previous input sample for each channel
42  TTSampleVector mY1; ///< previous output sample for each channel
43  TTSampleVector mY2; ///< 2nd previous output sample for each channel
44  TTSampleVector mY3; ///< 3rd previous output sample for each channel
45  TTSampleVector mY4; ///< 4th previous output sample for each channel
46 
47 
48  // Notifications
49  TTErr updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&);
50  TTErr updateSampleRate(const TTValue& oldSampleRate, TTValue&);
51 
52  /** This algorithm uses an IIR filter, meaning that it relies on feedback. If the filter should
53  * not be producing any signal (such as turning audio off and then back on in a host) or if the
54  * feedback has become corrupted (such as might happen if a NaN is fed in) then it may be
55  * neccesary to clear the filter by calling this method.
56  * @return Returns a TTErr error code. */
57  TTErr clear();
58 
59  void calculateCoefficients();
60  /** Standard single value calculate method as used by DSP objects. */
61  inline TTErr calculateValue(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel);
62 
63  /** Standard audio processing method as used by TTBlue objects. */
65 
66  // Attributes
67  TTErr setFrequency(const TTValue& value);
68  TTErr setQ(const TTValue& value);
69 
70 
71  /** Unit Tests
72  @param returnedTestInfo Used to return test information
73  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
74  */
75  virtual TTErr test(TTValue& returnedTestInfo);
76 };
77 
78 
79 #endif // __TT_LOWPASS_FOURPOLE_H__
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Standard audio processing method as used by TTBlue objects.
TTErr clear()
This algorithm uses an IIR filter, meaning that it relies on feedback.
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTFloat64 mCoefficientG
filter coefficient
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt channel)
Standard single value calculate method as used by DSP objects.
TTFloat64 mFrequency
filter cutoff frequency
Jamoma DSP Library.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
TTSampleVector mY4
4th previous output sample for each channel
TTFloat64 mQ
filter resonance – range is best between 1.0 and 16.0
TTFloat64 mOneMinusCoefficientF
1 - mCoefficientF
A resonant two-pole, no-zero, lowpass filter.
std::vector< TTSampleValue > TTSampleVector
A TTSampleVector is simply a pointer to the first of an array of TTSampleValues.
Definition: TTBase.h:233
TTFloat64 mCoefficientF
filter coefficient
TTSampleVector mY3
3rd previous output sample for each channel
TTSampleVector mX3
3rd previous input sample for each channel
TTSampleVector mX4
4th previous input sample for each channel
A simple container for an array of TTAudioSignal pointers.
TTFloat64 mCoefficientSquaredF
mCoefficientF * mCoefficientF
TTSampleVector mX2
2nd previous input sample for each channel
TTFloat64 mDeciResonance
attrResonance * 0.1
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
TTSampleVector mX1
previous input sample for each channel
TTSampleVector mY2
2nd previous output sample for each channel
TTSampleVector mY1
previous output sample for each channel
TTFloat64 mCoefficientFB
filter coefficient
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
virtual TTErr test(TTValue &returnedTestInfo)
Unit Tests.