Jamoma API  0.6.0.a19
TTTrapezoidWindow.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspWindowFunctionLib
4  *
5  * @brief Trapezoid Window Function Unit for Jamoma DSP
6  *
7  * @details This implements a Trapezoid window using the following algorthim: @n
8  * @n
9  * Where 0. <= x <= 1. and 0. <= mAlpha <= 1.: @n
10  * y = x * twoOverAlpha : for the attack @n
11  * = 1 : for the sustain @n
12  * = (1 - x) * twoOverAlpha : for the release @n
13  *
14  * @authors Trond Lossius, Nathan Wolek, Tim Place, Nils Peters,
15  *
16  * @copyright Copyright © 2010 by Trond Lossius @n
17  * This code is licensed under the terms of the "New BSD License" @n
18  * http://creativecommons.org/licenses/BSD/
19  */
20 
21 #ifndef __TRAPEZOIDWINDOW_H__
22 #define __TRAPEZOIDWINDOW_H__
23 
24 #include "TTDSP.h"
25 
26 
27 /** This implements a Trapezoid window using the following algorthim:
28 
29  Where 0. <= x <= 1. and 0. <= mAlpha <= 1.:
30  y = x * twoOverAlpha : for the attack
31  = 1 : for the sustain
32  = (1 - x) * twoOverAlpha : for the release
33  */
36 
37 protected:
38 
39  /** Set the alpha attribute of the Trapezoid window function.
40  @param newValue The new value to apply.
41  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
42  */
43  TTFloat64 mAlpha; ///< ratio of window fades to total window duration. 0 <= alpho <= 1., 0 = no fades, 1 = no sustain
44 
45 
46  /** Calculate y = f(x) for a single value.
47  @param x The input value to the window function.
48  @param y The resulting value for the window function.
49  @param data Not used.
50  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
51  */
52  inline TTErr calculateValue(const TTFloat64& x, TTFloat64& y, TTPtrSizedInt data);
53 
54 
55  /** A standard audio processing method as used by TTBlue objects.
56  @param inputs The input vector that is to be processed.
57  @param outputs The resulting windowed vector.
58  @return #TTErr error code if the method fails to execute, else #kTTErrNone.
59  */
61 };
62 
63 
64 #endif // __TRAPEZOIDWINDOW_H__
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt data)
Calculate y = f(x) for a single value.
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTFloat64 mAlpha
Set the alpha attribute of the Trapezoid window function.
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 a Trapezoid window using the following algorthim:
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
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
A standard audio processing method as used by TTBlue objects.