Jamoma API  0.6.0.a19
TTHanningWindow.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspWindowFunctionLib
4  *
5  * @brief Hanning Window Function Unit for Jamoma DSP
6  *
7  * @details This implements a window function as described @
8  http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/windows/ @n
9  hanning(x) = 0.5 + 0.5*cos(2*PI*(x-0.5)) @n
10  *
11  * @authors Nils Peters, Trond Lossius, Tim Place, Nathan Wolek
12  *
13  * @copyright Copyright © 2010 by Trond Lossius @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 "TTHanningWindow.h"
19 
20 #define thisTTClass HanningWindow
21 #define thisTTClassName "hanning"
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 HanningWindow::~HanningWindow()
33 {
34  ;
35 }
36 
37 
38 // hanning(x) = 0.5 + 0.5*cos(2*PI*(x-0.5))
40 {
41  y = 0.5 + 0.5*cos(kTTTwoPi*(x-0.5));
42  return kTTErrNone;
43 }
44 
45 
47 {
48  TT_WRAP_CALCULATE_METHOD(calculateValue);
49 }
50 
Hanning Window Function Unit for Jamoma DSP.
TTFOUNDATION_EXPORT const TTFloat64 kTTTwoPi
Pre-calculated value of pi * 2.
Definition: TTBase.cpp:24
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.
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
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt data)
Calculate y = f(x) for a single value.