Jamoma API  0.6.0.a19
TTMirrorBandpass10.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFilterLib
4  *
5  * @brief #TTMirror5 is a 10th-order bandpass/notch filter built up from a 2-path allpass structure transformed from the 5th-order #TTMirror5 lowpass filter
6  *
7  * @details
8  *
9  * @authors Timothy Place, Trond Lossius
10  *
11  * @copyright Copyright © 2010, 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_MIRRORBANDPASS10_H__
18 #define __TT_MIRRORBANDPASS10_H__
19 
20 #include "TTDSP.h"
21 #include "TTAllpass2c.h"
22 #include "TTAllpass4a.h"
23 
24 
25 /** A 10th-order bandpass/notch filter built-up from allpass building blocks.
26  Based on Multirate Signal Processing for Communication Systems, Chapter 10, Page 33.
27  */
30 
31 protected:
32 
33  TTAudioObject mF0; ///< filter0 (in the upper path)
34  TTAudioObject mF1; ///< filter1 (in the lower path, first block)
35  TTAudioObject mF2; ///< filter2 (in the lower path, second block)
36  TTFloat64 mFrequency; ///< attribute: in hertz
37  TTSymbol mMode; ///< attribute: lowpass or highpass
38  TTFloat64 mBandwidth; ///< attribute: in hertz
39  TTFloat64 mQ; ///< attribute: bandwidth expressed as Q
40  TTBoolean mBandwidthSetWithQ; ///< flag to tell us whether to adjust bandwidth when frequency changes
41 
42  // Notifications
43  TTErr updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&);
44 
45  // Zero filter history
46  TTErr clear();
47 
48  // attribute accessor
49  TTErr setMode(const TTValue& newValue);
50  TTErr setFrequency(const TTValue& newValue);
51  TTErr setBandwidth(const TTValue& newValue);
52  TTErr setQ(const TTValue& newValue);
53 
54  TTErr calculateCoefficients(void);
55  inline void filterKernel(const TTFloat64& input, TTFloat64& outputPath0, TTFloat64& outputPath1, TTPtrSizedInt channel);
56 
57  // Do the processing
58  TTErr processBandpass(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
59  TTErr processNotch(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
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 public:
69  TTErr calculateBandpass(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
70  TTErr calculateNotch(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
71 };
72 
73 
74 #endif // __TT_MIRRORBANDPASS10_H__
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTAudioObject mF0
filter0 (in the upper path)
Wrap audio objects for convenience.
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
TTFloat64 mBandwidth
attribute: in hertz
TTAudioObject mF2
filter2 (in the lower path, second block)
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTSymbol mMode
attribute: lowpass or highpass
TTFloat64 mQ
attribute: bandwidth expressed as Q
A simple container for an array of TTAudioSignal pointers.
TTAudioObject mF1
filter1 (in the lower path, first block)
long TTPtrSizedInt
An integer that is the same size as a pointer.
Definition: TTBase.h:240
TTBoolean mBandwidthSetWithQ
flag to tell us whether to adjust bandwidth when frequency changes
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
virtual TTErr test(TTValue &returnedTestInfo)
Unit Tests.
A 10th-order bandpass/notch filter built-up from allpass building blocks.
TTAllpass4a is a fourth-order allpass filter.
TTAllpass2c is a second-order building-block allpass filter.
TTFloat64 mFrequency
attribute: in hertz
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34