Jamoma API  0.6.0.a19
TTTukeyWindow.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspWindowFunctionLib
4  *
5  * @brief Tukey Window Function Unit for Jamoma DSP
6  *
7  * @details This implements the Tukey window function described here: @n
8
9  * http://en.wikipedia.org/wiki/File:Window_function_(Tukey;_alpha_%3D_0.5).png @n
10  * This is alternate implementation of what Roads (1996 p 170, 2001 p 88) typically refers to as a quasi-Gaussian window.
11  * It is easier to ensure that x and y values will scale properly with this formula as opposed to the one given by Roads. @n
12  * @n
13  * Where 0. <= x <= 1. and 0. <= mAlpha <= 1.: @n
14  * y = 0.5 * (1 + cos ( pi * ((twoOverAlpha * x) - 1))) : for the attack @n
15  * = 1 : for the sustain @n
16  * = 0.5 * (1 + cos ( pi * ((twoOverAlpha * x) - twoOverAlpha + 1))) : for the release @n
17  *
18  * @authors Nathan Wolek, Tim Place, Trond Lossius
19  *
23  */
24
25
26 #ifndef __TUKEYWINDOW_H__
27 #define __TUKEYWINDOW_H__
28
29 #include "TTDSP.h"
30
31
32 /** This implements the Tukey window function described here:
33  http://en.wikipedia.org/wiki/File:Window_function_(Tukey;_alpha_%3D_0.5).png
34  This is alternate implementation of what Roads (1996 p 170, 2001 p 88) typically refers to as a quasi-Gaussian window.
35  It is easier to ensure that x and y values will scale properly with this formula as opposed to the one given by Roads.
36
37  Where 0. <= x <= 1. and 0. <= mAlpha <= 1.:
38  y = 0.5 * (1 + cos ( pi * ((twoOverAlpha * x) - 1))) : for the attack
39  = 1 : for the sustain
40  = 0.5 * (1 + cos ( pi * ((twoOverAlpha * x) - twoOverAlpha + 1))) : for the release
41  */
44
45 protected:
46
47  TTFloat64 mAlpha; ///< ratio of window fades to total window duration. 0 <= alpha <= 1., 0 = no fades, 1 = no sustain
48
49
50  /** Calculate y = f(x) for a single value.
51  @param x The input value to the window function.
52  @param y The resulting value for the window function.
53  @param data Not used.
54  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
55  */
56  inline TTErr calculateValue(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt data);
57
58
59  /** A standard audio processing method as used by TTBlue objects.
60  @param inputs The input vector that is to be processed.
61  @param outputs The resulting windowed vector.
62  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
63  */
65
66
67  /** Unit test for the window function unit.
68  @param returnedTestInfo The outcome from the performed unit test.
69  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
70  */
71  TTErr test(TTValue& returnedTestInfo);
72
73 };
74
75
76 #endif // __TUKEYWINDOW_H__
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
A standard audio processing method as used by TTBlue objects.
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTErr test(TTValue &returnedTestInfo)
Unit test for the window function unit.
Jamoma DSP Library.
double TTFloat64
64 bit floating point number
Definition: TTBase.h:188
#define TTCLASS_SETUP(className)
TODO Doxygen: need more comments here.
Definition: TTFoundation.h:54
This implements the Tukey window function described here: http://en.wikipedia.org/wiki/File:Window_fu...
Definition: TTTukeyWindow.h:42
TTFloat64 mAlpha
ratio of window fades to total window duration. 0 <= alpha <= 1., 0 = no fades, 1 = no sustain ...
Definition: TTTukeyWindow.h:47
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
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt data)
Calculate y = f(x) for a single value.