From 88133c75cea29341a369fde120464103e1c7bb68 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 5 Feb 2020 01:28:02 -0500 Subject: [PATCH] Use Rack's new configSwitch() method. --- src/LFO.cpp | 12 ++++-------- src/Random.cpp | 6 ++---- src/Unity.cpp | 6 ++---- src/VCA.cpp | 3 +-- src/VCO.cpp | 12 ++++-------- 5 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/LFO.cpp b/src/LFO.cpp index 743831e..8b13b25 100644 --- a/src/LFO.cpp +++ b/src/LFO.cpp @@ -117,10 +117,8 @@ struct LFO : Module { LFO() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - SwitchQuantity* offsetQ = configParam(OFFSET_PARAM, 0.f, 1.f, 1.f, "Offset"); - offsetQ->setLabels({"Bipolar", "Unipolar"}); - SwitchQuantity* invertQ = configParam(INVERT_PARAM, 0.f, 1.f, 1.f, "Orientation"); - invertQ->setLabels({"Inverted", "Normal"}); + configSwitch(OFFSET_PARAM, 0.f, 1.f, 1.f, "Offset", {"Bipolar", "Unipolar"}); + configSwitch(INVERT_PARAM, 0.f, 1.f, 1.f, "Orientation", {"Inverted", "Normal"}); configParam(FREQ_PARAM, -8.f, 10.f, 1.f, "Frequency", " Hz", 2, 1); configParam(FM1_PARAM, 0.f, 1.f, 0.f, "Frequency modulation 1", "%", 0.f, 100.f); configParam(PW_PARAM, 0.01f, 0.99f, 0.5f, "Pulse width", "%", 0.f, 100.f); @@ -267,10 +265,8 @@ struct LFO2 : Module { LFO2() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - SwitchQuantity* offsetQ = configParam(OFFSET_PARAM, 0.f, 1.f, 1.f, "Offset"); - offsetQ->setLabels({"Bipolar", "Unipolar"}); - SwitchQuantity* invertQ = configParam(INVERT_PARAM, 0.f, 1.f, 1.f, "Orientation"); - invertQ->setLabels({"Inverted", "Normal"}); + configSwitch(OFFSET_PARAM, 0.f, 1.f, 1.f, "Offset", {"Bipolar", "Unipolar"}); + configSwitch(INVERT_PARAM, 0.f, 1.f, 1.f, "Orientation", {"Inverted", "Normal"}); configParam(FREQ_PARAM, -8.f, 10.f, 1.f, "Frequency", " Hz", 2, 1); configParam(WAVE_PARAM, 0.f, 3.f, 1.5f, "Wave"); configParam(FM_PARAM, 0.f, 1.f, 1.f, "Frequency modulation", "%", 0.f, 100.f); diff --git a/src/Random.cpp b/src/Random.cpp index 5f42c0c..6a2054f 100644 --- a/src/Random.cpp +++ b/src/Random.cpp @@ -40,10 +40,8 @@ struct Random : Module { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configParam(RATE_PARAM, std::log2(0.002f), std::log2(2000.f), std::log2(2.f), "Rate", " Hz", 2); configParam(SHAPE_PARAM, 0.f, 1.f, 0.5f, "Shape", "%", 0, 100); - SwitchQuantity* offsetQ = configParam(OFFSET_PARAM, 0.f, 1.f, 1.f, "Offset"); - offsetQ->setLabels({"Bipolar", "Unipolar"}); - SwitchQuantity* modeQ = configParam(MODE_PARAM, 0.f, 1.f, 1.f, "Randomness mode"); - modeQ->setLabels({"Relative", "Absolute"}); + configSwitch(OFFSET_PARAM, 0.f, 1.f, 1.f, "Offset", {"Bipolar", "Unipolar"}); + configSwitch(MODE_PARAM, 0.f, 1.f, 1.f, "Randomness mode", {"Relative", "Absolute"}); configInput(RATE_INPUT, "Rate"); configInput(SHAPE_INPUT, "Shape"); configInput(TRIGGER_INPUT, "Trigger"); diff --git a/src/Unity.cpp b/src/Unity.cpp index 5a4222c..4e59118 100644 --- a/src/Unity.cpp +++ b/src/Unity.cpp @@ -29,10 +29,8 @@ struct Unity : Module { Unity() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - SwitchQuantity* avg1Q = configParam(AVG1_PARAM, 0.0, 1.0, 0.0, "Ch 1 mode"); - avg1Q->setLabels({"Sum", "Average"}); - SwitchQuantity* avg2Q = configParam(AVG2_PARAM, 0.0, 1.0, 0.0, "Ch 2 mode"); - avg2Q->setLabels({"Sum", "Average"}); + configSwitch(AVG1_PARAM, 0.0, 1.0, 0.0, "Ch 1 mode", {"Sum", "Average"}); + configSwitch(AVG2_PARAM, 0.0, 1.0, 0.0, "Ch 2 mode", {"Sum", "Average"}); for (int i = 0; i < 2; i++) { for (int j = 0; j < 6; j++) { configInput(IN_INPUTS + i * 6 + j, string::f("In %d ch %d", i + 1, j + 1)); diff --git a/src/VCA.cpp b/src/VCA.cpp index 2510a4a..9718565 100644 --- a/src/VCA.cpp +++ b/src/VCA.cpp @@ -158,8 +158,7 @@ struct VCA_1 : Module { VCA_1() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configParam(LEVEL_PARAM, 0.0, 1.0, 1.0, "Level", "%", 0, 100); - SwitchQuantity* expQ = configParam(EXP_PARAM, 0.0, 1.0, 1.0, "Response mode"); - expQ->setLabels({"Exponential", "Linear"}); + configSwitch(EXP_PARAM, 0.0, 1.0, 1.0, "Response mode", {"Exponential", "Linear"}); } diff --git a/src/VCO.cpp b/src/VCO.cpp index db6c4cc..6e76cd8 100644 --- a/src/VCO.cpp +++ b/src/VCO.cpp @@ -280,10 +280,8 @@ struct VCO : Module { VCO() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - SwitchQuantity* modeQ = configParam(MODE_PARAM, 0.f, 1.f, 1.f, "Engine mode"); - modeQ->setLabels({"Digital", "Analog"}); - SwitchQuantity* syncQ = configParam(SYNC_PARAM, 0.f, 1.f, 1.f, "Sync mode"); - syncQ->setLabels({"Soft", "Hard"}); + configSwitch(MODE_PARAM, 0.f, 1.f, 1.f, "Engine mode", {"Digital", "Analog"}); + configSwitch(SYNC_PARAM, 0.f, 1.f, 1.f, "Sync mode", {"Soft", "Hard"}); configParam(FREQ_PARAM, -54.f, 54.f, 0.f, "Frequency", " Hz", dsp::FREQ_SEMITONE, dsp::FREQ_C4); configParam(FINE_PARAM, -1.f, 1.f, 0.f, "Fine frequency"); configParam(FM_PARAM, 0.f, 1.f, 0.f, "Frequency modulation", "%", 0.f, 100.f); @@ -425,10 +423,8 @@ struct VCO2 : Module { VCO2() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - SwitchQuantity* modeQ = configParam(MODE_PARAM, 0.f, 1.f, 1.f, "Engine mode"); - modeQ->setLabels({"Digital", "Analog"}); - SwitchQuantity* syncQ = configParam(SYNC_PARAM, 0.f, 1.f, 1.f, "Sync mode"); - syncQ->setLabels({"Soft", "Hard"}); + configSwitch(MODE_PARAM, 0.f, 1.f, 1.f, "Engine mode", {"Digital", "Analog"}); + configSwitch(SYNC_PARAM, 0.f, 1.f, 1.f, "Sync mode", {"Soft", "Hard"}); configParam(FREQ_PARAM, -54.f, 54.f, 0.f, "Frequency", " Hz", dsp::FREQ_SEMITONE, dsp::FREQ_C4); configParam(WAVE_PARAM, 0.f, 3.f, 1.5f, "Wave"); configParam(FM_PARAM, 0.f, 1.f, 1.f, "Frequency modulation", "%", 0.f, 100.f);