Jamoma API  0.6.0.a19
TTHalfband5.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFilterLib
4  *
5  * @brief #TTHalfband5 is a 5-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_HALFBAND5_H__
18 #define __TT_HALFBAND5_H__
19 
20 #include "TTDSP.h"
21 #include "TTAllpass1a.h"
22 #include "TTAllpass1b.h"
23 
24 
25 /** A 5-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, and stopband edge (-60db) at Fs*0.370.
29  */
32 
33 protected:
34 
35  TTAudioObject mF0; ///< filter0 (in the upper path)
36  TTAudioObject mF1; ///< filter1 (in the lower path, second block)
37  TTAudioObject mDelay; ///< delay (in the lower path, first block)
38  TTAudioObject mR0; ///< resampling filter0 (in the upper path)
39  TTAudioObject mR1; ///< resampling filter1 (in the lower path, second block)
40  TTSampleVector mRSwitch; ///< resampling switch (so we know which path to calculate)
41  TTSampleVector mY0; ///< resampling path0 output (for each channel)
42  TTSampleVector mY1; ///< resampling path1 output (for each channel)
43  TTSymbol mMode; ///< Attribute: lowpass or highpass
44 
45  // Notifications
46  TTErr updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&);
47 
48  // Zero filter history
49  TTErr clear();
50 
51  // attribute accessor
52  TTErr setMode(const TTValue& newValue);
53  TTErr setA0(const TTValue& newValue);
54  TTErr setA1(const TTValue& newValue);
55 
56  // Do the processing
57  TTErr processLowpass (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
58  TTErr processHighpass (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
59  TTErr processDownsample (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
60  TTErr processUpsample (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
61 
62 
63  /** Unit Tests
64  @param returnedTestInfo Used to return test information
65  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
66  */
67  virtual TTErr test(TTValue& returnedTestInfo);
68 
69 public:
70 
71  TTErr calculateLowpass (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
72  TTErr calculateHighpass (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
73  TTErr calculateDownsample (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
74  TTErr calculateUpsample (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
75 
76 };
77 
78 
79 #endif // __TT_HALFBAND5_H__
TTAudioObject mF1
filter1 (in the lower path, second block)
Definition: TTHalfband5.h:36
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTSampleVector mY0
resampling path0 output (for each channel)
Definition: TTHalfband5.h:41
TTAudioObject mR1
resampling filter1 (in the lower path, second block)
Definition: TTHalfband5.h:39
Wrap audio objects for convenience.
Jamoma DSP Library.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
A 5-pole halfband lowpass/highpass filter built-up from allpass building blocks.
Definition: TTHalfband5.h:30
TTAudioObject mF0
filter0 (in the upper path)
Definition: TTHalfband5.h:35
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
virtual TTErr test(TTValue &returnedTestInfo)
Unit Tests.
TTSymbol mMode
Attribute: lowpass or highpass.
Definition: TTHalfband5.h:43
TTAudioObject mR0
resampling filter0 (in the upper path)
Definition: TTHalfband5.h:38
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
TTSampleVector mY1
resampling path1 output (for each channel)
Definition: TTHalfband5.h:42
TTSampleVector mRSwitch
resampling switch (so we know which path to calculate)
Definition: TTHalfband5.h:40
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
TTAudioObject mDelay
delay (in the lower path, first block)
Definition: TTHalfband5.h:37
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTAllpass1a is a first-order building-block allpass filter.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTAllpass1b is a first-order building-block allpass filter.