Jamoma API  0.6.0.a19
TTHalfband3.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFilterLib
4  *
5  * @brief #TTHalfband3 is a 3rd-order up/down-sampling 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_RESAMPLE3_H__
18 #define __TT_RESAMPLE3_H__
19 
20 #include "TTDSP.h"
21 #include "TTAllpass1a.h"
22 #include "TTAllpass1b.h"
23 
24 
25 /** A 1st-order up/down-sampling filter built-up from allpass building blocks.
26  Based on Multirate Signal Processing for Communication Systems, Chapter 10.
27  */
30 
31 protected:
32 
33  TTAudioObject mF0; ///< path0 (used by lowpass/highpass modes)
34  TTAudioObject mDelay; ///< pure delay (used by lowpass/highpass modes)
35  TTAudioObject mR0; ///< path 0 (used by resampling modes)
36  TTSampleVector mX1; ///< previous input sample (for each channel)
37  TTSymbol mMode; ///< Attribute: upsample or downsample
38 
39  // Notifications
40  TTErr updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&);
41 
42  // attribute accessor
43  TTErr setMode(const TTValue& newValue);
44 
45  // Do the processing
46  TTErr processLowpass (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
47  TTErr processHighpass (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
48  TTErr processDownsample (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
49  TTErr processUpsample (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
50 
51  /** Unit Tests
52  @param returnedTestInfo Used to return test information
53  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
54  */
55  virtual TTErr test(TTValue& returnedTestInfo);
56 
57 public:
58 
59  TTErr calculateLowpass (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
60  TTErr calculateHighpass (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
61  TTErr calculateDownsample (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
62  TTErr calculateUpsample (const TTFloat64& x, TTFloat64& y, TTPtrSizedInt channel=0);
63 };
64 
65 
66 #endif // __TT_RESAMPLE1_H__
TTAudioObject mDelay
pure delay (used by lowpass/highpass modes)
Definition: TTHalfband3.h:34
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
Wrap audio objects for convenience.
Jamoma DSP Library.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
TTAudioObject mR0
path 0 (used by resampling modes)
Definition: TTHalfband3.h:35
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
TTAudioObject mF0
path0 (used by lowpass/highpass modes)
Definition: TTHalfband3.h:33
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 simple container for an array of TTAudioSignal pointers.
TTSymbol mMode
Attribute: upsample or downsample.
Definition: TTHalfband3.h:37
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
A 1st-order up/down-sampling filter built-up from allpass building blocks.
Definition: TTHalfband3.h:28
TTSampleVector mX1
previous input sample (for each channel)
Definition: TTHalfband3.h:36
virtual TTErr test(TTValue &returnedTestInfo)
Unit Tests.
TTAllpass1a is a first-order building-block allpass filter.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTAllpass1b is a first-order building-block allpass filter.