Skip to content

Commit

Permalink
update to SwitchQuantity
Browse files Browse the repository at this point in the history
  • Loading branch information
stoermelder committed Apr 18, 2024
1 parent e301772 commit 43c6842
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/Bolt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct BoltModule : Module {
configInput(IN + 3, "Logic 4");
configOutput(OUTPUT, "Logic");

configParam<TriggerParamQuantity>(OP_PARAM, 0.0f, 1.0f, 0.0f, "Next operator");
configSwitch(OP_PARAM, 0.0f, 1.0f, 0.0f, "Next operator");
lightDivider.setDivision(1024);
onReset();
}
Expand Down
4 changes: 2 additions & 2 deletions src/EightFace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ struct EightFaceModule : Module {
configInput(SLOT_INPUT, "Slot selection");
inputInfos[SLOT_INPUT]->description = "Operating mode is set on the context menu.";
configInput(RESET_INPUT, "Reset");
configParam<TriggerParamQuantity>(CTRLMODE_PARAM, 0, 2, 0, "Read/Auto/Write mode");
configSwitch(CTRLMODE_PARAM, 0.f, 2.f, 0.f, "Operating mode", {"Read", "Auto", "Write"});
for (int i = 0; i < NUM_PRESETS; i++) {
configParam(PRESET_PARAM + i, 0, 1, 0, string::f("Preset slot %d", i + 1));
configSwitch(PRESET_PARAM + i, 0.f, 1.f, 0.f, string::f("Preset slot %d", i + 1));
typeButtons[i].param = &params[PRESET_PARAM + i];
presetSlotUsed[i] = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/EightFaceMk2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct EightFaceMk2Module : EightFaceMk2Base<NUM_PRESETS> {
EightFaceMk2Module() {
BASE::panelTheme = pluginSettings.panelThemeDefault;
Module::config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
Module::configSwitch(PARAM_RW, 0.0, 2.0, 0.0, "Operating mode", {"Read", "Auto", "Write"});
Module::configSwitch(PARAM_RW, 0.f, 2.f, 0.f, "Operating mode", {"Read", "Auto", "Write"});
Module::configInput(INPUT_CV, "Slot-selection");
Module::inputInfos[INPUT_CV]->description = "Channel 2 can retrigger the current slot in C4 mode";
Module::configInput(INPUT_RESET, "Sequencer-mode reset");
Expand Down
4 changes: 2 additions & 2 deletions src/FourRounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ struct FourRoundsModule : Module {
}
configOutput(WINNER_OUTPUT, "Contest champion");
outputInfos[WINNER_OUTPUT]->description = "The \"winner\" of the two contestants of round 3.";
configParam<TriggerParamQuantity>(TRIG_PARAM, 0.0f, 1.0f, 0.0f, "New contest trigger");
configParam<TriggerParamQuantity>(INV_PARAM, 0.0f, 1.0f, 0.0f, "Invert state trigger");
configSwitch(TRIG_PARAM, 0.0f, 1.0f, 0.0f, "New contest trigger");
configSwitch(INV_PARAM, 0.0f, 1.0f, 0.0f, "Invert state trigger");
lightDivider.setDivision(1024);
onReset();
}
Expand Down
10 changes: 5 additions & 5 deletions src/Glue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ struct GlueModule : Module, StripIdFixModule {
GlueModule() {
panelTheme = pluginSettings.panelThemeDefault;
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam<TriggerParamQuantity>(PARAM_UNLOCK, 0.f, 1.f, 0.f, "Unlock labels for editing (" RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME "+G");
configParam<TriggerParamQuantity>(PARAM_ADD_LABEL, 0.f, 1.f, 0.f, "Add label (" RACK_MOD_CTRL_NAME "+G)");
configParam<TriggerParamQuantity>(PARAM_OPACITY_PLUS, 0.f, 1.f, 0.f, string::f("Increase overall opacity by %i%%", int(LABEL_OPACITY_STEP * 100)));
configParam<TriggerParamQuantity>(PARAM_OPACITY_MINUS, 0.f, 1.f, 0.f, string::f("Decrease overall opacity by %i%%", int(LABEL_OPACITY_STEP * 100)));
configParam<TriggerParamQuantity>(PARAM_HIDE, 0.f, 1.f, 0.f, "Hide labels");
configSwitch(PARAM_UNLOCK, 0.f, 1.f, 0.f, "Unlock labels for editing (" RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME "+G");
configSwitch(PARAM_ADD_LABEL, 0.f, 1.f, 0.f, "Add label (" RACK_MOD_CTRL_NAME "+G)");
configSwitch(PARAM_OPACITY_PLUS, 0.f, 1.f, 0.f, string::f("Increase overall opacity by %i%%", int(LABEL_OPACITY_STEP * 100)));
configSwitch(PARAM_OPACITY_MINUS, 0.f, 1.f, 0.f, string::f("Decrease overall opacity by %i%%", int(LABEL_OPACITY_STEP * 100)));
configSwitch(PARAM_HIDE, 0.f, 1.f, 0.f, "Hide labels");
onReset();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Goto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct GotoModule : Module {
configInput(INPUT_TRIG, "Jump point trigger");
inputInfos[INPUT_TRIG]->description = "Operating mode is set on the context menu.";
for (int i = 0; i < SLOTS; i++) {
configParam<TriggerParamQuantity>(PARAM_SLOT + i, 0, 1, 0, string::f("Jump point %i (SHIFT+%i)\nShort-press to jumo\nLong-press to learn/clear", i + 1, (i + 1) % 10));
configSwitch(PARAM_SLOT + i, 0, 1, 0, string::f("Jump point %i (SHIFT+%i)\nShort-press to jumo\nLong-press to learn/clear", i + 1, (i + 1) % 10));
}
onReset();
}
Expand Down
8 changes: 4 additions & 4 deletions src/Intermix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,18 @@ struct IntermixModule : Module, IntermixBase<PORTS> {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configInput(INPUT_SCENE, "Scene selection");
for (int i = 0; i < SCENE_MAX; i++) {
configParam(PARAM_SCENE + i, 0.f, 1.f, 0.f, string::f("Scene %i", i + 1));
configSwitch(PARAM_SCENE + i, 0.f, 1.f, 0.f, string::f("Scene %i", i + 1));
}
for (int i = 0; i < PORTS; i++) {
configInput(INPUT + i, string::f("Signal %i", i + 1));
configOutput(OUTPUT + i, string::f("Mix %i", i + 1));
for (int j = 0; j < PORTS; j++) {
configParam<MatrixButtonParamQuantity>(PARAM_MATRIX + i * PORTS + j, 0.f, 1.f, 0.f, string::f("Input %i to Output %i", j + 1, i + 1));
}
configParam(PARAM_OUTPUT + i, 0.f, 1.f, 0.f, string::f("Output %i disable", i + 1));
configSwitch(PARAM_OUTPUT + i, 0.f, 1.f, 0.f, string::f("Output %i disable", i + 1));
configParam(PARAM_AT + i, -2.f, 2.f, 1.f, string::f("Output %i attenuverter", i + 1), "x");
configParam(PARAM_X_MAP + i, 0.f, 1.f, 0.f, string::f("Matrix col %i", i + 1));
configParam(PARAM_Y_MAP + i, 0.f, 1.f, 0.f, string::f("Matrix row %i", i + 1));
configSwitch(PARAM_X_MAP + i, 0.f, 1.f, 0.f, string::f("Matrix col %i", i + 1));
configSwitch(PARAM_Y_MAP + i, 0.f, 1.f, 0.f, string::f("Matrix row %i", i + 1));
}
configParam(PARAM_FADEIN, 0.f, 4.f, 0.f, "Fade in", "s");
configParam(PARAM_FADEOUT, 0.f, 4.f, 0.f, "Fade out", "s");
Expand Down
16 changes: 8 additions & 8 deletions src/MidiCat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1670,15 +1670,15 @@ struct MidiCatWidget : ThemedModuleWidget<MidiCatModule>, ParamWidgetContextExte
MidiCatDisplay* mapWidget;

Module* expMem;
BufferedTriggerParamQuantity* expMemPrevQuantity;
BufferedSwitchQuantity* expMemPrevQuantity;
dsp::SchmittTrigger expMemPrevTrigger;
BufferedTriggerParamQuantity* expMemNextQuantity;
BufferedSwitchQuantity* expMemNextQuantity;
dsp::SchmittTrigger expMemNextTrigger;
BufferedTriggerParamQuantity* expMemParamQuantity;
BufferedSwitchQuantity* expMemParamQuantity;
dsp::SchmittTrigger expMemParamTrigger;

MidiCatCtxBase* expCtx;
BufferedTriggerParamQuantity* expCtxMapQuantity;
BufferedSwitchQuantity* expCtxMapQuantity;
dsp::SchmittTrigger expCtxMapTrigger;

enum class LEARN_MODE {
Expand Down Expand Up @@ -1808,11 +1808,11 @@ struct MidiCatWidget : ThemedModuleWidget<MidiCatModule>, ParamWidgetContextExte
if (module->expMem != expMem) {
expMem = module->expMem;
if (expMem) {
expMemPrevQuantity = dynamic_cast<BufferedTriggerParamQuantity*>(expMem->paramQuantities[1]);
expMemPrevQuantity = dynamic_cast<BufferedSwitchQuantity*>(expMem->paramQuantities[1]);
expMemPrevQuantity->resetBuffer();
expMemNextQuantity = dynamic_cast<BufferedTriggerParamQuantity*>(expMem->paramQuantities[2]);
expMemNextQuantity = dynamic_cast<BufferedSwitchQuantity*>(expMem->paramQuantities[2]);
expMemNextQuantity->resetBuffer();
expMemParamQuantity = dynamic_cast<BufferedTriggerParamQuantity*>(expMem->paramQuantities[0]);
expMemParamQuantity = dynamic_cast<BufferedSwitchQuantity*>(expMem->paramQuantities[0]);
expMemParamQuantity->resetBuffer();
}
}
Expand All @@ -1836,7 +1836,7 @@ struct MidiCatWidget : ThemedModuleWidget<MidiCatModule>, ParamWidgetContextExte
if (module->expCtx != (Module*)expCtx) {
expCtx = dynamic_cast<MidiCatCtxBase*>(module->expCtx);
if (expCtx) {
expCtxMapQuantity = dynamic_cast<BufferedTriggerParamQuantity*>(expCtx->paramQuantities[0]);
expCtxMapQuantity = dynamic_cast<BufferedSwitchQuantity*>(expCtx->paramQuantities[0]);
expCtxMapQuantity->resetBuffer();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/MidiCatCtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct MidiCatCtxModule : MidiCatCtxBase {
MidiCatCtxModule() {
panelTheme = pluginSettings.panelThemeDefault;
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam<BufferedTriggerParamQuantity>(PARAM_MAP, 0.f, 1.f, 0.f, "Start parameter mapping");
configSwitch<BufferedSwitchQuantity>(PARAM_MAP, 0.f, 1.f, 0.f, "Start parameter mapping");
onReset();
}

Expand Down
6 changes: 3 additions & 3 deletions src/MidiCatMem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ struct MidiCatMemModule : Module {
MidiCatMemModule() {
panelTheme = pluginSettings.panelThemeDefault;
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam<BufferedTriggerParamQuantity>(PARAM_PREV, 0.f, 1.f, 0.f, "Scan for previous module mapping");
configParam<BufferedTriggerParamQuantity>(PARAM_NEXT, 0.f, 1.f, 0.f, "Scan for next module mapping");
configParam<BufferedTriggerParamQuantity>(PARAM_APPLY, 0.f, 1.f, 0.f, "Apply mapping");
configSwitch<BufferedSwitchQuantity>(PARAM_PREV, 0.f, 1.f, 0.f, "Scan for previous module mapping");
configSwitch<BufferedSwitchQuantity>(PARAM_NEXT, 0.f, 1.f, 0.f, "Scan for next module mapping");
configSwitch<BufferedSwitchQuantity>(PARAM_APPLY, 0.f, 1.f, 0.f, "Apply mapping");
onReset();
}

Expand Down
10 changes: 5 additions & 5 deletions src/ReMove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ struct ReMoveModule : MapModuleBase<1> {
ReMoveModule() {
panelTheme = pluginSettings.panelThemeDefault;
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam<TriggerParamQuantity>(SEQP_PARAM, 0.0f, 1.0f, 0.0f, "Previous sequence");
configParam<TriggerParamQuantity>(SEQN_PARAM, 0.0f, 1.0f, 0.0f, "Next sequence");
configParam<TriggerParamQuantity>(RUN_PARAM, 0.0f, 1.0f, 0.0f, "Run");
configParam<TriggerParamQuantity>(RESET_PARAM, 0.0f, 1.0f, 0.0f, "Reset");
configParam<TriggerParamQuantity>(REC_PARAM, 0.0f, 1.0f, 0.0f, "Record");
configSwitch(SEQP_PARAM, 0.0f, 1.0f, 0.0f, "Previous sequence");
configSwitch(SEQN_PARAM, 0.0f, 1.0f, 0.0f, "Next sequence");
configSwitch(RUN_PARAM, 0.0f, 1.0f, 0.0f, "Run");
configSwitch(RESET_PARAM, 0.0f, 1.0f, 0.0f, "Reset");
configSwitch(REC_PARAM, 0.0f, 1.0f, 0.0f, "Record");
configParam(SLEW_PARAM, 0.0f, 0.975f, 0.0f, "Slew");

seqData = new float[REMOVE_MAX_DATA];
Expand Down
2 changes: 1 addition & 1 deletion src/Spin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct SpinModule : Module {
configOutput(OUTPUT_DEC, "Mouse wheel down trigger");
configOutput(OUTPUT_INC, "Mouse wheel up trigger");
configOutput(OUTPUT_CLICK, "Middle mouse button trigger");
configParam<TriggerParamQuantity>(PARAM_ONLY, 0.f, 1.f, 1.f, "Only active while parameter-hovering");
configSwitch(PARAM_ONLY, 0.f, 1.f, 1.f, "Only active while parameter-hovering");
onReset();
}

Expand Down
10 changes: 5 additions & 5 deletions src/Strip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ struct StripModule : StripModuleBase {
StripModule() {
panelTheme = pluginSettings.panelThemeDefault;
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam<TriggerParamQuantity>(MODE_PARAM, 0, 1, 0, "Toggle left/right mode");
configSwitch(MODE_PARAM, 0.f, 1.f, 0.f, "Toggle left/right mode");
configInput(ON_INPUT, "Strip on/toggle trigger");
configParam<TriggerParamQuantity>(ON_PARAM, 0, 1, 0, "Switch/toggle strip on");
configSwitch(ON_PARAM, 0.f, 1.f, 0.f, "Switch/toggle strip on");
configInput(OFF_INPUT, "Strip off trigger");
configParam<TriggerParamQuantity>(OFF_PARAM, 0, 1, 0, "Switch strip off");
configSwitch(OFF_PARAM, 0.f, 1.f, 0.f, "Switch strip off");
configInput(RAND_INPUT, "Strip randomization trigger");
configParam<TriggerParamQuantity>(RAND_PARAM, 0, 1, 0, "Randomize strip");
configParam(EXCLUDE_PARAM, 0, 1, 0, "Parameter randomization include/exclude");
configSwitch(RAND_PARAM, 0.f, 1.f, 0.f, "Randomize strip");
configParam(EXCLUDE_PARAM, 0.f, 1.f, 0.f, "Parameter randomization include/exclude");

lightDivider.setDivision(1024);
onReset();
Expand Down
2 changes: 1 addition & 1 deletion src/Transit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ struct TransitModule : TransitBase<NUM_PRESETS> {
TransitModule() {
BASE::panelTheme = pluginSettings.panelThemeDefault;
Module::config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
Module::configParam<TriggerParamQuantity>(PARAM_CTRLMODE, 0, 2, 0, "Read/Auto/Write mode");
Module::configSwitch(PARAM_CTRLMODE, 0.f, 2.f, 0.f, "Operating mode", {"Read", "Auto", "Write"});
for (int i = 0; i < NUM_PRESETS; i++) {
TransitParamQuantity<NUM_PRESETS>* pq = Module::configParam<TransitParamQuantity<NUM_PRESETS>>(PARAM_PRESET + i, 0, 1, 0);
pq->id = i;
Expand Down
4 changes: 2 additions & 2 deletions src/components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,11 @@ struct TriggerParamQuantity : ParamQuantity {
}
};

struct BufferedTriggerParamQuantity : TriggerParamQuantity {
struct BufferedSwitchQuantity : SwitchQuantity {
float buffer = false;
void setValue(float value) override {
if (value >= 1.f) buffer = true;
TriggerParamQuantity::setValue(value);
SwitchQuantity::setValue(value);
}
void resetBuffer() {
buffer = false;
Expand Down

0 comments on commit 43c6842

Please sign in to comment.