MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / GetDisplayValue

Method GetDisplayValue

Source/Slider.cpp:579–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579std::string FloatSlider::GetDisplayValue(float val) const
580{
581 if (val == mMin && mMinValueDisplay != "")
582 return mMinValueDisplay;
583 if (val == mMax && mMaxValueDisplay != "")
584 return mMaxValueDisplay;
585
586 int decDigits = 3;
587 if (mShowDigits != -1)
588 decDigits = mShowDigits;
589 else if (mMax - mMin > 1000)
590 decDigits = 0;
591 else if (mMax - mMin > 100)
592 decDigits = 1;
593 else if (mMax - mMin > 10)
594 decDigits = 2;
595
596 float displayVar = val;
597 if (decDigits == 0) //round down if we're showing int value
598 displayVar = (int)displayVar;
599 return ofToString(displayVar, decDigits);
600}
601
602void FloatSlider::DoCompute(int samplesIn /*= 0*/)
603{

Callers 9

GetModuleTypeToSpawnMethod · 0.45
PollMethod · 0.45
ResyncControllerStateMethod · 0.45
TextEntryCompleteMethod · 0.45
SetUIControlMethod · 0.45
DrawModuleUnclippedMethod · 0.45
DrawContentsMethod · 0.45
PollMethod · 0.45
DrawModuleMethod · 0.45

Calls 1

ofToStringFunction · 0.85

Tested by

no test coverage detected