From 09d608938f580824f01ae637bc4cf601e4e194fd Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 9 Nov 2021 19:49:28 +0000 Subject: [PATCH] Make HostCV module bipolar switches split between 1-5 and 6-10 --- .github/workflows/build.yml | 4 +-- plugins/Cardinal/src/HostCV.cpp | 55 ++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92f059c..2b97641 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -356,14 +356,14 @@ jobs: done - name: Test VST2 plugin run: | - for p in $(ls bin/ | grep vst); do \ + for p in $(ls bin/*.vst/*.so); do \ env CARLA_BRIDGE_DUMMY=1 CARLA_BRIDGE_TESTING=native \ valgrind \ --error-exitcode=255 \ --leak-check=no \ --track-origins=yes \ --suppressions=./dpf/utils/valgrind-dpf.supp \ - /usr/lib/carla/carla-bridge-native vst2 ./bin/${p}/*.so "" 1>/dev/null; \ + /usr/lib/carla/carla-bridge-native vst2 ./bin/${p} "" 1>/dev/null; \ done # - name: Test VST3 plugin # run: | diff --git a/plugins/Cardinal/src/HostCV.cpp b/plugins/Cardinal/src/HostCV.cpp index cb98370..b69192b 100644 --- a/plugins/Cardinal/src/HostCV.cpp +++ b/plugins/Cardinal/src/HostCV.cpp @@ -23,8 +23,10 @@ USE_NAMESPACE_DISTRHO; struct HostCV : Module { enum ParamIds { - BIPOLAR_INPUTS, - BIPOLAR_OUTPUTS, + BIPOLAR_INPUTS_1_5, + BIPOLAR_INPUTS_6_10, + BIPOLAR_OUTPUTS_1_5, + BIPOLAR_OUTPUTS_6_10, NUM_PARAMS }; enum InputIds { @@ -40,8 +42,10 @@ struct HostCV : Module { HostCV() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - configParam(BIPOLAR_INPUTS, 0.f, 1.f, 1.f, "Bipolar Inputs")->randomizeEnabled = false; - configParam(BIPOLAR_OUTPUTS, 0.f, 1.f, 1.f, "Bipolar Outputs")->randomizeEnabled = false; + configParam(BIPOLAR_INPUTS_1_5, 0.f, 1.f, 0.f, "Bipolar Inputs 1-5")->randomizeEnabled = false; + configParam(BIPOLAR_INPUTS_6_10, 0.f, 1.f, 0.f, "Bipolar Inputs 6-10")->randomizeEnabled = false; + configParam(BIPOLAR_OUTPUTS_1_5, 0.f, 1.f, 0.f, "Bipolar Outputs 1-5")->randomizeEnabled = false; + configParam(BIPOLAR_OUTPUTS_6_10, 0.f, 1.f, 0.f, "Bipolar Outputs 6-10")->randomizeEnabled = false; CardinalPluginContext* const pcontext = reinterpret_cast(APP); @@ -73,13 +77,24 @@ struct HostCV : Module { return; const uint32_t dataFrame = pcontext->dataFrame++; - const float inputOffset = params[BIPOLAR_INPUTS].getValue() > 0.1f ? 5.0f : 0.0f; - const float outputOffset = params[BIPOLAR_OUTPUTS].getValue() > 0.1f ? 5.0f : 0.0f; + float inputOffset, outputOffset; - for (int i=0; i<10; ++i) + inputOffset = params[BIPOLAR_INPUTS_1_5].getValue() > 0.1f ? 5.0f : 0.0f; + outputOffset = params[BIPOLAR_OUTPUTS_1_5].getValue() > 0.1f ? 5.0f : 0.0f; + + for (int i=0; i<5; ++i) + { + outputs[i].setVoltage(dataIns[i+2][dataFrame] - outputOffset); + dataOuts[i+2][dataFrame] = inputs[i].getVoltage() + inputOffset; + } + + inputOffset = params[BIPOLAR_INPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f; + outputOffset = params[BIPOLAR_OUTPUTS_6_10].getValue() > 0.1f ? 5.0f : 0.0f; + + for (int i=5; i<10; ++i) { - outputs[i].setVoltage(dataIns[i+2][dataFrame] - inputOffset); - dataOuts[i+2][dataFrame] = inputs[i].getVoltage() + outputOffset; + outputs[i].setVoltage(dataIns[i+2][dataFrame] - outputOffset); + dataOuts[i+2][dataFrame] = inputs[i].getVoltage() + inputOffset; } } } @@ -153,14 +168,24 @@ struct HostCVWidget : ModuleWidget { { menu->addChild(new ui::MenuSeparator); - menu->addChild(createCheckMenuItem("Bipolar Inputs", "", - [=]() {return module->params[HostCV::BIPOLAR_INPUTS].getValue() > 0.1f;}, - [=]() {module->params[HostCV::BIPOLAR_INPUTS].setValue(1.0f - module->params[HostCV::BIPOLAR_INPUTS].getValue());} + menu->addChild(createCheckMenuItem("Bipolar Inputs 1-5", "", + [=]() {return module->params[HostCV::BIPOLAR_INPUTS_1_5].getValue() > 0.1f;}, + [=]() {module->params[HostCV::BIPOLAR_INPUTS_1_5].setValue(1.0f - module->params[HostCV::BIPOLAR_INPUTS_1_5].getValue());} + )); + + menu->addChild(createCheckMenuItem("Bipolar Inputs 6-10", "", + [=]() {return module->params[HostCV::BIPOLAR_INPUTS_6_10].getValue() > 0.1f;}, + [=]() {module->params[HostCV::BIPOLAR_INPUTS_6_10].setValue(1.0f - module->params[HostCV::BIPOLAR_INPUTS_6_10].getValue());} + )); + + menu->addChild(createCheckMenuItem("Bipolar Outputs 1-5", "", + [=]() {return module->params[HostCV::BIPOLAR_OUTPUTS_1_5].getValue() > 0.1f;}, + [=]() {module->params[HostCV::BIPOLAR_OUTPUTS_1_5].setValue(1.0f - module->params[HostCV::BIPOLAR_OUTPUTS_1_5].getValue());} )); - menu->addChild(createCheckMenuItem("Bipolar Outputs", "", - [=]() {return module->params[HostCV::BIPOLAR_OUTPUTS].getValue() > 0.1f;}, - [=]() {module->params[HostCV::BIPOLAR_OUTPUTS].setValue(1.0f - module->params[HostCV::BIPOLAR_OUTPUTS].getValue());} + menu->addChild(createCheckMenuItem("Bipolar Outputs 6-10", "", + [=]() {return module->params[HostCV::BIPOLAR_OUTPUTS_6_10].getValue() > 0.1f;}, + [=]() {module->params[HostCV::BIPOLAR_OUTPUTS_6_10].setValue(1.0f - module->params[HostCV::BIPOLAR_OUTPUTS_6_10].getValue());} )); } };