![]() |
Cinder
0.9.1
|
#include <Param.h>
Classes | |
struct | Options |
Public Member Functions | |
Param (Node *parentNode, float initialValue=0) | |
void | setValue (float value) |
float | getValue () const |
const float * | getValueArray () |
EventRef | applyRamp (float valueEnd, double rampSeconds, const Options &options=Options()) |
EventRef | applyRamp (float valueBegin, float valueEnd, double rampSeconds, const Options &options=Options()) |
EventRef | appendRamp (float valueEnd, double rampSeconds, const Options &options=Options()) |
EventRef | appendRamp (float valueBegin, float valueEnd, double rampSeconds, const Options &options=Options()) |
void | setProcessor (const NodeRef &node) |
NodeRef | getProcessor () const |
void | reset () |
size_t | getNumEvents () const |
bool | eval () |
bool | eval (double timeBegin, float *array, size_t arrayLength, size_t sampleRate) |
float | findDuration () const |
std::pair< double, float > | findEndTimeAndValue () const |
Protected Member Functions | |
void | initInternalBuffer () |
void | resetImpl () |
void | removeEventsAt (double time) |
ContextRef | getContext () const |
Protected Attributes | |
std::list< EventRef > | mEvents |
std::atomic< float > | mValue |
bool | mIsVaryingThisBlock |
Node * | mParentNode |
NodeRef | mProcessor |
BufferDynamic | mInternalBuffer |
Allows an audio parameter to be controlled over time with sample accurate curves.
The Param class enables expressive control over variables that control audio::Node's with a Timeline-esque API. It supports appending 'ramps' (audio animations) and maintains these in an internal timeline that is evaluated from the audio thread. You can also set a Node as the 'processor' with Param::setProcessor(), enabling you to control it with an arbitrary signal.
A Param is owned by a parent Node, from which it gains access to the current Context. This is a necessary step in making it sample accurate yet still controllable in a thread-safe manager on the user thread.
cinder::audio::Param::Param | ( | Node * | parentNode, |
float | initialValue = 0 |
||
) |
void cinder::audio::Param::setValue | ( | float | value | ) |
float cinder::audio::Param::getValue | ( | ) | const |
Returns the current value of the Param.
const float * cinder::audio::Param::getValueArray | ( | ) |
Returns an array of values, time varying if Event
s were processed, or filled with the a constant value if there were no Event
s this block.
Returns a pointer to the buffer used when evaluating a Param that is varying over the current processing block, of equal size to the owning Context's frames per block.
void cinder::audio::Param::setProcessor | ( | const NodeRef & | node | ) |
NodeRef cinder::audio::Param::getProcessor | ( | ) | const |
void cinder::audio::Param::reset | ( | ) |
size_t cinder::audio::Param::getNumEvents | ( | ) | const |
Returns the number of Event's that are currently scheduled.
bool cinder::audio::Param::eval | ( | ) |
Evaluates the Param for the current processing block, with current time determined from the parent Node's Context.
bool cinder::audio::Param::eval | ( | double | timeBegin, |
float * | array, | ||
size_t | arrayLength, | ||
size_t | sampleRate | ||
) |
Evaluates the Param from timeBegin for arrayLength samples at sampleRate.
float cinder::audio::Param::findDuration | ( | ) | const |
Returns the total duration of any scheduled Event's, including delay, or 0 if none are scheduled.
pair< double, float > cinder::audio::Param::findEndTimeAndValue | ( | ) | const |
Returns the end time and value of the latest scheduled Event, or [0, getValue()] if none are scheduled.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |