BogaudioModules

BogaudioModules for VCV Rack
Log | Files | Refs | README | LICENSE

commit a4b610cf794a4b915e710bf73b29d0047e6d7be5
parent fea83cb8662f23661b63521b237ad22276620c06
Author: Matt Demanett <matt@demanett.net>
Date:   Wed, 25 Dec 2019 12:16:14 -0600

POLYCON: poly per-channel constants.

Diffstat:
Mplugin.json | 9+++++++++
Ares-src/PolyCon-src.svg | 230+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ares/PolyCon.svg | 0
Asrc/PolyCon.cpp | 123+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/PolyCon.hpp | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/PolyMult.hpp | 2+-
Msrc/bogaudio.cpp | 2++
7 files changed, 450 insertions(+), 1 deletion(-)

diff --git a/plugin.json b/plugin.json @@ -645,6 +645,15 @@ "tags": [ "Blank" ] + }, + { + "slug": "Bogaudio-PolyCon", + "name": "POLYCON", + "description": "Polyphonic per-channel constant voltages", + "tags": [ + "Utility", + "Polyphonic" + ] } ] } diff --git a/res-src/PolyCon-src.svg b/res-src/PolyCon-src.svg @@ -0,0 +1,230 @@ +<svg + version="1.1" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + width="120" + height="380" + viewBox="0 0 120 380" +> + <style> + text { + fill: #333; + font-family: 'Roboto', sans-serif; + font-weight: bold; + } + text.title { + font-family: 'Comfortaa', sans-serif; + font-weight: normal; + } + text.brand { + font-family: 'Audiowide', sans-serif; + font-weight: bold; + } + </style> + + <defs> + <symbol id="knob-smallest" viewBox="0 0 16px 16px"> + <g transform="translate(8 8)"> + <polyline points="-3,0 3,0" stroke-width="1" stroke="#00f" /> + <polyline points="0,-3 0,3" stroke-width="1" stroke="#00f" /> + <circle r="7.5" stroke-width="1" stroke="#00f" fill="none" /> + </g> + </symbol> + + <symbol id="knobguide-channels" viewBox="0 0 40px 40px"> + <g transform="translate(20 20)"> + <text font-size="5pt" transform="rotate(-240) translate(13 0) rotate(240) translate(-2 2)">1</text> + <text font-size="5pt" transform="rotate(-200) translate(13 0) rotate(200) translate(-2 2)">3</text> + <text font-size="5pt" transform="rotate(-160) translate(13 0) rotate(160) translate(-2 2)">5</text> + <text font-size="5pt" transform="rotate(-120) translate(13 0) rotate(120) translate(-2 2)">7</text> + <text font-size="5pt" transform="rotate(-80) translate(13 0) rotate(80) translate(-2 2)">9</text> + <text font-size="5pt" transform="rotate(-40) translate(13 0) rotate(40) translate(-2 2)">11</text> + <text font-size="5pt" transform="rotate(0) translate(13 0) rotate(0) translate(-2.1 2.3)">13</text> + <text font-size="5pt" transform="rotate(40) translate(13 0) rotate(-40) translate(-1.8 3)">15</text> + + <!-- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-240) translate(12 0)" /> --> + <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-220) translate(10 0)" /> + <!-- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-200) translate(12 0)" /> --> + <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-180) translate(10 0)" /> + <!-- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-160) translate(12 0)" /> --> + <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-140) translate(10 0)" /> + <!-- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-120) translate(12 0)" /> --> + <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-100) translate(10 0)" /> + <!-- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-80) translate(12 0)" /> --> + <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-60) translate(10 0)" /> + <!-- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-40) translate(12 0)" /> --> + <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-20) translate(10 0)" /> + <!-- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(0) translate(12 0)" /> --> + <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(20) translate(10 0)" /> + <!-- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(40) translate(12 0)" /> --> + <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(60) translate(10 0)" /> + </g> + </symbol> + + <symbol id="knob19" viewBox="0 0 20px 20px"> + <g transform="translate(10 10)"> + <polyline points="-3,0 3,0" stroke-width="1" stroke="#00f" /> + <polyline points="0,-3 0,3" stroke-width="1" stroke="#00f" /> + <circle cx="0" cy="0" r="9.3" stroke-width="1" stroke="#00f" fill="none" /> + </g> + </symbol> + + <symbol id="knobguide-centertick19" viewBox="0 0 40px 40px"> + <g transform="translate(20 20)"> + <polyline points="0,0 4,0" stroke-width="1" stroke="#333" transform="rotate(-90) translate(11.5 0)" /> + <path d="M 0 -13.5 A 13.5 13.5 0 0 1 13.5 0" stroke="#333" stroke-width="0.5" stroke-linecap="round" fill="none" transform="rotate(20)" /> + <path d="M 0 -13.5 A 13.5 13.5 0 0 1 13.5 0" stroke="#333" stroke-width="0.5" stroke-linecap="round" fill="none" transform="rotate(43)" /> + <path d="M 0 -13.5 A 13.5 13.5 0 0 0 -13.5 0" stroke="#333" stroke-width="0.5" stroke-linecap="round" fill="none" transform="rotate(-20)" /> + <path d="M 0 -13.5 A 13.5 13.5 0 0 0 -13.5 0" stroke="#333" stroke-width="0.5" stroke-linecap="round" fill="none" transform="rotate(-43)" /> + </g> + </symbol> + + <symbol id="input" viewBox="0 0 24px 24px"> + <g transform="translate(12 12)"> + <circle cx="0" cy="0" r="5" stroke-width="1" stroke="#0f0" fill="#0f0" /> + <circle cx="0" cy="0" r="10.5" stroke-width="3" stroke="#0f0" fill="none" /> + </g> + </symbol> + + <symbol id="output" viewBox="0 0 24px 24px"> + <g transform="translate(12 12)"> + <circle cx="0" cy="0" r="5" stroke-width="1" stroke="#f00" fill="#f00" /> + <circle cx="0" cy="0" r="10.5" stroke-width="3" stroke="#f00" fill="none" /> + </g> + </symbol> + + <symbol id="light-tiny" viewBox="0 0 1.1px 1.1px"> + <rect width="3.2" height="3.2" fill="#0f0" /> + </symbol> + </defs> + + <rect width="100%" height="100%" fill="#ddd" /> + <polyline points="1,1 119,1 119,379 1,379 1,1" stroke="#e4e4e4" stroke-width="0.5" fill="none" /> + <polyline points="0.5,0.5 119.5,0.5 119.5,379.5 0.5,379.5 0.5,0.5" stroke="#ebebeb" stroke-width="0.8" fill="none" /> + <polyline points="0,0 120,0 120,380 0,380 0,0" stroke="#f2f2f2" stroke-width="1" fill="none" /> + + <text class="title" x="40" y="17" font-size="9pt" letter-spacing="2px">POLYCON</text> + <g transform="translate(5.5 374)"> + <text class="brand" font-size="6.5pt" letter-spacing="2px">BOGAUDIO</text> + <rect width="1.5" height="2" fill="#ddd" transform="translate(21 -4)" /> + </g> + + <g transform="translate(4 31)"> + <text font-size="6pt" letter-spacing="1.5px" transform="translate(6.5 0)">CHAN</text> + <use id="CHANNELS_PARAM" xlink:href="#knob-smallest" transform="translate(12 12)" /> + <use xlink:href="#knobguide-channels" transform="translate(0 0)" /> + </g> + + <g transform="translate(51 24)"> + <rect width="60" height="40" rx="5" fill="#fafafa" /> + <rect width="24" height="40" rx="5" fill="#bbb" transform="translate(38)" /> + <rect width="20" height="40" fill="#bbb" transform="translate(31)" /> + <use id="CHANNELS_INPUT" xlink:href="#input" transform="translate(3.5 4)" /> + <use id="OUT_OUTPUT" xlink:href="#output" transform="translate(34.5 4)" /> + <text font-size="6pt" letter-spacing="1px" transform="translate(3 36)">CHAN</text> + <text font-size="6pt" letter-spacing="2px" transform="translate(36 36)">OUT</text> + </g> + + <!-- <polyline points="0,0 0,380" stroke="#0f0" stroke-width="1" fill="none" transform="translate(33.33 0)" /> --> + <!-- <polyline points="0,0 0,380" stroke="#0f0" stroke-width="1" fill="none" transform="translate(15.33 0)" /> --> + <!-- <polyline points="0,0 0,380" stroke="#0f0" stroke-width="1" fill="none" transform="translate(86.67 0)" /> --> + <!-- <polyline points="0,0 0,380" stroke="#0f0" stroke-width="1" fill="none" transform="translate(104.67 0)" /> --> + + <g transform="translate(19.5 70)"> + <use id="CHANNEL1_PARAM" xlink:href="#knob19" transform="translate(3.6 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(-6.5 20.5)">1</text> + <use id="CHANNEL1_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(19.5 107)"> + <use id="CHANNEL2_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(-7 20.5)">2</text> + <use id="CHANNEL2_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(19.5 144)"> + <use id="CHANNEL3_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(-7 20.5)">3</text> + <use id="CHANNEL3_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(19.5 181)"> + <use id="CHANNEL4_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(-7.2 20.5)">4</text> + <use id="CHANNEL4_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(19.5 218)"> + <use id="CHANNEL5_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(-7.2 20.5)">5</text> + <use id="CHANNEL5_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(19.5 255)"> + <use id="CHANNEL6_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(-7.2 20.5)">6</text> + <use id="CHANNEL6_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(19.5 292)"> + <use id="CHANNEL7_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(-7.2 20.5)">7</text> + <use id="CHANNEL7_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(19.5 329)"> + <use id="CHANNEL8_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(-7.2 20.5)">8</text> + <use id="CHANNEL8_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + + <g transform="translate(73 70)"> + <use id="CHANNEL9_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(31 20.5)">9</text> + <use id="CHANNEL9_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(73 107)"> + <use id="CHANNEL10_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(30.5 20.5)">10</text> + <use id="CHANNEL10_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(73 144)"> + <use id="CHANNEL11_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(30.5 20.5)">11</text> + <use id="CHANNEL11_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(73 181)"> + <use id="CHANNEL12_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(30.5 20.5)">12</text> + <use id="CHANNEL12_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(73 218)"> + <use id="CHANNEL13_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(30.5 20.5)">13</text> + <use id="CHANNEL13_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(73 255)"> + <use id="CHANNEL14_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(30.5 20.5)">14</text> + <use id="CHANNEL14_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(73 292)"> + <use id="CHANNEL15_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(30.5 20.5)">15</text> + <use id="CHANNEL15_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> + <g transform="translate(73 329)"> + <use id="CHANNEL16_PARAM" xlink:href="#knob19" transform="translate(3.5 8)" /> + <use xlink:href="#knobguide-centertick19" transform="translate(-6.5 -2)" /> + <text font-size="5pt" letter-spacing="1px" transform="translate(30.5 20.5)">16</text> + <use id="CHANNEL16_LIGHT" xlink:href="#light-tiny" transform="translate(12.25 30)" /> + </g> +</svg> diff --git a/res/PolyCon.svg b/res/PolyCon.svg Binary files differ. diff --git a/src/PolyCon.cpp b/src/PolyCon.cpp @@ -0,0 +1,123 @@ + +#include "PolyCon.hpp" + +void PolyCon::processChannel(const ProcessArgs& args, int c) { + assert(c == 0); + + int cn = clamp(params[CHANNELS_PARAM].getValue(), 1.0f, 16.0f); + if (inputs[CHANNELS_INPUT].isConnected()) { + cn = inputs[CHANNELS_INPUT].getChannels(); + } + + outputs[OUT_OUTPUT].setChannels(cn); + for (int c = 0; c < cn; ++c) { + outputs[OUT_OUTPUT].setVoltage(clamp(params[CHANNEL1_PARAM + c].getValue(), -1.0f, 1.0f) * 10.0f, c); + } +} + +struct PolyConWidget : ModuleWidget { + static constexpr int hp = 8; + + PolyConWidget(PolyCon* module) { + setModule(module); + box.size = Vec(RACK_GRID_WIDTH * hp, RACK_GRID_HEIGHT); + + { + SvgPanel *panel = new SvgPanel(); + panel->box.size = box.size; + panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/PolyCon.svg"))); + addChild(panel); + } + + addChild(createWidget<ScrewSilver>(Vec(0, 0))); + addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 0))); + addChild(createWidget<ScrewSilver>(Vec(0, 365))); + addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365))); + + // generated by svg_widgets.rb + auto channelsParamPosition = Vec(16.0, 43.0); + auto channel1ParamPosition = Vec(23.3, 78.2); + auto channel2ParamPosition = Vec(23.2, 115.2); + auto channel3ParamPosition = Vec(23.2, 152.2); + auto channel4ParamPosition = Vec(23.2, 189.2); + auto channel5ParamPosition = Vec(23.2, 226.2); + auto channel6ParamPosition = Vec(23.2, 263.2); + auto channel7ParamPosition = Vec(23.2, 300.2); + auto channel8ParamPosition = Vec(23.2, 337.2); + auto channel9ParamPosition = Vec(76.7, 78.2); + auto channel10ParamPosition = Vec(76.7, 115.2); + auto channel11ParamPosition = Vec(76.7, 152.2); + auto channel12ParamPosition = Vec(76.7, 189.2); + auto channel13ParamPosition = Vec(76.7, 226.2); + auto channel14ParamPosition = Vec(76.7, 263.2); + auto channel15ParamPosition = Vec(76.7, 300.2); + auto channel16ParamPosition = Vec(76.7, 337.2); + + auto channelsInputPosition = Vec(54.5, 28.0); + + auto outOutputPosition = Vec(85.5, 28.0); + + auto channel1LightPosition = Vec(31.75, 100.0); + auto channel2LightPosition = Vec(31.75, 137.0); + auto channel3LightPosition = Vec(31.75, 174.0); + auto channel4LightPosition = Vec(31.75, 211.0); + auto channel5LightPosition = Vec(31.75, 248.0); + auto channel6LightPosition = Vec(31.75, 285.0); + auto channel7LightPosition = Vec(31.75, 322.0); + auto channel8LightPosition = Vec(31.75, 359.0); + auto channel9LightPosition = Vec(85.25, 100.0); + auto channel10LightPosition = Vec(85.25, 137.0); + auto channel11LightPosition = Vec(85.25, 174.0); + auto channel12LightPosition = Vec(85.25, 211.0); + auto channel13LightPosition = Vec(85.25, 248.0); + auto channel14LightPosition = Vec(85.25, 285.0); + auto channel15LightPosition = Vec(85.25, 322.0); + auto channel16LightPosition = Vec(85.25, 359.0); + // end generated by svg_widgets.rb + + { + auto w = createParam<Knob16>(channelsParamPosition, module, PolyCon::CHANNELS_PARAM); + dynamic_cast<Knob*>(w)->snap = true; + addParam(w); + } + addParam(createParam<Knob19>(channel1ParamPosition, module, PolyCon::CHANNEL1_PARAM)); + addParam(createParam<Knob19>(channel2ParamPosition, module, PolyCon::CHANNEL2_PARAM)); + addParam(createParam<Knob19>(channel3ParamPosition, module, PolyCon::CHANNEL3_PARAM)); + addParam(createParam<Knob19>(channel4ParamPosition, module, PolyCon::CHANNEL4_PARAM)); + addParam(createParam<Knob19>(channel5ParamPosition, module, PolyCon::CHANNEL5_PARAM)); + addParam(createParam<Knob19>(channel6ParamPosition, module, PolyCon::CHANNEL6_PARAM)); + addParam(createParam<Knob19>(channel7ParamPosition, module, PolyCon::CHANNEL7_PARAM)); + addParam(createParam<Knob19>(channel8ParamPosition, module, PolyCon::CHANNEL8_PARAM)); + addParam(createParam<Knob19>(channel9ParamPosition, module, PolyCon::CHANNEL9_PARAM)); + addParam(createParam<Knob19>(channel10ParamPosition, module, PolyCon::CHANNEL10_PARAM)); + addParam(createParam<Knob19>(channel11ParamPosition, module, PolyCon::CHANNEL11_PARAM)); + addParam(createParam<Knob19>(channel12ParamPosition, module, PolyCon::CHANNEL12_PARAM)); + addParam(createParam<Knob19>(channel13ParamPosition, module, PolyCon::CHANNEL13_PARAM)); + addParam(createParam<Knob19>(channel14ParamPosition, module, PolyCon::CHANNEL14_PARAM)); + addParam(createParam<Knob19>(channel15ParamPosition, module, PolyCon::CHANNEL15_PARAM)); + addParam(createParam<Knob19>(channel16ParamPosition, module, PolyCon::CHANNEL16_PARAM)); + + addInput(createInput<Port24>(channelsInputPosition, module, PolyCon::CHANNELS_INPUT)); + + addOutput(createOutput<Port24>(outOutputPosition, module, PolyCon::OUT_OUTPUT)); + + addChild(createLight<TinyLight<GreenLight>>(channel1LightPosition, module, PolyCon::CHANNEL1_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel2LightPosition, module, PolyCon::CHANNEL2_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel3LightPosition, module, PolyCon::CHANNEL3_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel4LightPosition, module, PolyCon::CHANNEL4_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel5LightPosition, module, PolyCon::CHANNEL5_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel6LightPosition, module, PolyCon::CHANNEL6_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel7LightPosition, module, PolyCon::CHANNEL7_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel8LightPosition, module, PolyCon::CHANNEL8_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel9LightPosition, module, PolyCon::CHANNEL9_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel10LightPosition, module, PolyCon::CHANNEL10_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel11LightPosition, module, PolyCon::CHANNEL11_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel12LightPosition, module, PolyCon::CHANNEL12_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel13LightPosition, module, PolyCon::CHANNEL13_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel14LightPosition, module, PolyCon::CHANNEL14_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel15LightPosition, module, PolyCon::CHANNEL15_LIGHT)); + addChild(createLight<TinyLight<GreenLight>>(channel16LightPosition, module, PolyCon::CHANNEL16_LIGHT)); + } +}; + +Model* modelPolyCon = createModel<PolyCon, PolyConWidget>("Bogaudio-PolyCon", "POLYCON", "Polyphonic per-channel constant voltages", "Utility", "Polyphonic"); diff --git a/src/PolyCon.hpp b/src/PolyCon.hpp @@ -0,0 +1,85 @@ +#pragma once + +#include "bogaudio.hpp" + +extern Model* modelPolyCon; + +namespace bogaudio { + +struct PolyCon : BGModule { + enum ParamsIds { + CHANNELS_PARAM, + CHANNEL1_PARAM, + CHANNEL2_PARAM, + CHANNEL3_PARAM, + CHANNEL4_PARAM, + CHANNEL5_PARAM, + CHANNEL6_PARAM, + CHANNEL7_PARAM, + CHANNEL8_PARAM, + CHANNEL9_PARAM, + CHANNEL10_PARAM, + CHANNEL11_PARAM, + CHANNEL12_PARAM, + CHANNEL13_PARAM, + CHANNEL14_PARAM, + CHANNEL15_PARAM, + CHANNEL16_PARAM, + NUM_PARAMS + }; + + enum InputsIds { + CHANNELS_INPUT, + NUM_INPUTS + }; + + enum OutputsIds { + OUT_OUTPUT, + NUM_OUTPUTS + }; + + enum LightsIds { + CHANNEL1_LIGHT, + CHANNEL2_LIGHT, + CHANNEL3_LIGHT, + CHANNEL4_LIGHT, + CHANNEL5_LIGHT, + CHANNEL6_LIGHT, + CHANNEL7_LIGHT, + CHANNEL8_LIGHT, + CHANNEL9_LIGHT, + CHANNEL10_LIGHT, + CHANNEL11_LIGHT, + CHANNEL12_LIGHT, + CHANNEL13_LIGHT, + CHANNEL14_LIGHT, + CHANNEL15_LIGHT, + CHANNEL16_LIGHT, + NUM_LIGHTS + }; + + PolyCon() { + config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); + configParam(CHANNELS_PARAM, 1.0f, 16.0f, 1.0f, "Polyphony channels"); + configParam(CHANNEL1_PARAM, -1.0f, 1.0f, 0.0f, "Channel 1", "V", 0.0f, 10.0f); + configParam(CHANNEL2_PARAM, -1.0f, 1.0f, 0.0f, "Channel 2", "V", 0.0f, 10.0f); + configParam(CHANNEL3_PARAM, -1.0f, 1.0f, 0.0f, "Channel 3", "V", 0.0f, 10.0f); + configParam(CHANNEL4_PARAM, -1.0f, 1.0f, 0.0f, "Channel 4", "V", 0.0f, 10.0f); + configParam(CHANNEL5_PARAM, -1.0f, 1.0f, 0.0f, "Channel 5", "V", 0.0f, 10.0f); + configParam(CHANNEL6_PARAM, -1.0f, 1.0f, 0.0f, "Channel 6", "V", 0.0f, 10.0f); + configParam(CHANNEL7_PARAM, -1.0f, 1.0f, 0.0f, "Channel 7", "V", 0.0f, 10.0f); + configParam(CHANNEL8_PARAM, -1.0f, 1.0f, 0.0f, "Channel 8", "V", 0.0f, 10.0f); + configParam(CHANNEL9_PARAM, -1.0f, 1.0f, 0.0f, "Channel 9", "V", 0.0f, 10.0f); + configParam(CHANNEL10_PARAM, -1.0f, 1.0f, 0.0f, "Channel 10", "V", 0.0f, 10.0f); + configParam(CHANNEL11_PARAM, -1.0f, 1.0f, 0.0f, "Channel 11", "V", 0.0f, 10.0f); + configParam(CHANNEL12_PARAM, -1.0f, 1.0f, 0.0f, "Channel 12", "V", 0.0f, 10.0f); + configParam(CHANNEL13_PARAM, -1.0f, 1.0f, 0.0f, "Channel 13", "V", 0.0f, 10.0f); + configParam(CHANNEL14_PARAM, -1.0f, 1.0f, 0.0f, "Channel 14", "V", 0.0f, 10.0f); + configParam(CHANNEL15_PARAM, -1.0f, 1.0f, 0.0f, "Channel 15", "V", 0.0f, 10.0f); + configParam(CHANNEL16_PARAM, -1.0f, 1.0f, 0.0f, "Channel 16", "V", 0.0f, 10.0f); + } + + void processChannel(const ProcessArgs& args, int c) override; +}; + +} // namespace bogaudio diff --git a/src/PolyMult.hpp b/src/PolyMult.hpp @@ -28,7 +28,7 @@ struct PolyMult : BGModule { PolyMult() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS); - configParam(CHANNELS_PARAM, 1.0f, 16.0f, 1.0f, "Poly channels"); + configParam(CHANNELS_PARAM, 1.0f, 16.0f, 1.0f, "Polyphony channels"); } void processChannel(const ProcessArgs& args, int c) override; diff --git a/src/bogaudio.cpp b/src/bogaudio.cpp @@ -47,6 +47,7 @@ #include "Offset.hpp" #include "OneEight.hpp" #include "Pan.hpp" +#include "PolyCon.hpp" #include "PolyMult.hpp" #include "Pressor.hpp" #include "Reftone.hpp" @@ -150,6 +151,7 @@ void init(rack::Plugin *p) { p->addModel(modelArp); p->addModel(modelAssign); p->addModel(modelUnison); + p->addModel(modelPolyCon); p->addModel(modelPolyMult); p->addModel(modelBool);