Jamoma API  0.6.0.a19
TTHalfband9.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFilterLib
4  *
5  * @brief #TTHalfband9 is a 9-Pole Halfband filter built up from a 2-path allpass structure.
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_HALFBAND9_H__
18 #define __TT_HALFBAND9_H__
19 
20 #include "TTDSP.h"
21 #include "TTAllpass1a.h"
22 #include "TTAllpass1b.h"
23 
24 
25 /** A 9-pole halfband lowpass/highpass filter built-up from allpass building blocks.
26  Based on Multirate Signal Processing for Communication Systems, Chapter 10, Page 18.
27 
28  Passband edge (i.e. Fc or -3db) at Fs/4
29  */
32 
33 protected:
34 
35  TTAudioObject mF0; ///< path0
36  TTAudioObject mF2; ///< path0
37  TTAudioObject mR0; ///< path0, resampling
38  TTAudioObject mR2; ///< path0, resampling
39 
40  TTAudioObject mF1; ///< path1
41  TTAudioObject mF3; ///< path1
42  TTAudioObject mR1; ///< path1, resampling
43  TTAudioObject mR3; ///< path1, resampling
44  TTAudioObject mDelay; ///< path1
45 
46  TTSampleVector mRSwitch; ///< resampling switch (so we know which path to calculate)
47  TTSampleVector mY0; ///< resampling path0 output (for each channel)
48  TTSampleVector mY1; ///< resampling path1 output (for each channel)
49 
50  TTSymbol mMode; ///< Attribute: lowpass or highpass
51 
52  // Notifications
53  TTErr updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&);
54 
55  // Zero filter history
56  TTErr clear();
57 
58  // attribute accessor
59  TTErr setMode(const TTValue& newValue);
60 
61  // Do the processing
62  inline void filterKernel(const TTFloat64& input, TTFloat64& outputPath0, TTFloat64& outputPath1, TTPtrSizedInt channel);
63 
64  TTErr processLowpass (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
65  TTErr processHighpass (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
66  TTErr processDownsample (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
67  TTErr processUpsample (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
68 
69 
70  /** Unit Tests
71  @param returnedTestInfo Used to return test information
72  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
73  */
74  virtual TTErr test(TTValue& returnedTestInfo);
75 
76 public:
77 
78  TTErr calculateLowpass (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
79  TTErr calculateHighpass (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
80  TTErr calculateDownsample (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
81  TTErr calculateUpsample (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
82 
83 };
84 
85 
86 #endif // __TT_HALFBAND9_H__
TTAudioObject mF2
path0
Definition: TTHalfband9.h:36
TTAudioObject mDelay
path1
Definition: TTHalfband9.h:44
TTSymbol mMode
Attribute: lowpass or highpass.
Definition: TTHalfband9.h:50
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTSampleVector mY1
resampling path1 output (for each channel)
Definition: TTHalfband9.h:48
Wrap audio objects for convenience.
Jamoma DSP Library.
TTSampleVector mY0
resampling path0 output (for each channel)
Definition: TTHalfband9.h:47
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
TTAudioObject mR0
path0, resampling
Definition: TTHalfband9.h:37
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
std::vector< TTSampleValue > TTSampleVector
A TTSampleVector is simply a pointer to the first of an array of TTSampleValues.
Definition: TTBase.h:233
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
A 9-pole halfband lowpass/highpass filter built-up from allpass building blocks.
Definition: TTHalfband9.h:30
TTAudioObject mR2
path0, resampling
Definition: TTHalfband9.h:38
A simple container for an array of TTAudioSignal pointers.
TTSampleVector mRSwitch
resampling switch (so we know which path to calculate)
Definition: TTHalfband9.h:46
long TTPtrSizedInt
An integer that is the same size as a pointer.
Definition: TTBase.h:240
TTAudioObject mF3
path1
Definition: TTHalfband9.h:41
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTAudioObject mR1
path1, resampling
Definition: TTHalfband9.h:42
TTAudioObject mF0
path0
Definition: TTHalfband9.h:35
TTAllpass1a is a first-order building-block allpass filter.
TTAudioObject mR3
path1, resampling
Definition: TTHalfband9.h:43
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTAllpass1b is a first-order building-block allpass filter.
virtual TTErr test(TTValue &returnedTestInfo)
Unit Tests.
TTAudioObject mF1
path1
Definition: TTHalfband9.h:40