32 namespace cinder {
namespace audio {
34 typedef std::shared_ptr<class Context>
ContextRef;
35 typedef std::shared_ptr<class Node>
NodeRef;
40 typedef std::function<void ( float *, size_t, float, float, const std::pair<float, float>& )>
RampFn;
43 void rampLinear(
float *array,
size_t count,
float t,
float tIncr,
const std::pair<float, float> &valueRange );
45 void rampInQuad(
float *array,
size_t count,
float t,
float tIncr,
const std::pair<float, float> &valueRange );
47 void rampOutQuad(
float *array,
size_t count,
float t,
float tIncr,
const std::pair<float, float> &valueRange );
59 void cancel() { mIsCanceled =
true; }
63 Event(
float timeBegin,
float timeEnd,
float valueBegin,
float valueEnd,
const RampFn &rampFn );
65 float mTimeBegin, mTimeEnd, mDuration;
66 float mValueBegin, mValueEnd;
67 std::atomic<bool> mIsComplete, mIsCanceled;
104 Param(
Node *parentNode,
float initialValue = 0 );
115 EventRef applyRamp(
float valueEnd,
float rampSeconds,
const Options &options = Options() );
117 EventRef applyRamp(
float valueBegin,
float valueEnd,
float rampSeconds,
const Options &options = Options() );
119 EventRef appendRamp(
float valueEnd,
float rampSeconds,
const Options &options = Options() );
137 bool eval(
float timeBegin,
float *array,
size_t arrayLength,
size_t sampleRate );
float getValue() const
Returns the current value of the Param.
Definition: Param.h:109
float getTimeEnd() const
Definition: Param.h:53
void rampOutQuad(float *array, size_t count, float t, float tIncr, const std::pair< float, float > &valueRange)
Array-based quadradic (t^2) ease-out ramping function.
Definition: Param.cpp:53
std::pair< float, float > findEndTimeAndValue() const
Returns the end time and value of the latest scheduled Event, or [0, getValue()] if none are schedule...
Definition: Param.cpp:165
std::list< EventRef > mEvents
Definition: Param.h:151
Class representing a sample-accurate parameter control instruction.
Definition: Param.h:50
Options & delay(float delay)
Specifies a delay of delay in seconds.
Definition: Param.h:89
size_t getNumEvents() const
Returns the number of Event's that are currently scheduled.
Definition: Param.cpp:146
void initInternalBuffer()
Definition: Param.cpp:276
float getValueBegin() const
Definition: Param.h:55
void reset()
Resets Param, blowing away any Event's or processing Node.
Definition: Param.cpp:139
void rampLinear(float *array, size_t count, float t, float tIncr, const std::pair< float, float > &valueRange)
Array-based linear ramping function.
Definition: Param.cpp:35
void resetImpl()
Definition: Param.cpp:264
float getValueEnd() const
Definition: Param.h:56
float getTimeBegin() const
Definition: Param.h:52
float findDuration() const
Returns the total duration of any scheduled Event's, including delay, or 0 if none are scheduled...
Definition: Param.cpp:152
const RampFn & getRampFn() const
Returns the ramping function that will be used during evaluation.
Definition: Param.h:96
NodeRef mProcessor
Definition: Param.h:154
std::shared_ptr< class Context > ContextRef
Definition: Node.h:38
const float * getValueArray() const
Definition: Param.cpp:178
void setValue(float value)
Sets the value of the Param, blowing away any scheduled Event's or processing Node.
Definition: Param.cpp:73
float getDuration() const
Definition: Param.h:54
GLuint GLuint GLsizei count
Definition: GLee.h:963
const RampFn & getRampFn() const
Definition: Param.h:57
void rampInQuad(float *array, size_t count, float t, float tIncr, const std::pair< float, float > &valueRange)
Array-based quadradic (t^2) ease-in ramping function.
Definition: Param.cpp:44
Fundamental building block for creating an audio processing graph.
Definition: Node.h:59
GLsizei const GLfloat * value
Definition: GLee.h:2487
std::atomic< float > mValue
Definition: Param.h:152
bool eval()
Definition: Param.cpp:185
Optional parameters when applying or appending ramps.
Definition: Param.h:85
void cancel()
Definition: Param.h:59
std::function< void(float *, size_t, float, float, const std::pair< float, float > &)> RampFn
note: unless we want to add _VARIADIC_MAX=6 in preprocessor definitions to all projects, number of args here has to be 5 or less for vc11 support
Definition: Param.h:40
EventRef applyRamp(float valueEnd, float rampSeconds, const Options &options=Options())
Replaces any existing Event's with a Event from the current value to valueEnd over rampSeconds...
Definition: Param.cpp:81
std::shared_ptr< class Event > EventRef
A Reference to Event's returned by the ramping methods.
Definition: Param.h:38
ContextRef getContext() const
Definition: Param.cpp:282
float getDelay() const
Returns the delay specified in seconds.
Definition: Param.h:94
std::shared_ptr< class Node > NodeRef
Definition: Node.h:39
bool isComplete() const
Definition: Param.h:60
BufferDynamic mInternalBuffer
Definition: Param.h:155
void setProcessor(const NodeRef &node)
Definition: Param.cpp:121
Options & rampFn(const RampFn &rampFn)
Specifies the ramping function used during evaluation.
Definition: Param.h:91
GLdouble GLdouble t
Definition: GLee.h:1426
Node * mParentNode
Definition: Param.h:153
Allows an audio parameter to be controlled over time with sample accuracate curves.
Definition: Param.h:81
EventRef appendRamp(float valueEnd, float rampSeconds, const Options &options=Options())
Appends a Event from the end of the last scheduled Param (or the current time) to valueEnd over rampS...
Definition: Param.cpp:103
Param(Node *parentNode, float initialValue=0)
Constructs a Param with a pointer (weak reference) to the owning parent Node and an optional initialV...
Definition: Param.cpp:68
Options()
Definition: Param.h:86