libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::MappedIntValue Class Reference

#include <MappedValue.h>

Inheritance diagram for daisy::MappedIntValue:
daisy::MappedValue

Public Member Functions

 MappedIntValue (int min, int max, int defaultValue, int stepSizeFine, int stepSizeCoarse, const char *unitStr="", bool forceSign=false)
 
 ~MappedIntValue () override
 
int Get () const
 
const intGetPtr () const
 
void Set (int newValue)
 
 operator int () const
 
MappedIntValueoperator= (int val)
 
void AppentToString (FixedCapStrBase< char > &string) const override
 
void ResetToDefault () override
 
float GetAs0to1 () const override
 
void SetFrom0to1 (float normalizedValue0to1) override
 
void Step (int16_t numStepsUp, bool useCoarseStepSize) override
 
- Public Member Functions inherited from daisy::MappedValue
virtual ~MappedValue ()
 

Constructor & Destructor Documentation

◆ MappedIntValue()

daisy::MappedIntValue::MappedIntValue ( int  min,
int  max,
int  defaultValue,
int  stepSizeFine,
int  stepSizeCoarse,
const char unitStr = "",
bool  forceSign = false 
)

Creates a MappedIntValue.

Parameters
minThe lower end of the range of possible values
maxThe upper end of the range of possible values
defaultValueThe default value
stepSizeFineA fine step size to use in the Step() function
stepSizeCoarseA coarse step size to use in the Step() function
unitStrA string for the unit, e.g. "Hz"
forceSignControls whether AppendToString() always prints the sign, even for positive numbers

◆ ~MappedIntValue()

daisy::MappedIntValue::~MappedIntValue ( )
inlineoverride

Member Function Documentation

◆ AppentToString()

void daisy::MappedIntValue::AppentToString ( FixedCapStrBase< char > &  string) const
overridevirtual

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

Parameters
stringThe string to add to

Implements daisy::MappedValue.

◆ Get()

int daisy::MappedIntValue::Get ( ) const
inline

Returns the current value.

◆ GetAs0to1()

float daisy::MappedIntValue::GetAs0to1 ( ) const
overridevirtual

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

Implements daisy::MappedValue.

◆ GetPtr()

const int * daisy::MappedIntValue::GetPtr ( ) const
inline

Returns a const pointer to the current value.

◆ operator int()

daisy::MappedIntValue::operator int ( ) const
inline

Returns the current value.

◆ operator=()

MappedIntValue & daisy::MappedIntValue::operator= ( int  val)
inline

Sets the value, clamping it to the valid range.

◆ ResetToDefault()

void daisy::MappedIntValue::ResetToDefault ( )
overridevirtual

Resets the value to its default.

Implements daisy::MappedValue.

◆ Set()

void daisy::MappedIntValue::Set ( int  newValue)

Sets the value, clamping it to the valid range.

◆ SetFrom0to1()

void daisy::MappedIntValue::SetFrom0to1 ( float  normalizedValue0to1)
overridevirtual

Sets the value so that GetAs0to1() returns normalizedValue0to1.

Implements daisy::MappedValue.

◆ Step()

void daisy::MappedIntValue::Step ( int16_t  numStepsUp,
bool  useCoarseStepSize 
)
overridevirtual

Steps the value up or down using the step sizes specified in the constructor.

Implements daisy::MappedValue.


The documentation for this class was generated from the following file: