Make HostCV module bipolar switches split between 1-5 and 6-10
This commit is contained in:
parent
bcfae94f79
commit
09d608938f
2 changed files with 42 additions and 17 deletions
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
|
@ -356,14 +356,14 @@ jobs:
|
||||||
done
|
done
|
||||||
- name: Test VST2 plugin
|
- name: Test VST2 plugin
|
||||||
run: |
|
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 \
|
env CARLA_BRIDGE_DUMMY=1 CARLA_BRIDGE_TESTING=native \
|
||||||
valgrind \
|
valgrind \
|
||||||
--error-exitcode=255 \
|
--error-exitcode=255 \
|
||||||
--leak-check=no \
|
--leak-check=no \
|
||||||
--track-origins=yes \
|
--track-origins=yes \
|
||||||
--suppressions=./dpf/utils/valgrind-dpf.supp \
|
--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
|
done
|
||||||
# - name: Test VST3 plugin
|
# - name: Test VST3 plugin
|
||||||
# run: |
|
# run: |
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,10 @@ USE_NAMESPACE_DISTRHO;
|
||||||
|
|
||||||
struct HostCV : Module {
|
struct HostCV : Module {
|
||||||
enum ParamIds {
|
enum ParamIds {
|
||||||
BIPOLAR_INPUTS,
|
BIPOLAR_INPUTS_1_5,
|
||||||
BIPOLAR_OUTPUTS,
|
BIPOLAR_INPUTS_6_10,
|
||||||
|
BIPOLAR_OUTPUTS_1_5,
|
||||||
|
BIPOLAR_OUTPUTS_6_10,
|
||||||
NUM_PARAMS
|
NUM_PARAMS
|
||||||
};
|
};
|
||||||
enum InputIds {
|
enum InputIds {
|
||||||
|
|
@ -40,8 +42,10 @@ struct HostCV : Module {
|
||||||
HostCV()
|
HostCV()
|
||||||
{
|
{
|
||||||
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
|
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_INPUTS_1_5, 0.f, 1.f, 0.f, "Bipolar Inputs 1-5")->randomizeEnabled = false;
|
||||||
configParam<SwitchQuantity>(BIPOLAR_OUTPUTS, 0.f, 1.f, 1.f, "Bipolar Outputs")->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);
|
CardinalPluginContext* const pcontext = reinterpret_cast<CardinalPluginContext*>(APP);
|
||||||
|
|
||||||
|
|
@ -73,13 +77,24 @@ struct HostCV : Module {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const uint32_t dataFrame = pcontext->dataFrame++;
|
const uint32_t dataFrame = pcontext->dataFrame++;
|
||||||
const float inputOffset = params[BIPOLAR_INPUTS].getValue() > 0.1f ? 5.0f : 0.0f;
|
float inputOffset, outputOffset;
|
||||||
const float outputOffset = params[BIPOLAR_OUTPUTS].getValue() > 0.1f ? 5.0f : 0.0f;
|
|
||||||
|
|
||||||
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] - inputOffset);
|
outputs[i].setVoltage(dataIns[i+2][dataFrame] - outputOffset);
|
||||||
dataOuts[i+2][dataFrame] = inputs[i].getVoltage() + 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] - outputOffset);
|
||||||
|
dataOuts[i+2][dataFrame] = inputs[i].getVoltage() + inputOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -153,14 +168,24 @@ struct HostCVWidget : ModuleWidget {
|
||||||
{
|
{
|
||||||
menu->addChild(new ui::MenuSeparator);
|
menu->addChild(new ui::MenuSeparator);
|
||||||
|
|
||||||
menu->addChild(createCheckMenuItem("Bipolar Inputs", "",
|
menu->addChild(createCheckMenuItem("Bipolar Inputs 1-5", "",
|
||||||
[=]() {return module->params[HostCV::BIPOLAR_INPUTS].getValue() > 0.1f;},
|
[=]() {return module->params[HostCV::BIPOLAR_INPUTS_1_5].getValue() > 0.1f;},
|
||||||
[=]() {module->params[HostCV::BIPOLAR_INPUTS].setValue(1.0f - module->params[HostCV::BIPOLAR_INPUTS].getValue());}
|
[=]() {module->params[HostCV::BIPOLAR_INPUTS_1_5].setValue(1.0f - module->params[HostCV::BIPOLAR_INPUTS_1_5].getValue());}
|
||||||
));
|
));
|
||||||
|
|
||||||
menu->addChild(createCheckMenuItem("Bipolar Outputs", "",
|
menu->addChild(createCheckMenuItem("Bipolar Inputs 6-10", "",
|
||||||
[=]() {return module->params[HostCV::BIPOLAR_OUTPUTS].getValue() > 0.1f;},
|
[=]() {return module->params[HostCV::BIPOLAR_INPUTS_6_10].getValue() > 0.1f;},
|
||||||
[=]() {module->params[HostCV::BIPOLAR_OUTPUTS].setValue(1.0f - module->params[HostCV::BIPOLAR_OUTPUTS].getValue());}
|
[=]() {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 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…
Add table
Add a link
Reference in a new issue