VCV Rack API v2
|
A controller for manipulating a float value (which subclasses must store somehow) with limits and labels. More...
#include <Quantity.hpp>
Public Member Functions | |
virtual | ~Quantity () |
virtual void | setValue (float value) |
Sets the value directly. | |
virtual float | getValue () |
Returns the value. | |
virtual float | getMinValue () |
Returns the minimum recommended value. | |
virtual float | getMaxValue () |
Returns the maximum recommended value. | |
virtual float | getDefaultValue () |
Returns the default value, for resetting. | |
virtual float | getDisplayValue () |
Returns the value, transformed for displaying. | |
virtual void | setDisplayValue (float displayValue) |
Inversely transforms the display value and sets the value. | |
virtual int | getDisplayPrecision () |
The number of total decimal places for generating the display value string. | |
virtual std::string | getDisplayValueString () |
Returns a string representation of the display value. | |
virtual void | setDisplayValueString (std::string s) |
Sets the value from a display string. | |
virtual std::string | getLabel () |
The name of the quantity. | |
virtual std::string | getUnit () |
The unit abbreviation of the quantity. | |
virtual std::string | getString () |
Returns a string representation of the quantity. | |
virtual void | reset () |
Resets the value to the default value. | |
virtual void | randomize () |
Sets the value to a uniform random value between the bounds. | |
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. | |
A controller for manipulating a float value (which subclasses must store somehow) with limits and labels.
Often used as a decorator component for widget::Widget
s that read or write a quantity.
|
inlinevirtual |
|
inlinevirtual |
Sets the value directly.
Override this to change the state of your subclass to represent the new value.
Reimplemented in rack::engine::ParamQuantity.
|
inlinevirtual |
Returns the value.
Override this to return the state of your subclass.
Reimplemented in rack::engine::ParamQuantity.
|
inlinevirtual |
Returns the minimum recommended value.
Reimplemented in rack::engine::ParamQuantity.
|
inlinevirtual |
Returns the maximum recommended value.
Reimplemented in rack::engine::ParamQuantity.
|
inlinevirtual |
Returns the default value, for resetting.
Reimplemented in rack::engine::ParamQuantity.
|
virtual |
Returns the value, transformed for displaying.
Useful for logarithmic scaling, multiplying by 100 for percentages, etc.
Reimplemented in rack::engine::ParamQuantity.
|
virtual |
Inversely transforms the display value and sets the value.
Reimplemented in rack::engine::ParamQuantity.
|
virtual |
The number of total decimal places for generating the display value string.
Reimplemented in rack::engine::ParamQuantity.
|
virtual |
Returns a string representation of the display value.
Reimplemented in rack::engine::ParamQuantity, and rack::engine::SwitchQuantity.
|
virtual |
Sets the value from a display string.
Reimplemented in rack::engine::ParamQuantity, and rack::engine::SwitchQuantity.
|
inlinevirtual |
The name of the quantity.
Reimplemented in rack::engine::ParamQuantity.
|
inlinevirtual |
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 in rack::engine::ParamQuantity.
|
virtual |
Returns a string representation of the quantity.
|
virtual |
Resets the value to the default value.
Reimplemented in rack::engine::ParamQuantity.
|
virtual |
Sets the value to a uniform random value between the bounds.
Reimplemented in rack::engine::ParamQuantity.
bool rack::Quantity::isMin | ( | ) |
Checks whether the value is at the min value.
bool rack::Quantity::isMax | ( | ) |
Checks whether the value is at the max value.
void rack::Quantity::setMin | ( | ) |
Sets the value to the min value.
void rack::Quantity::setMax | ( | ) |
Sets the value to the max value.
void rack::Quantity::toggle | ( | ) |
Sets the value to max if the current value is min, otherwise sets the value to min.
void rack::Quantity::moveValue | ( | float | deltaValue | ) |
Adds an amount to the value.
float rack::Quantity::getRange | ( | ) |
The difference between the max and min values.
bool rack::Quantity::isBounded | ( | ) |
Checks whether the bounds are finite.
float rack::Quantity::toScaled | ( | float | value | ) |
Transforms a value to the range 0 to 1.
float rack::Quantity::fromScaled | ( | float | scaledValue | ) |
Transforms a value from the range 0 to 1.
void rack::Quantity::setScaledValue | ( | float | scaledValue | ) |
Sets value from the range 0 to 1.
float rack::Quantity::getScaledValue | ( | ) |
Returns the value scaled to the range 0 to 1.
void rack::Quantity::moveScaledValue | ( | float | deltaScaledValue | ) |
Adds an amount to the value scaled to the range 0 to 1.