Jamoma API  0.6.0.a19
TTElasticEaseInOutFunction.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup dspFunctionLib
4  *
5  * @brief #TTElasticEaseInOutFunction Unit for Jamoms DSP
6  *
7  * @details Modeled after the piecewise exponentially-damped sine wave: @n
8  * y = (1/2)*sin(13pi/2*(2*x))*pow(2, 10 * ((2*x) - 1)) ; [0,0.5) @n
9  * y = (1/2)*(sin(-13pi/2*((2x-1)+1))*pow(2,-10(2*x-1)) + 2) ; [0.5, 1] @n
10  * @n
11  * Derived from Sam Hocevar's public domain C/C++ implementation of
12  * Robert Penner easing functions
13  *
14  * @authors Trond Lossius
15  *
16  * @copyright Copyright © 2014 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 
23 
24 #define thisTTClass TTElasticEaseInOutFunction
25 #define thisTTClassName "easeInOutElastic"
26 #define thisTTClassTags "dspFunctionLib, audio, processor, function"
27 
28 
29 TT_AUDIO_CONSTRUCTOR
30 {
31  setProcessMethod(processAudio);
32  setCalculateMethod(calculateValue);
33 }
34 
35 
36 TTElasticEaseInOutFunction::~TTElasticEaseInOutFunction()
37 {
38  ;
39 }
40 
41 
43 {
44  if (x < 0.5)
45  {
46  y = 0.5 * sin(6.5 * kTTPi * (2 * x)) * pow(2, 10 * ((2 * x) - 1));
47  }
48  else
49  {
50  y = 0.5 * (sin(-6.5 * kTTPi * ((2 * x - 1) + 1)) * pow(2, -10 * (2 * x - 1)) + 2);
51  }
52  return kTTErrNone;
53 }
54 
55 
57 {
58  TT_WRAP_CALCULATE_METHOD(calculateValue);
59 }
60 
#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
TTErr calculateValue(const TTFloat64 &x, TTFloat64 &y, TTPtrSizedInt data)
y = f(x) for a single value
#define setCalculateMethod(methodName)
A convenience macro to be used by subclasses for setting the calculate method.
TTElasticEaseInOutFunction Unit for Jamoms DSP
A simple container for an array of TTAudioSignal pointers.
TTErr processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
A standard audio processing method as used by TTBlue objects.
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
TTFOUNDATION_EXPORT const TTFloat64 kTTPi
[doxygenAppendixC_constExample]
Definition: TTBase.cpp:23