Skip to content

Class daisy::MappedFloatValue

ClassList > daisy > MappedFloatValue

Inherits the following classes: daisy::MappedValue

Public Types

Type Name
enum Mapping

Public Functions

Type Name
virtual void AppentToString (FixedCapStrBase< char > & string) override const
float Get () const
virtual float GetAs0to1 () override const
const float * GetPtr () const
MappedFloatValue (float min, float max, float defaultValue, Mapping mapping=Mapping::lin, const char * unitStr="", uint8_t numDecimals=1, bool forceSign=false)
virtual void ResetToDefault () override
void Set (float newValue)
virtual void SetFrom0to1 (float normalizedValue0to1) override
virtual void Step (int16_t numStepsUp, bool useCoarseStepSize) override
operator float () const
MappedFloatValue & operator= (float val)
~MappedFloatValue () override

Public Functions inherited from daisy::MappedValue

See daisy::MappedValue

Type Name
virtual void AppentToString (FixedCapStrBase< char > & string) const = 0
virtual float GetAs0to1 () const = 0
virtual void ResetToDefault () = 0
virtual void SetFrom0to1 (float normalizedValue0to1) = 0
virtual void Step (int16_t numStepsUp, bool useCoarseStepSize) = 0
virtual ~MappedValue ()

Public Types Documentation

enum Mapping

enum daisy::MappedFloatValue::Mapping {
    lin,
    log,
    pow2
};

The availablke mapping functions


Public Functions Documentation

function AppentToString

virtual void daisy::MappedFloatValue::AppentToString (
    FixedCapStrBase < char > & string
) override const

Generates a string representation and adds it to an existing string.

Parameters:

  • string The string to add to

Implements daisy::MappedValue::AppentToString


function Get

inline float daisy::MappedFloatValue::Get () const

Returns the current value.


function GetAs0to1

virtual float daisy::MappedFloatValue::GetAs0to1 () override const

Returns the 0..1 normalized representation of the value, e.g. to display a slider/knob on a UI.

Implements daisy::MappedValue::GetAs0to1


function GetPtr

inline const  float * daisy::MappedFloatValue::GetPtr () const

Returns a const pointer to the current value.


function MappedFloatValue

daisy::MappedFloatValue::MappedFloatValue (
    float min,
    float max,
    float defaultValue,
    Mapping mapping=Mapping::lin,
    const  char * unitStr="",
    uint8_t numDecimals=1,
    bool forceSign=false
) 

Creates a MappedFloatValue.

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 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

function ResetToDefault

virtual void daisy::MappedFloatValue::ResetToDefault () override

Resets the value to its default.

Implements daisy::MappedValue::ResetToDefault


function Set

void daisy::MappedFloatValue::Set (
    float newValue
) 

Sets the value, clamping it to the valid range.


function SetFrom0to1

virtual void daisy::MappedFloatValue::SetFrom0to1 (
    float normalizedValue0to1
) override

Sets the value so that GetAs0to1() returns normalizedValue0to1.

Implements daisy::MappedValue::SetFrom0to1


function Step

virtual void daisy::MappedFloatValue::Step (
    int16_t numStepsUp,
    bool useCoarseStepSize
) override

Steps the 0..1 normalized representation of the value up or down in 1% or 5% steps.

Implements daisy::MappedValue::Step


function operator float

inline daisy::MappedFloatValue::operator float () const

Returns the current value.


function operator=

inline MappedFloatValue & daisy::MappedFloatValue::operator= (
    float val
) 

Sets the value, clamping it to the valid range.


function ~MappedFloatValue

inline daisy::MappedFloatValue::~MappedFloatValue () override


The documentation for this class was generated from the following file external-docs/libDaisy/src/util/MappedValue.h