Jamoma API  0.6.0.a19
TTAllpass1.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFilterLib
4  *
5  * @brief #TTAllpass1 is a first order allpass filter
6  *
7  * @details
8  *
9  * @authors Timothy Place, Trond Lossius
10  *
11  * @copyright Copyright © 2003, 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_ALLPASS1_H__
18 #define __TT_ALLPASS1_H__
19 
20 #include "TTDSP.h"
21 #include "TTDelayBuffer.h"
22 
23 
24 /** An allpass filter. */
25 class TTAllpass1 : public TTAudioObjectBase {
27 
28 protected:
29 
30  TTFloat64 mDelay; ///< Attribute: delay time in milliseconds
31  TTFloat64 mDelayMax; ///< Maximum delay time in milliseconds (how long is the buffer?)
32  TTUInt32 mDelayInSamples; ///< Delay time in samples (internal)
33  TTUInt32 mDelayMaxInSamples; ///< size of the delay buffers
34  TTFloat64 mGain; ///< Attribute: gain in db
35  TTFloat64 mLinearGain; ///< Attribute: linear gain coefficient
36 
37  TTDelayBufferVector mFeedforward; ///< ff buffers for each channel
38  TTDelayBufferVector mFeedback; ///< fb buffers for each channel
39 
40 
41  // Notifications
42  TTErr updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&);
43  TTErr updateSampleRate(const TTValue& oldSampleRate, TTValue&);
44 
45  /** Internal initialization of buffers and pointers etc. */
46  TTErr init(TTUInt64 newDelayMaxInSamples);
47 
48  // internal - position the buffer pointers
49  void reset();
50 
51 
52  /** Attribute accessor. */
53  TTErr setDelay(const TTValue& newValue);
54 
55  /** Attribute Accessor */
56  TTErr setDelayInSamples(const TTValue& newValue);
57 
58  /** Attribute Accessor */
59  TTErr setDelayMax(const TTValue& newValue);
60 
61  /** Attribute Accessor */
62  TTErr setDelayMaxInSamples(const TTValue& newValue);
63 
64  /** Attribute accessor. */
65  TTErr setGain(const TTValue& newValue);
66 
67  /** Attribute accessor. */
68  TTErr setLinearGain(const TTValue& newValue);
69 
70  /** This algorithm uses an IIR filter, meaning that it relies on feedback. If the filter should
71  * not be producing any signal (such as turning audio off and then back on in a host) or if the
72  * feedback has become corrupted (such as might happen if a NaN is fed in) then it may be
73  * neccesary to clear the filter by calling this method.
74  * @return Returns a TTErr error code. */
75  TTErr clear();
76 
77 
78  TTErr calculateValue(const TTFloat64& x, TTFloat64& y, TTDelayBufferPtr* data);
79  TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs);
80 
81  /** Unit Tests
82  @param returnedTestInfo Used to return test information
83  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
84  */
85  virtual TTErr test(TTValue& returnedTestInfo);
86 };
87 
88 
89 #endif // __TT_ALLPASS1_H__
TTErr setDelay(const TTValue &newValue)
Attribute accessor.
Definition: TTAllpass1.cpp:132
TTDelayBufferVector mFeedback
fb buffers for each channel
Definition: TTAllpass1.h:38
TTErr setDelayMaxInSamples(const TTValue &newValue)
Attribute Accessor.
Definition: TTAllpass1.cpp:177
TTFloat64 mDelayMax
Maximum delay time in milliseconds (how long is the buffer?)
Definition: TTAllpass1.h:31
TTErr clear()
This algorithm uses an IIR filter, meaning that it relies on feedback.
Definition: TTAllpass1.cpp:108
std::uint64_t TTUInt64
64 bit unsigned integer
Definition: TTBase.h:180
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTErr setLinearGain(const TTValue &newValue)
Attribute accessor.
Definition: TTAllpass1.cpp:124
TTErr setDelayMax(const TTValue &newValue)
Attribute Accessor.
Definition: TTAllpass1.cpp:168
TTUInt32 mDelayMaxInSamples
size of the delay buffers
Definition: TTAllpass1.h:33
TTFloat64 mGain
Attribute: gain in db.
Definition: TTAllpass1.h:34
Jamoma DSP Library.
TTDelayBufferVector mFeedforward
ff buffers for each channel
Definition: TTAllpass1.h:37
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
An allpass filter.
Definition: TTAllpass1.h:25
Audio delay buffer object.
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
TTUInt32 mDelayInSamples
Delay time in samples (internal)
Definition: TTAllpass1.h:32
TTErr setGain(const TTValue &newValue)
Attribute accessor.
Definition: TTAllpass1.cpp:116
A simple container for an array of TTAudioSignal pointers.
TTFloat64 mDelay
Attribute: delay time in milliseconds.
Definition: TTAllpass1.h:30
TTFloat64 mLinearGain
Attribute: linear gain coefficient.
Definition: TTAllpass1.h:35
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
TTErr setDelayInSamples(const TTValue &newValue)
Attribute Accessor.
Definition: TTAllpass1.cpp:154
TTErr init(TTUInt64 newDelayMaxInSamples)
Internal initialization of buffers and pointers etc.
Definition: TTAllpass1.cpp:64
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
virtual TTErr test(TTValue &returnedTestInfo)
Unit Tests.
TTDelayBuffer is a container object that holds some audio in a chunk of memory, with accessors for us...
Definition: TTDelayBuffer.h:27