A parameter bridge that connects a vital::Value
to an AudioProcessorParameter, allowing the host to manipulate and automate internal values within the Vital synth engine.
More...
#include <value_bridge.h>
|
| ValueBridge ()=delete |
| Deleted default constructor.
|
|
| ValueBridge (std::string name, vital::Value *value) |
| Constructs a ValueBridge to expose a Vital parameter as a host-automatable parameter.
|
|
float | getValue () const override |
| Gets the current normalized (0.0 to 1.0) value of the parameter.
|
|
void | setValue (float value) override |
| Sets the parameter value from a normalized (0.0 to 1.0) float.
|
|
void | setListener (Listener *listener) |
| Sets a listener to receive parameter change callbacks.
|
|
float | getDefaultValue () const override |
| Returns the default normalized value of this parameter.
|
|
String | getName (int maximumStringLength) const override |
| Returns the display name of this parameter, truncated to a given length.
|
|
String | getLabel () const override |
| Returns the label (unit) associated with this parameter.
|
|
String | getText (float value, int maximumStringLength) const override |
| Converts a normalized value into a user-facing text string.
|
|
float | getValueForText (const String &text) const override |
| Converts a user-facing string back into a normalized parameter value.
|
|
bool | isAutomatable () const override |
| Indicates whether this parameter can be automated by the host.
|
|
int | getNumSteps () const override |
| Returns the number of discrete steps this parameter has, if any.
|
|
bool | isDiscrete () const override |
| Checks if this parameter is discrete (indexed steps) or continuous.
|
|
bool | isBoolean () const override |
| Checks if this parameter is essentially a boolean (on/off) parameter.
|
|
float | convertToPluginValue (vital::mono_float synth_value) const |
| Converts the internal engine value to a normalized value from 0.0 to 1.0.
|
|
float | convertToEngineValue (vital::mono_float plugin_value) const |
| Converts a normalized (0.0 to 1.0) parameter value back into the engine's range.
|
|
void | setValueNotifyHost (float new_value) |
| Sets the parameter value and notifies the host, preventing recursive updates.
|
|
A parameter bridge that connects a vital::Value
to an AudioProcessorParameter, allowing the host to manipulate and automate internal values within the Vital synth engine.
This class extends JUCE's AudioProcessorParameter
to expose internal Vital parameters as host-facing automation parameters. It handles conversions between normalized (0.0 to 1.0) parameter values and the internal engine's value ranges, as well as skewing/scaling functions (e.g., exponential, quadratic) that convert between user-facing displays and engine values.
◆ ValueBridge() [1/2]
ValueBridge::ValueBridge |
( |
| ) |
|
|
delete |
Deleted default constructor.
◆ ValueBridge() [2/2]
ValueBridge::ValueBridge |
( |
std::string | name, |
|
|
vital::Value * | value ) |
|
inline |
Constructs a ValueBridge to expose a Vital parameter as a host-automatable parameter.
- Parameters
-
name | The parameter's name (used to look up details and for automation labeling). |
value | A pointer to the internal Vital parameter value object. |
◆ convertToEngineValue()
Converts a normalized (0.0 to 1.0) parameter value back into the engine's range.
If the parameter is indexed, the returned value is rounded to the nearest integer.
- Parameters
-
plugin_value | The normalized parameter value. |
- Returns
- The engine's parameter value.
◆ convertToPluginValue()
Converts the internal engine value to a normalized value from 0.0 to 1.0.
- Parameters
-
synth_value | The engine's parameter value. |
- Returns
- A normalized value from 0.0 to 1.0.
◆ getDefaultValue()
float ValueBridge::getDefaultValue |
( |
| ) |
const |
|
inlineoverride |
Returns the default normalized value of this parameter.
- Returns
- The default normalized value.
◆ getLabel()
String ValueBridge::getLabel |
( |
| ) |
const |
|
inlineoverride |
Returns the label (unit) associated with this parameter.
For this parameter bridge, it's typically an empty string.
- Returns
- The label of the parameter.
◆ getName()
String ValueBridge::getName |
( |
int | maximumStringLength | ) |
const |
|
inlineoverride |
Returns the display name of this parameter, truncated to a given length.
- Parameters
-
maximumStringLength | The maximum length of the returned string. |
- Returns
- The truncated parameter name.
◆ getNumSteps()
int ValueBridge::getNumSteps |
( |
| ) |
const |
|
inlineoverride |
Returns the number of discrete steps this parameter has, if any.
If the parameter is discrete and indexed, the number of steps is 1 + span. Otherwise, defer to the base class.
- Returns
- The number of steps as an integer.
◆ getText()
String ValueBridge::getText |
( |
float | value, |
|
|
int | maximumStringLength ) const |
|
inlineoverride |
Converts a normalized value into a user-facing text string.
Converts the provided normalized value back into the engine's range, potentially applying skewing or exponential transforms, and formats it as a string with units. If a string lookup table is available, it is used.
- Parameters
-
value | The normalized parameter value. |
maximumStringLength | The maximum allowed length of the returned string. |
- Returns
- A string representation of the parameter value.
◆ getValue()
float ValueBridge::getValue |
( |
| ) |
const |
|
inlineoverride |
Gets the current normalized (0.0 to 1.0) value of the parameter.
- Returns
- The parameter value as a normalized float.
◆ getValueForText()
float ValueBridge::getValueForText |
( |
const String & | text | ) |
const |
|
inlineoverride |
Converts a user-facing string back into a normalized parameter value.
This reverses the skewing/scaling and units applied in getText()
.
- Parameters
-
text | The string representing a parameter value. |
- Returns
- The corresponding normalized parameter value.
◆ isAutomatable()
bool ValueBridge::isAutomatable |
( |
| ) |
const |
|
inlineoverride |
Indicates whether this parameter can be automated by the host.
- Returns
- True if the parameter is automatable.
◆ isBoolean()
bool ValueBridge::isBoolean |
( |
| ) |
const |
|
inlineoverride |
Checks if this parameter is essentially a boolean (on/off) parameter.
- Returns
- True if the parameter has only two discrete states, false otherwise.
◆ isDiscrete()
bool ValueBridge::isDiscrete |
( |
| ) |
const |
|
inlineoverride |
Checks if this parameter is discrete (indexed steps) or continuous.
- Returns
- True if the parameter is discrete, false otherwise.
◆ setListener()
void ValueBridge::setListener |
( |
Listener * | listener | ) |
|
|
inline |
Sets a listener to receive parameter change callbacks.
- Parameters
-
listener | A pointer to a Listener implementation, or nullptr to remove the listener. |
◆ setValue()
void ValueBridge::setValue |
( |
float | value | ) |
|
|
inlineoverride |
Sets the parameter value from a normalized (0.0 to 1.0) float.
Notifies the listener if one is set. This method updates the internal engine value by converting from the normalized range.
- Parameters
-
value | The new normalized value of the parameter. |
◆ setValueNotifyHost()
void ValueBridge::setValueNotifyHost |
( |
float | new_value | ) |
|
|
inline |
Sets the parameter value and notifies the host, preventing recursive updates.
- Parameters
-
new_value | The new normalized parameter value. |
The documentation for this class was generated from the following file: