feat(gui): add GUI components and displays
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#include "Knob.h"
|
||||
|
||||
namespace serum
|
||||
{
|
||||
|
||||
Knob::Knob (const juce::String& name, std::function<juce::String (float)> fmt)
|
||||
: formatter (std::move (fmt))
|
||||
{
|
||||
setSliderStyle (juce::Slider::RotaryVerticalDrag);
|
||||
setTextBoxStyle (juce::Slider::NoTextBox, false, 0, 0);
|
||||
setRange (0.0, 1.0);
|
||||
setDoubleClickReturnValue (true, 0.5);
|
||||
setName (name);
|
||||
setComponentID (name);
|
||||
}
|
||||
|
||||
juce::String Knob::getTextFromValue (double value)
|
||||
{
|
||||
if (formatter)
|
||||
return formatter ((float) value);
|
||||
return formatPercent ((float) value);
|
||||
}
|
||||
|
||||
} // namespace serum
|
||||
Reference in New Issue
Block a user