Browse Source

Make HostCV module bipolar switches split between 1-5 and 6-10

tags/22.02
falkTX 3 years ago
parent
commit
09d608938f
2 changed files with 42 additions and 17 deletions
  1. +2
    -2
      .github/workflows/build.yml
  2. +40
    -15
      plugins/Cardinal/src/HostCV.cpp

+ 2
- 2
.github/workflows/build.yml View File

@@ -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: |


+ 40
- 15
plugins/Cardinal/src/HostCV.cpp View File

@@ -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<SwitchQuantity>(BIPOLAR_INPUTS, 0.f, 1.f, 1.f, "Bipolar Inputs")->randomizeEnabled = false;
configParam<SwitchQuantity>(BIPOLAR_OUTPUTS, 0.f, 1.f, 1.f, "Bipolar Outputs")->randomizeEnabled = false;
configParam<SwitchQuantity>(BIPOLAR_INPUTS_1_5, 0.f, 1.f, 0.f, "Bipolar Inputs 1-5")->randomizeEnabled = false;
configParam<SwitchQuantity>(BIPOLAR_INPUTS_6_10, 0.f, 1.f, 0.f, "Bipolar Inputs 6-10")->randomizeEnabled = false;
configParam<SwitchQuantity>(BIPOLAR_OUTPUTS_1_5, 0.f, 1.f, 0.f, "Bipolar Outputs 1-5")->randomizeEnabled = false;
configParam<SwitchQuantity>(BIPOLAR_OUTPUTS_6_10, 0.f, 1.f, 0.f, "Bipolar Outputs 6-10")->randomizeEnabled = false;

CardinalPluginContext* const pcontext = reinterpret_cast<CardinalPluginContext*>(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());}
));
}
};


Loading…
Cancel
Save