daisy::MappedFloatValue¶
#include <MappedValue.h>
Inherits from daisy::MappedValue
Public Types¶
Name | |
---|---|
enum class | Mapping |
Public Functions¶
Name | |
---|---|
MappedFloatValue(float min, float max, float defaultValue, Mapping mapping =Mapping::lin, const char * unitStr ="", uint8_t numDecimals =1, bool forceSign =false) | |
~MappedFloatValue() override | |
float | Get() const |
const float * | GetPtr() const |
void | Set(float newValue) |
operator float() const | |
MappedFloatValue & | operator=(float val) |
virtual void | AppentToString(FixedCapStrBase< char > & string) const override |
virtual void | ResetToDefault() override |
virtual float | GetAs0to1() const override |
virtual void | SetFrom0to1(float normalizedValue0to1) override |
virtual void | Step(int16_t numStepsUp, bool useCoarseStepSize) override |
Additional inherited members¶
Public Functions inherited from daisy::MappedValue
Name | |
---|---|
virtual | ~MappedValue() |
Public Types Documentation¶
enum Mapping¶
Enumerator | Value | Description |
---|---|---|
lin | The value is mapped linearly between min and max. | |
log | The value is mapped logarithmically. Note that the valid values must be strictly larger than zero, so: min > 0, max > 0 | |
pow2 | The value is mapped with a square law |
The availablke mapping functions
Public Functions Documentation¶
function MappedFloatValue¶
MappedFloatValue(
float min,
float max,
float defaultValue,
Mapping mapping =Mapping::lin,
const char * unitStr ="",
uint8_t numDecimals =1,
bool forceSign =false
)
Parameters:
- min The lower end of the range of possible values
- max The upper end of the range of possible values
- defaultValue The default value
- mapping The
Mapping
to use. Note that for[Mapping::log](/libDaisy/Classes/classdaisy_1_1_mapped_float_value/#enumvalue-log)``min
,max
and`defaultValue
must be > 0 - unitStr A string for the unit, e.g. "Hz"
- numDecimals Controls the number of decimals in
AppendToString()
- forceSign Controls whether
AppendToString()
always prints the sign, even for positive numbers
Creates a MappedFloatValue.
function ~MappedFloatValue¶
function Get¶
Returns the current value.
function GetPtr¶
Returns a const pointer to the current value.
function Set¶
Sets the value, clamping it to the valid range.
function operator float¶
Returns the current value.
function operator=¶
Sets the value, clamping it to the valid range.
function AppentToString¶
Parameters:
- string The string to add to
Reimplements: daisy::MappedValue::AppentToString
Generates a string representation and adds it to an existing string.
function ResetToDefault¶
Reimplements: daisy::MappedValue::ResetToDefault
Resets the value to its default.
function GetAs0to1¶
Reimplements: daisy::MappedValue::GetAs0to1
Returns the 0..1 normalized representation of the value, e.g. to display a slider/knob on a UI.
function SetFrom0to1¶
Reimplements: daisy::MappedValue::SetFrom0to1
Sets the value so that [GetAs0to1()](/libDaisy/Classes/classdaisy_1_1_mapped_float_value/#function-getas0to1)
returns normalizedValue0to1
.
function Step¶
Reimplements: daisy::MappedValue::Step
Steps the 0..1 normalized representation of the value up or down in 1% or 5% steps.
---¶
Updated on 2024-01-03 at 19:41:00 +0000