Jamoma API  0.6.0.a19
TTHighpassButterworth4.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFilterLib
4  *
5  * @brief #TTHighpassButterworth4 is a fourth-order Butterworth highpass filter.
6  *
7  * @details Butterworth filters have maximum flat frequency response in the pass band.
8  * @n
9  * Filter equations from: @n
10  * @n
11  * Second-order IIR Filters will support cascade implementations @n
12  * By Rusty Allred, Texas Instruments, Dallas @n
13  * July 01, 2003 @n
14  * http://www.planetanalog.com/article/printableArticle.jhtml?articleID=12802683
15  *
16  * @authors Trond Lossius, Timothy Place,
17  *
18  * @copyright Copyright © 2008, Trond Lossius @n
19  * This code is licensed under the terms of the "New BSD License" @n
20  * http://creativecommons.org/licenses/BSD/
21  */
22 
23 
24 #ifndef __TT_HIGHPASS_BUTTERWORTH_4_H__
25 #define __TT_HIGHPASS_BUTTERWORTH_4_H__
26 
27 #include "TTDSP.h"
28 
29 
30 /** 4rth order Butterworth highpass filter; Butterworth filters have maximum flat frequency response in the pass band.
31  *
32  * Filter equations from:
33  *
34  * Second-order IIR Filters will support cascade implementations
35  * By Rusty Allred, Texas Instruments, Dallas
36  * July 01, 2003
37  * http://www.planetanalog.com/article/printableArticle.jhtml?articleID=12802683
38  *
39  */
42 
43 protected:
44 
45  TTFloat64 mFrequency; ///< filter cutoff frequency
46  TTFloat64 mK, mK2,mK3,mK4, mRadians, mRadians2, mRadians3, mRadians4; ///< filter coefficients
47  TTFloat64 mA0, mA1, mA2; ///< filter coefficients for input samples
48  TTFloat64 mB1, mB2, mB3, mB4; ///< filter coefficients for output samples
49  TTSampleVector mX1; ///< Input sample n-1
50  TTSampleVector mX2; ///< Input sample n-2
51  TTSampleVector mX3; ///< Input sample n-3
52  TTSampleVector mX4; ///< Input sample n-4
53  TTSampleVector mY1; ///< Output sample n-1
54  TTSampleVector mY2; ///< Output sample n-2
55  TTSampleVector mY3; ///< Output sample n-3
56  TTSampleVector mY4; ///< Output sample n-4
57 
58  /** Receives notifications when there are changes to the inherited
59  mMaxNumChannels attribute. This allocates memory for xm1, xm2, ym1, and ym2
60  so that each channel's previous values are remembered. */
61  TTErr updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&);
62  TTErr updateSampleRate(const TTValue& oldSampleRate, TTValue&);
63 
64  /** This algorithm uses an IIR filter, meaning that it relies on feedback. If the filter should
65  * not be producing any signal (such as turning audio off and then back on in a host) or if the
66  * feedback has become corrupted (such as might happen if a NaN is fed in) then it may be
67  * neccesary to clear the filter by calling this method.
68  * @return Returns a TTErr error code. */
69  TTErr clear();
70 
71  void calculateCoefficients();
72 
73  /** Standard single value calculate method as used by DSP objects. */
74  inline TTErr calculateValue(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel);
75 
76  /** Standard audio processing method as used by TTBlue objects. */
78 
79  /** Setter for the frequency attribute. */
80  TTErr setFrequency(const TTValue& value);
81 
82 
83  /** Unit Tests
84  @param returnedTestInfo Used to return test information
85  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
86  */
87  virtual TTErr test(TTValue& returnedTestInfo);
88 };
89 
90 
91 #endif // __TT_HIGHPASS_BUTTERWORTH_4_H__
TTSampleVector mX2
Input sample n-2.
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTFloat64 mFrequency
filter cutoff frequency
TTSampleVector mX1
Input sample n-1.
TTSampleVector mY3
Output sample n-3.
TTFloat64 mRadians4
filter coefficients
TTSampleVector mY2
Output sample n-2.
Jamoma DSP Library.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
TTSampleVector mY1
Output sample n-1.
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
TTFloat64 mA2
filter coefficients for input samples
std::vector< TTSampleValue > TTSampleVector
A TTSampleVector is simply a pointer to the first of an array of TTSampleValues.
Definition: TTBase.h:233
virtual TTErr test(TTValue &returnedTestInfo)
Unit Tests.
TTSampleVector mX4
Input sample n-4.
TTErr updateMaxNumChannels(const TTValue &oldMaxNumChannels, TTValue &)
Receives notifications when there are changes to the inherited mMaxNumChannels attribute.
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Standard audio processing method as used by TTBlue objects.
TTFloat64 mB4
filter coefficients for output samples
TTErr clear()
This algorithm uses an IIR filter, meaning that it relies on feedback.
A simple container for an array of TTAudioSignal pointers.
TTSampleVector mY4
Output sample n-4.
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
4rth order Butterworth highpass filter; Butterworth filters have maximum flat frequency response in t...
TTSampleVector mX3
Input sample n-3.
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt channel)
Standard single value calculate method as used by DSP objects.
TTErr setFrequency(const TTValue &value)
Setter for the frequency attribute.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34