VCV Rack API v2
|
A Quantity that wraps an engine::Param. More...
#include <ParamQuantity.hpp>
Public Member Functions | |
Param * | getParam () |
void | setValue (float value) override |
Sets the target value of the Engine's smoothing algorithm, or immediate value if smoothing is disabled. | |
float | getValue () override |
Gets the Param's smoothing target value, or immediate value if smoothing is disabled. | |
void | setImmediateValue (float value) |
Sets the Param's value immediately without smoothing. | |
float | getImmediateValue () |
Gets the Param's value post-smoothing. | |
float | getMinValue () override |
Returns the minimum recommended value. | |
float | getMaxValue () override |
Returns the maximum recommended value. | |
float | getDefaultValue () override |
Returns the default value, for resetting. | |
float | getDisplayValue () override |
Returns the value, transformed for displaying. | |
void | setDisplayValue (float displayValue) override |
Always sets immediate value. | |
std::string | getDisplayValueString () override |
Returns a string representation of the display value. | |
void | setDisplayValueString (std::string s) override |
Always sets immediate value. | |
int | getDisplayPrecision () override |
The number of total decimal places for generating the display value string. | |
std::string | getLabel () override |
The name of the quantity. | |
std::string | getUnit () override |
The unit abbreviation of the quantity. | |
void | reset () override |
Resets the value to the default value. | |
void | randomize () override |
Sets the value to a uniform random value between the bounds. | |
virtual std::string | getDescription () |
virtual json_t * | toJson () |
virtual void | fromJson (json_t *rootJ) |
DEPRECATED void | setSmoothValue (float value) |
Deprecated. | |
DEPRECATED float | getSmoothValue () |
Deprecated. | |
Public Member Functions inherited from rack::Quantity | |
virtual | ~Quantity () |
virtual std::string | getString () |
Returns a string representation of the quantity. | |
bool | isMin () |
Checks whether the value is at the min value. | |
bool | isMax () |
Checks whether the value is at the max value. | |
void | setMin () |
Sets the value to the min value. | |
void | setMax () |
Sets the value to the max value. | |
void | toggle () |
Sets the value to max if the current value is min, otherwise sets the value to min. | |
void | moveValue (float deltaValue) |
Adds an amount to the value. | |
float | getRange () |
The difference between the max and min values. | |
bool | isBounded () |
Checks whether the bounds are finite. | |
float | toScaled (float value) |
Transforms a value to the range 0 to 1. | |
float | fromScaled (float scaledValue) |
Transforms a value from the range 0 to 1. | |
void | setScaledValue (float scaledValue) |
Sets value from the range 0 to 1. | |
float | getScaledValue () |
Returns the value scaled to the range 0 to 1. | |
void | moveScaledValue (float deltaScaledValue) |
Adds an amount to the value scaled to the range 0 to 1. | |
Public Attributes | |
int | paramId = -1 |
float | minValue = 0.f |
The minimum allowed value. | |
float | maxValue = 1.f |
The maximum allowed value. | |
float | defaultValue = 0.f |
The initial value. | |
std::string | name |
The name of the parameter, using sentence capitalization. | |
std::string | unit |
The numerical unit of measurement appended to the value. | |
float | displayBase = 0.f |
Set to 0 for linear, positive for exponential, negative for logarithmic. | |
float | displayMultiplier = 1.f |
float | displayOffset = 0.f |
int | displayPrecision = 5 |
Number of digits of precision to display. | |
std::string | description |
An optional one-sentence description of the parameter. | |
bool | resetEnabled = true |
Enables parameter resetting when the module or parameter itself is reset. | |
bool | randomizeEnabled = true |
Enables parameter randomization when the module is randomized. | |
bool | smoothEnabled = false |
Enables per-sample Engine parameter smoothing when setSmoothValue() is called. | |
bool | snapEnabled = false |
Rounds values to the nearest integer. | |
A Quantity that wraps an engine::Param.
If smoothEnabled
is true, all methods access/modify the Param's target value of the Engine's per-sample smoothing algorithm instead of the immediate value.
Param * rack::engine::ParamQuantity::getParam | ( | ) |
|
overridevirtual |
Sets the target value of the Engine's smoothing algorithm, or immediate value if smoothing is disabled.
Before Rack 2.3.0, this always set the Param's immediate value. For this behavior, use setImmediateValue()
instead.
Reimplemented from rack::Quantity.
|
overridevirtual |
Gets the Param's smoothing target value, or immediate value if smoothing is disabled.
Before Rack 2.3.0, this always got the Param's immediate value. For this behavior, use getImmediateValue()
instead.
Reimplemented from rack::Quantity.
void rack::engine::ParamQuantity::setImmediateValue | ( | float | value | ) |
float rack::engine::ParamQuantity::getImmediateValue | ( | ) |
Gets the Param's value post-smoothing.
If (and only if) the Param's value is currently being smoothed by the Engine, the return value is different than getValue().
|
overridevirtual |
Returns the minimum recommended value.
Reimplemented from rack::Quantity.
|
overridevirtual |
Returns the maximum recommended value.
Reimplemented from rack::Quantity.
|
overridevirtual |
Returns the default value, for resetting.
Reimplemented from rack::Quantity.
|
overridevirtual |
Returns the value, transformed for displaying.
Useful for logarithmic scaling, multiplying by 100 for percentages, etc.
Reimplemented from rack::Quantity.
|
overridevirtual |
Always sets immediate value.
Reimplemented from rack::Quantity.
|
overridevirtual |
Returns a string representation of the display value.
Reimplemented from rack::Quantity.
Reimplemented in rack::engine::SwitchQuantity.
|
overridevirtual |
Always sets immediate value.
Reimplemented from rack::Quantity.
Reimplemented in rack::engine::SwitchQuantity.
|
overridevirtual |
The number of total decimal places for generating the display value string.
Reimplemented from rack::Quantity.
|
overridevirtual |
The name of the quantity.
Reimplemented from rack::Quantity.
|
overridevirtual |
The unit abbreviation of the quantity.
Include an initial space character if you want a space after the number, e.g. "440 Hz". This allows space-less units, like "100%".
Reimplemented from rack::Quantity.
|
overridevirtual |
Resets the value to the default value.
Reimplemented from rack::Quantity.
|
overridevirtual |
Sets the value to a uniform random value between the bounds.
Reimplemented from rack::Quantity.
|
virtual |
|
virtual |
|
virtual |
DEPRECATED void rack::engine::ParamQuantity::setSmoothValue | ( | float | value | ) |
Deprecated.
Use setValue() instead, which is identical since Rack 2.3.0.
DEPRECATED float rack::engine::ParamQuantity::getSmoothValue | ( | ) |
Deprecated.
Use getValue() instead, which is identical since Rack 2.3.0.
int rack::engine::ParamQuantity::paramId = -1 |
float rack::engine::ParamQuantity::minValue = 0.f |
The minimum allowed value.
float rack::engine::ParamQuantity::maxValue = 1.f |
The maximum allowed value.
Must be greater than minValue.
float rack::engine::ParamQuantity::defaultValue = 0.f |
The initial value.
std::string rack::engine::ParamQuantity::name |
The name of the parameter, using sentence capitalization.
e.g. "Frequency", "Pulse width", "Alternative mode"
std::string rack::engine::ParamQuantity::unit |
The numerical unit of measurement appended to the value.
Unit words and abbreviations should have a space to separate the numerical value from the number (e.g. " semitones", " V", " ms"). Unit symbols should have no space (e.g. "%", "ยบ").
float rack::engine::ParamQuantity::displayBase = 0.f |
Set to 0 for linear, positive for exponential, negative for logarithmic.
The formula is \(displayValue = f(value) * displayMultiplier + displayOffset\) where \(f(value)\) is
float rack::engine::ParamQuantity::displayMultiplier = 1.f |
float rack::engine::ParamQuantity::displayOffset = 0.f |
int rack::engine::ParamQuantity::displayPrecision = 5 |
Number of digits of precision to display.
With displayPrecision = 5 for example, numbers will print as 12.345, 0.12345, 1.2345e6, or 1.2345e-6.
std::string rack::engine::ParamQuantity::description |
An optional one-sentence description of the parameter.
bool rack::engine::ParamQuantity::resetEnabled = true |
Enables parameter resetting when the module or parameter itself is reset.
bool rack::engine::ParamQuantity::randomizeEnabled = true |
Enables parameter randomization when the module is randomized.
Unbounded (infinite) parameters are not randomizable, regardless of this setting.
bool rack::engine::ParamQuantity::smoothEnabled = false |
Enables per-sample Engine parameter smoothing when setSmoothValue() is called.
bool rack::engine::ParamQuantity::snapEnabled = false |
Rounds values to the nearest integer.