#include <parameterblender.h>
Public Member Functions | |
BaseParameterBlender (Parameter ¶meter) | |
virtual | ~BaseParameterBlender ()=default |
void | blend (float value) |
void | setTarget (const Parameter *target) |
void | clearTarget () |
void | sync () |
bool | hasTarget () const |
const Parameter & | getTarget () const |
const Parameter & | getParameter () const |
template<typename T > | |
const T & | getTarget () const |
template<typename T > | |
T & | getParameter () |
Protected Member Functions | |
virtual void | onBlend (float value)=0 |
virtual void | onSync ()=0 |
virtual void | onTargetSet ()=0 |
Base class of all parameter blenders. Blends a parameter (source) towards a target parameter based on a lerp value from 0 to 1. Override the virtual methods to create a blender for a specific parameter type.
BaseParameterBlender | ( | Parameter & | parameter | ) |
Constructs the blender based on the given parameter. This parameter is updated based on the target blend value.
parameter | the parameter to update. |
|
virtualdefault |
void blend | ( | float | value | ) |
Blends parameters based on the given value (0-1). Result is immediately applied to the parameter.
value | normalized blend value |
void clearTarget | ( | ) |
Clears blending target
T & getParameter |
const Parameter& getParameter | ( | ) | const |
const Parameter& getTarget | ( | ) | const |
const T & getTarget |
bool hasTarget | ( | ) | const |
|
protectedpure virtual |
Called after calling blend(). Override in derived class to correctly blend parameter from source to target.
value | the blend value (0-1) |
Implemented in ParameterBlender< ParamType, ValueType >, ParameterBlender< ParamType, ValueType >, ParameterBlender< ParamType, ValueType >, ParameterBlender< ParamType, ValueType >, ParameterBlender< ParamType, ValueType >, ParameterBlender< ParamType, ValueType >, and ParameterBlender< ParamType, ValueType >.
|
protectedpure virtual |
Called after calling sync(). Override in derived class to sync the current parameter source value.
Implemented in ParameterBlender< ParamType, ValueType >.
|
protectedpure virtual |
Called when a new target is set, only occurs when target is derived from the source parameter.
Implemented in ParameterBlender< ParamType, ValueType >.
void setTarget | ( | const Parameter * | target | ) |
Sets the target parameter. Note that the target must be of the same type as the source parameter
target | parameter to blend towards |
void sync | ( | ) |
Ensures that subsequent calls to blend() are computed relative to the current parameter value.