Jamoma API  0.6.0.a19
TTWelchWindow.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspWindowFunctionLib
4  *
5  * @brief Welch Window Function Unit for Jamoma DSP
6  *
7  * @details This implements a window function as described @n
8  * http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/windows/ @n
9  * welch(i) = 1.0 - ((i-n/2)/(n/2)) * ((i-n/2)/(n/2))
10  *
11  * @authors Tim Place, Nathan Wolek, Trond Lossius
12  *
13  * @copyrightCopyright © 2010 by Timothy Place @n
14  * This code is licensed under the terms of the "New BSD License" @n
15  * http://creativecommons.org/licenses/BSD/
16  */
17 
18 #include "TTWelchWindow.h"
19 
20 #define thisTTClass WelchWindow
21 #define thisTTClassName "welch"
22 #define thisTTClassTags "dspWindowFunctionLib, audio, processor, function, window"
23 
24 
25 TT_AUDIO_CONSTRUCTOR
26 {
27  setProcessMethod(processAudio);
28  setCalculateMethod(calculateValue);
29 }
30 
31 
32 WelchWindow::~WelchWindow()
33 {
34  ;
35 }
36 
37 
38 // welch(i) = 1.0 - ((i-n/2)/(n/2)) * ((i-n/2)/(n/2))
40 {
41  //w = ((x-1.0/2.0)/(1.0/2.0));
42 
43  //TTFloat64 w;
44  //w = (x-0.5)/0.5;
45  //y = 1.0 - (w * w);
46  // [NP]: since we assume that n=1, we can simplified to:
47  y = 4.0 * (-x*x + x);
48  return kTTErrNone;
49 }
50 
51 
53 {
54  TT_WRAP_CALCULATE_METHOD(calculateValue);
55 }
56 
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
A standard audio processing method as used by TTBlue objects.
#define setProcessMethod(methodName)
A convenience macro to be used by subclasses for setting the process method.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
#define setCalculateMethod(methodName)
A convenience macro to be used by subclasses for setting the calculate method.
Welch Window Function Unit for Jamoma DSP.
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt data)
Calculate y = f(x) for a single value.
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
No Error.
Definition: TTBase.h:343