-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
surge-fx: replace AccSlider with sst/jucegui/Knob.h (#7928)
replace the juce knob we wrote years ago with the one from sst-jucegui as step one of an fx panel rebuild. Test build automation invalidation and accessibility
- Loading branch information
Showing
5 changed files
with
135 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#ifndef SURGE_SRC_SURGE_FX_KNOBSOURCE_H | ||
#define SURGE_SRC_SURGE_FX_KNOBSOURCE_H | ||
|
||
#include <juce_gui_basics/juce_gui_basics.h> | ||
#include <sst/jucegui/data/Continuous.h> | ||
#include <sst/jucegui/util/DebugHelpers.h> | ||
|
||
struct KnobSource : sst::jucegui::data::Continuous | ||
{ | ||
KnobSource(SurgefxAudioProcessor &p, SurgeFXParamDisplay &d, int i) | ||
: processor(p), display(d), id(i) | ||
{ | ||
} | ||
|
||
std::string label{"KnobSource"}; | ||
std::string getLabel() const override { return label; } | ||
void setLabel(std::string input) { label = input; } | ||
float value{0}; | ||
float getValue() const override { return value; } | ||
float getDefaultValue() const override { return processor.getFXStorageDefaultValue01(id); } | ||
|
||
void setValueFromGUI(const float &f) override | ||
{ | ||
value = f; | ||
for (auto *l : guilisteners) | ||
l->dataChanged(); | ||
for (auto *l : modellisteners) | ||
l->dataChanged(); | ||
|
||
this->processor.setFXParamValue01(id, value); | ||
display.setDisplay(getValueAsStringFor(value)); | ||
} | ||
|
||
std::string getValueAsStringFor(float f) const override | ||
{ | ||
return processor.getParamValue(id).c_str(); | ||
} | ||
|
||
void setValueFromModel(const float &f) override | ||
{ | ||
value = f; | ||
for (auto *l : guilisteners) | ||
l->dataChanged(); | ||
display.setDisplay(getValueAsStringFor(value)); | ||
} | ||
|
||
SurgefxAudioProcessor &processor; | ||
SurgeFXParamDisplay &display; | ||
int id; | ||
}; | ||
#endif // SURGE_SRC_SURGE_FX_KNOBSOURCE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters