Jamoma API  0.6.0.a19
TTDCBlock.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspLibrary
4  *
5  * @brief DC Offset Filter and Blocker
6  *
7  * @details TODO: put more info here
8  *
9  * @authors Tim Place
10  *
11  * @copyright Copyright © 2008 by 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 #include "TTDCBlock.h"
18 #include <cmath>
19 
20 #define thisTTClass TTDCBlock
21 #define thisTTClassName "dcblock"
22 #define thisTTClassTags "dspLibrary, audio, processor, filter"
23 
24 
25 TT_AUDIO_CONSTRUCTOR
26 {
27  // make the clear method available to be called:
28  addMessage(clear);
29 
30  // this next one is called by the parent class so we can allocate memory as required
31  addUpdates(MaxNumChannels);
32 
33  // Set Defaults...
34  setAttributeValue(kTTSym_maxNumChannels, arguments);
35  setProcessMethod(processAudio);
36  setCalculateMethod(calculateValue);
37 
38 }
39 
40 
41 TTDCBlock::~TTDCBlock()
42 {
43  ;
44 }
45 
46 
48 {
51  clear();
52  return kTTErrNone;
53 }
54 
55 
57 {
58  mLastInput.assign(mMaxNumChannels, 0.0);
59  mLastOutput.assign(mMaxNumChannels, 0.0);
60  return kTTErrNone;
61 }
62 
63 
65 {
66  y = x - mLastInput[channel] + (mLastOutput[channel] * 0.9997);
67  TTZeroDenormal(y);
68  mLastOutput[channel] = y;
69  mLastInput[channel] = x;
70  return kTTErrNone;
71 }
72 
73 
75 {
76  TT_WRAP_CALCULATE_METHOD(calculateValue);
77 }
78 
TTChannelCount mMaxNumChannels
This is the maximum number of channels that can be guaranteed to work.
TTErr updateMaxNumChannels(const TTValue &oldMaxNumChannels, TTValue &)
This method gets called when the inherited mMaxNumChannels attribute is changed.
Definition: TTDCBlock.cpp:47
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Standard audio processing method as used by DSP objects.
Definition: TTDCBlock.cpp:74
#define setProcessMethod(methodName)
A convenience macro to be used by subclasses for setting the process method.
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt channel)
Standard single value calculate method as used by DSP objects.
Definition: TTDCBlock.cpp:64
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
TTSampleVector mLastOutput
Feedback values used for the audio filter.
Definition: TTDCBlock.h:90
TTErr clear()
Resets the DC-Blocking filter.
Definition: TTDCBlock.cpp:56
#define setCalculateMethod(methodName)
A convenience macro to be used by subclasses for setting the calculate method.
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
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
#define addMessage(name)
A convenience macro to be used by subclasses for registering messages.
Definition: TTMessage.h:19
No Error.
Definition: TTBase.h:343
TTSampleVector mLastInput
Feedback values used for the audio filter.
Definition: TTDCBlock.h:89
DC Offset Filter and Blocker.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
#define addUpdates(updateName)
An 'update' is a message sent to a subclass instance from its parent class.
Definition: TTMessage.h:44