Jamoma API  0.6.0.a19
DSP/extensions/GeneratorLib/includes/TTRamp.h
1 /*
2  * TTBlue Ramp Generator
3  * Copyright © 2008, Timothy Place
4  *
5  * License: This code is licensed under the terms of the "New BSD License"
6  * http://creativecommons.org/licenses/BSD/
7  */
8 
9 #ifndef __TT_RAMP_H__
10 #define __TT_RAMP_H__
11 
12 #include "TTDSP.h"
13 
14 
15 /** TTRamp generates a linear traversal from 0.0 to 1.0 over the course of a specified time period.
16  The first sample of the ramp is 0.0 and the last sample of the ramp is 1.0.
17  This behaviour makes this ramp suitable for generating a window functions or similar where
18  all values of the function are to be present over the time encapsulated by the ramping signal.
19  */
22 
23 protected:
24 
25  enum rampDirection {
26  kUP = 0,
27  kDOWN
28  };
29 
30  TTSymbol attrMode; ///< mode: sample_accurate or vector_accurate
31  TTFloat64 attrRampTime; ///< ramp time in milliseconds
32  TTUInt32 rampSamples; ///< ramp time in samples
33  TTFloat64 attrCurrentValue; ///<
34  TTFloat64 attrDestinationValue; ///<
35  TTFloat64 step; ///<
36  TTBoolean direction; ///< 0 = ramp up, 1 = ramp down
37 
38  /** Internal method for setting which process method to use. */
39  void setupProcess();
40 
41  /** Internal method called when the ramp is triggered (by setting the rampTime) */
42  void setStep();
43 
44  /** Process method -- This method is special! It only sets the first sample of the vector and does not use it's input! */
46  /** Process method -- This method is special! It only sets the first sample of the vector and does not use it's input! */
48  /** Process method */
50  /** Process method */
52 
53  /** Setter for the mode attribute. The options are 'sample' and 'vector' which determine
54  the desired accuracy of the ramp that is generated. */
55  TTErr setMode(const TTValue& value);
56 
57  /** Trigger a ramp with a time set in samples */
58  TTErr RampTimeInSamples(const TTValue& newValue);
59  /** Trigger a ramp with a time set in milliseconds */
60  TTErr setRampTime(const TTValue& newValue);
61 
62  /** Stop the current ramp. */
63  TTErr Stop();
64 
65  /** Unit Tests */
66  virtual TTErr test(TTValue& returnedTestInfo);
67 
68 };
69 
70 
71 #endif // __TT_RAMP_H__
bool TTBoolean
Boolean flag, same as Boolean on the Mac.
Definition: TTBase.h:167
TTErr setRampTime(const TTValue &newValue)
Trigger a ramp with a time set in milliseconds.
TTSymbol attrMode
mode: sample_accurate or vector_accurate
TTRamp generates a linear traversal from 0.0 to 1.0 over the course of a specified time period...
TTAudioObjectBase is the base class for all audio generating and processing objects in Jamoma DSP...
TTErr processVectorAccurateUp(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Process method – This method is special! It only sets the first sample of the vector and does not us...
TTErr RampTimeInSamples(const TTValue &newValue)
Trigger a ramp with a time set in samples.
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
TTFloat64 attrRampTime
ramp time in milliseconds
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTErr processSampleAccurateDown(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Process method.
TTErr Stop()
Stop the current ramp.
A simple container for an array of TTAudioSignal pointers.
void setStep()
Internal method called when the ramp is triggered (by setting the rampTime)
TTErr processVectorAccurateDown(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Process method – This method is special! It only sets the first sample of the vector and does not us...
TTBoolean direction
0 = ramp up, 1 = ramp down
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
std::uint32_t TTUInt32
32 bit unsigned integer
Definition: TTBase.h:178
TTErr processSampleAccurateUp(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
Process method.
TTErr setMode(const TTValue &value)
Setter for the mode attribute.
virtual TTErr test(TTValue &returnedTestInfo)
Unit Tests.
Definition: TTRamp.test.cpp:12
void setupProcess()
Internal method for setting which process method to use.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
TTUInt32 rampSamples
ramp time in samples