commit 833e283eb76eca7c9a33a4aa798ce10be168bdf1
parent 585fbc1b515106947059fe268e1768a36a50b6b2
Author: Matt Demanett <matt@demanett.net>
Date: Wed, 15 Apr 2020 18:40:48 -0400
Add POLYCON8; rename POLYCON->POLYCON16 and update layout. #106
Diffstat:
19 files changed, 825 insertions(+), 500 deletions(-)
diff --git a/plugin.json b/plugin.json
@@ -624,7 +624,16 @@
},
{
"slug": "Bogaudio-PolyCon",
- "name": "POLYCON",
+ "name": "POLYCON16",
+ "description": "Polyphonic per-channel constant voltages",
+ "tags": [
+ "Utility",
+ "Polyphonic"
+ ]
+ },
+ {
+ "slug": "Bogaudio-PolyCon8",
+ "name": "POLYCON8",
"description": "Polyphonic per-channel constant voltages",
"tags": [
"Utility",
diff --git a/res-src/PolyCon-src.svg b/res-src/PolyCon-src.svg
@@ -1,222 +0,0 @@
-<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(14 0) rotate(240) translate(-2 2)">1</text>
- <text font-size="5pt" transform="rotate(-180) translate(14 0) rotate(180) translate(-2 2)">4</text>
- <text font-size="5pt" transform="rotate(-100) translate(14 0) rotate(100) translate(-2 2)">8</text>
- <text font-size="5pt" transform="rotate(-20) translate(13 0) rotate(20) translate(-2 2)">12</text>
- <text font-size="5pt" transform="rotate(60) translate(13 0) rotate(-60) translate(-1.8 3)">16</text>
-
- <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(10 0)" />
- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-160) translate(10 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(10 0)" />
- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-80) translate(10 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(10 0)" />
- <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(0) translate(10 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(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(21.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(21.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(21.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(21.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(21.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(21.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(21.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(21.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(71.5 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(71.5 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(71.5 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(71.5 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(71.5 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(71.5 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(71.5 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(71.5 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-src/PolyCon16-src.svg b/res-src/PolyCon16-src.svg
@@ -0,0 +1,223 @@
+<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(14 0) rotate(240) translate(-2 2)">1</text>
+ <text font-size="5pt" transform="rotate(-180) translate(14 0) rotate(180) translate(-2 2)">4</text>
+ <text font-size="5pt" transform="rotate(-100) translate(14 0) rotate(100) translate(-2 2)">8</text>
+ <text font-size="5pt" transform="rotate(-20) translate(13 0) rotate(20) translate(-2 2)">12</text>
+ <text font-size="5pt" transform="rotate(60) translate(13 0) rotate(-60) translate(-1.8 3)">16</text>
+
+ <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(10 0)" />
+ <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-160) translate(10 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(10 0)" />
+ <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(-80) translate(10 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(10 0)" />
+ <polyline points="0,0 2.5,0" stroke-width="0.3" stroke="#333" transform="rotate(0) translate(10 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(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="24" y="17" font-size="9pt" letter-spacing="2px">POLYCON16</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>
+
+ <!-- <polyline points="0,0 120,0" stroke="#0f0" stroke-width="1" fill="none" transform="translate(0 24)" /> -->
+ <!-- <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(21.5 22)">
+ <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(21.5 59)">
+ <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(21.5 96)">
+ <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(21.5 133)">
+ <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(21.5 170)">
+ <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(21.5 207)">
+ <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(21.5 244)">
+ <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(21.5 281)">
+ <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(71.5 22)">
+ <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(71.5 59)">
+ <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(71.5 96)">
+ <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(71.5 133)">
+ <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(71.5 170)">
+ <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(71.5 207)">
+ <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(71.5 244)">
+ <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(71.5 281)">
+ <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>
+
+ <g transform="translate(11 320)">
+ <text font-size="6pt" letter-spacing="1.5px" transform="translate(0 39) rotate(-90) 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(52 318)">
+ <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>
+</svg>
diff --git a/res-src/PolyCon8-src.svg b/res-src/PolyCon8-src.svg
@@ -0,0 +1,136 @@
+<svg
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="45"
+ height="380"
+ viewBox="0 0 45 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-centertick" viewBox="0 0 40px 40px">
+ <g transform="translate(20 20)">
+ <g transform="rotate(-90) translate(10 0)">
+ <polyline points="0,0 4,0" stroke-width="1" stroke="#333" />
+ </g>
+ <path d="M 0 -12.5 A 12.5 12.5 0 0 1 12.5 0" stroke="#333" stroke-width="0.5" stroke-linecap="round" fill="none" transform="rotate(20)" />
+ <path d="M 0 -12.5 A 12.5 12.5 0 0 1 12.5 0" stroke="#333" stroke-width="0.5" stroke-linecap="round" fill="none" transform="rotate(43)" />
+ <path d="M 0 -12.5 A 12.5 12.5 0 0 0 -12.5 0" stroke="#333" stroke-width="0.5" stroke-linecap="round" fill="none" transform="rotate(-20)" />
+ <path d="M 0 -12.5 A 12.5 12.5 0 0 0 -12.5 0" stroke="#333" stroke-width="0.5" stroke-linecap="round" fill="none" transform="rotate(-43)" />
+ </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 44,1 44,379 1,379 1,1" stroke="#e4e4e4" stroke-width="0.5" fill="none" />
+ <polyline points="0.5,0.5 44.5,0.5 44.5,379.5 0.5,379.5 0.5,0.5" stroke="#ebebeb" stroke-width="0.8" fill="none" />
+ <polyline points="0,0 45,0 45,380 0,380 0,0" stroke="#f2f2f2" stroke-width="1" fill="none" />
+
+ <g transform="rotate(-90) translate(-376 13)">
+ <text class="title" font-size="7pt" letter-spacing="0.5px">POLYCON8</text>
+ <g transform="translate(0 12)">
+ <text class="brand" font-size="7pt" letter-spacing="2px">BGA</text>
+ <rect width="3.0" height="3" fill="#ddd" transform="translate(11.5 -5)" />
+ </g>
+ </g>
+
+ <!-- <polyline points="0,0 0,380" stroke="#0f0" stroke-width="1" fill="none" transform="translate(5 0)" /> -->
+ <!-- <polyline points="0,0 0,380" stroke="#0f0" stroke-width="1" fill="none" transform="translate(40 0)" /> -->
+
+ <g transform="translate(0 18)">
+ <!-- <rect width="45" height="23" fill="#ff0" transform="translate(0 0)" /> -->
+ <use id="CHANNEL1_PARAM" xlink:href="#knob-smallest" transform="translate(14.5 6)" />
+ <use xlink:href="#knobguide-centertick" transform="translate(2.2 -6)" />
+ <text font-size="5pt" letter-spacing="1px" transform="translate(3 16.5)">1</text>
+ <use id="CHANNEL1_LIGHT" xlink:href="#light-tiny" transform="translate(38.5 12.4)" />
+ </g>
+ <g transform="translate(0 49.5)">
+ <!-- <rect width="45" height="23" fill="#ff0" transform="translate(0 0)" /> -->
+ <use id="CHANNEL2_PARAM" xlink:href="#knob-smallest" transform="translate(14.5 6)" />
+ <use xlink:href="#knobguide-centertick" transform="translate(2.2 -6)" />
+ <text font-size="5pt" letter-spacing="1px" transform="translate(3 16.5)">2</text>
+ <use id="CHANNEL2_LIGHT" xlink:href="#light-tiny" transform="translate(38.5 12.4)" />
+ </g>
+ <g transform="translate(0 81)">
+ <!-- <rect width="45" height="23" fill="#ff0" transform="translate(0 0)" /> -->
+ <use id="CHANNEL3_PARAM" xlink:href="#knob-smallest" transform="translate(14.5 6)" />
+ <use xlink:href="#knobguide-centertick" transform="translate(2.2 -6)" />
+ <text font-size="5pt" letter-spacing="1px" transform="translate(3 16.5)">3</text>
+ <use id="CHANNEL3_LIGHT" xlink:href="#light-tiny" transform="translate(38.5 12.4)" />
+ </g>
+ <g transform="translate(0 112.5)">
+ <!-- <rect width="45" height="23" fill="#ff0" transform="translate(0 0)" /> -->
+ <use id="CHANNEL4_PARAM" xlink:href="#knob-smallest" transform="translate(14.5 6)" />
+ <use xlink:href="#knobguide-centertick" transform="translate(2.2 -6)" />
+ <text font-size="5pt" letter-spacing="1px" transform="translate(3 16.5)">4</text>
+ <use id="CHANNEL4_LIGHT" xlink:href="#light-tiny" transform="translate(38.5 12.4)" />
+ </g>
+ <g transform="translate(0 144)">
+ <!-- <rect width="45" height="23" fill="#ff0" transform="translate(0 0)" /> -->
+ <use id="CHANNEL5_PARAM" xlink:href="#knob-smallest" transform="translate(14.5 6)" />
+ <use xlink:href="#knobguide-centertick" transform="translate(2.2 -6)" />
+ <text font-size="5pt" letter-spacing="1px" transform="translate(3 16.5)">5</text>
+ <use id="CHANNEL5_LIGHT" xlink:href="#light-tiny" transform="translate(38.5 12.4)" />
+ </g>
+ <g transform="translate(0 175.5)">
+ <!-- <rect width="45" height="23" fill="#ff0" transform="translate(0 0)" /> -->
+ <use id="CHANNEL6_PARAM" xlink:href="#knob-smallest" transform="translate(14.5 6)" />
+ <use xlink:href="#knobguide-centertick" transform="translate(2.2 -6)" />
+ <text font-size="5pt" letter-spacing="1px" transform="translate(3 16.5)">6</text>
+ <use id="CHANNEL6_LIGHT" xlink:href="#light-tiny" transform="translate(38.5 12.4)" />
+ </g>
+ <g transform="translate(0 207)">
+ <!-- <rect width="45" height="23" fill="#ff0" transform="translate(0 0)" /> -->
+ <use id="CHANNEL7_PARAM" xlink:href="#knob-smallest" transform="translate(14.5 6)" />
+ <use xlink:href="#knobguide-centertick" transform="translate(2.2 -6)" />
+ <text font-size="5pt" letter-spacing="1px" transform="translate(3 16.5)">7</text>
+ <use id="CHANNEL7_LIGHT" xlink:href="#light-tiny" transform="translate(38.5 12.4)" />
+ </g>
+ <g transform="translate(0 238.5)">
+ <!-- <rect width="45" height="23" fill="#ff0" transform="translate(0 0)" /> -->
+ <use id="CHANNEL8_PARAM" xlink:href="#knob-smallest" transform="translate(14.5 6)" />
+ <use xlink:href="#knobguide-centertick" transform="translate(2.2 -6)" />
+ <text font-size="5pt" letter-spacing="1px" transform="translate(3 16.5)">8</text>
+ <use id="CHANNEL8_LIGHT" xlink:href="#light-tiny" transform="translate(38.5 12.4)" />
+ </g>
+
+ <g transform="translate(7.5 270)">
+ <rect width="34" height="40" rx="5" fill="#bbb" transform="translate(-2 0)" />
+ <use id="OUT_OUTPUT" xlink:href="#output" transform="translate(3 4)" />
+ <text font-size="6pt" letter-spacing="2px" transform="translate(5 36)">OUT</text>
+ </g>
+</svg>
diff --git a/res/PolyCon.svg b/res/PolyCon.svg
Binary files differ.
diff --git a/res/PolyCon16.svg b/res/PolyCon16.svg
Binary files differ.
diff --git a/res/PolyCon8.svg b/res/PolyCon8.svg
Binary files differ.
diff --git a/src/Noise.cpp b/src/Noise.cpp
@@ -1,41 +1,26 @@
#include "Noise.hpp"
-#define NOISE_CHANNELS "noise_channels"
-
-json_t* Noise::dataToJson() {
- json_t* root = json_object();
- json_object_set_new(root, NOISE_CHANNELS, json_integer(_noiseChannels));
- return root;
-}
-
-void Noise::dataFromJson(json_t* root) {
- json_t* nc = json_object_get(root, NOISE_CHANNELS);
- if (nc) {
- _noiseChannels = json_integer_value(nc);
- }
-}
-
void Noise::processAll(const ProcessArgs& args) {
- for (int i = 0; i < _noiseChannels; ++i) {
+ for (int i = 0; i < _polyChannels; ++i) {
if (outputs[BLUE_OUTPUT].isConnected()) {
- outputs[BLUE_OUTPUT].setChannels(_noiseChannels);
+ outputs[BLUE_OUTPUT].setChannels(_polyChannels);
outputs[BLUE_OUTPUT].setVoltage(clamp(_blue.next() * 20.0f, -10.0f, 10.f), i);
}
if (outputs[WHITE_OUTPUT].isConnected()) {
- outputs[WHITE_OUTPUT].setChannels(_noiseChannels);
+ outputs[WHITE_OUTPUT].setChannels(_polyChannels);
outputs[WHITE_OUTPUT].setVoltage(clamp(_white.next() * 10.0f, -10.0f, 10.f), i);
}
if (outputs[PINK_OUTPUT].isConnected()) {
- outputs[PINK_OUTPUT].setChannels(_noiseChannels);
+ outputs[PINK_OUTPUT].setChannels(_polyChannels);
outputs[PINK_OUTPUT].setVoltage(clamp(_pink.next() * 15.0f, -10.0f, 10.f), i);
}
if (outputs[RED_OUTPUT].isConnected()) {
- outputs[RED_OUTPUT].setChannels(_noiseChannels);
+ outputs[RED_OUTPUT].setChannels(_polyChannels);
outputs[RED_OUTPUT].setVoltage(clamp(_red.next() * 20.0f, -10.0f, 10.f), i);
}
if (outputs[GAUSS_OUTPUT].isConnected()) {
- outputs[GAUSS_OUTPUT].setChannels(_noiseChannels);
+ outputs[GAUSS_OUTPUT].setChannels(_polyChannels);
outputs[GAUSS_OUTPUT].setVoltage(clamp(_gauss.next(), -10.0f, 10.f), i);
}
}
@@ -89,39 +74,11 @@ struct NoiseWidget : ModuleWidget {
addOutput(createOutput<Port24>(absOutputPosition, module, Noise::ABS_OUTPUT));
}
- struct ChannelsMenuItem : MenuItem {
- Noise* _module;
-
- ChannelsMenuItem(Noise* module, const char* label) : _module(module) {
- this->text = label;
- }
-
- Menu* createChildMenu() override {
- Menu* menu = new Menu;
- Noise* m = _module;
- menu->addChild(new OptionMenuItem("Monophonic", [m]() { return m->_noiseChannels == 1; }, [m]() { m->_noiseChannels = 1; }));
- for (int i = 2; i <= BGModule::maxChannels; i++) {
- char s[10];
- snprintf(s, 10, "%d", i);
- menu->addChild(new OptionMenuItem(s, [m, i]() { return m->_noiseChannels == i; }, [m, i]() { m->_noiseChannels = i; }));
- }
- return menu;
- }
-
- void step() override {
- MenuItem::step();
- char s[10];
- snprintf(s, 10, "%d ▸", _module->_noiseChannels);
- this->rightText = s;
- }
- };
-
void appendContextMenu(Menu* menu) override {
- Noise* m = dynamic_cast<Noise*>(module);
+ auto m = dynamic_cast<Noise*>(module);
assert(m);
-
menu->addChild(new MenuLabel());
- menu->addChild(new ChannelsMenuItem(m, "Polyphony channels"));
+ menu->addChild(new PolyChannelsMenuItem(m));
}
};
diff --git a/src/Noise.hpp b/src/Noise.hpp
@@ -2,6 +2,7 @@
#include "bogaudio.hpp"
#include "dsp/noise.hpp"
+#include "poly_channels.hpp"
using namespace bogaudio::dsp;
@@ -9,7 +10,7 @@ extern Model* modelNoise;
namespace bogaudio {
-struct Noise : BGModule {
+struct Noise : PolyChannelsModule {
enum ParamsIds {
NUM_PARAMS
};
@@ -29,7 +30,6 @@ struct Noise : BGModule {
NUM_OUTPUTS
};
- int _noiseChannels = 1;
BlueNoiseGenerator _blue;
WhiteNoiseGenerator _white;
PinkNoiseGenerator _pink;
@@ -40,8 +40,6 @@ struct Noise : BGModule {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
}
- json_t* dataToJson() override;
- void dataFromJson(json_t* root) override;
void processAll(const ProcessArgs& args) override;
};
diff --git a/src/PolyCon.cpp b/src/PolyCon.cpp
@@ -1,132 +0,0 @@
-
-#include "PolyCon.hpp"
-
-void PolyCon::processAll(const ProcessArgs& args) {
- 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) {
- float out = clamp(params[CHANNEL1_PARAM + c].getValue(), -1.0f, 1.0f);
- out += _rangeOffset;
- out *= _rangeScale;
- outputs[OUT_OUTPUT].setVoltage(out, c);
- lights[CHANNEL1_LIGHT + c].value = 1.0f;
- }
- for (int c = cn; c < maxChannels; ++c) {
- lights[CHANNEL1_LIGHT + c].value = 0.0f;
- }
-}
-
-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, 365)));
-
- // generated by svg_widgets.rb
-
- auto channelsParamPosition = Vec(16.0, 43.0);
- auto channel1ParamPosition = Vec(25.3, 78.2);
- auto channel2ParamPosition = Vec(25.2, 115.2);
- auto channel3ParamPosition = Vec(25.2, 152.2);
- auto channel4ParamPosition = Vec(25.2, 189.2);
- auto channel5ParamPosition = Vec(25.2, 226.2);
- auto channel6ParamPosition = Vec(25.2, 263.2);
- auto channel7ParamPosition = Vec(25.2, 300.2);
- auto channel8ParamPosition = Vec(25.2, 337.2);
- auto channel9ParamPosition = Vec(75.2, 78.2);
- auto channel10ParamPosition = Vec(75.2, 115.2);
- auto channel11ParamPosition = Vec(75.2, 152.2);
- auto channel12ParamPosition = Vec(75.2, 189.2);
- auto channel13ParamPosition = Vec(75.2, 226.2);
- auto channel14ParamPosition = Vec(75.2, 263.2);
- auto channel15ParamPosition = Vec(75.2, 300.2);
- auto channel16ParamPosition = Vec(75.2, 337.2);
-
- auto channelsInputPosition = Vec(54.5, 28.0);
-
- auto outOutputPosition = Vec(85.5, 28.0);
-
- auto channel1LightPosition = Vec(33.75, 100.0);
- auto channel2LightPosition = Vec(33.75, 137.0);
- auto channel3LightPosition = Vec(33.75, 174.0);
- auto channel4LightPosition = Vec(33.75, 211.0);
- auto channel5LightPosition = Vec(33.75, 248.0);
- auto channel6LightPosition = Vec(33.75, 285.0);
- auto channel7LightPosition = Vec(33.75, 322.0);
- auto channel8LightPosition = Vec(33.75, 359.0);
- auto channel9LightPosition = Vec(83.75, 100.0);
- auto channel10LightPosition = Vec(83.75, 137.0);
- auto channel11LightPosition = Vec(83.75, 174.0);
- auto channel12LightPosition = Vec(83.75, 211.0);
- auto channel13LightPosition = Vec(83.75, 248.0);
- auto channel14LightPosition = Vec(83.75, 285.0);
- auto channel15LightPosition = Vec(83.75, 322.0);
- auto channel16LightPosition = Vec(83.75, 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));
- }
-
- void appendContextMenu(Menu* menu) override {
- menu->addChild(new MenuLabel());
- OutputRangeOptionMenuItem::addOutputRangeOptionsToMenu(module, menu);
- }
-};
-
-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
@@ -1,86 +0,0 @@
-#pragma once
-
-#include "bogaudio.hpp"
-#include "output_range.hpp"
-
-extern Model* modelPolyCon;
-
-namespace bogaudio {
-
-struct PolyCon : OutputRangeModule<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<OutputRangeParamQuantity>(CHANNELS_PARAM, 1.0f, 16.0f, 1.0f, "Polyphony channels");
- configParam<OutputRangeParamQuantity>(CHANNEL1_PARAM, -1.0f, 1.0f, 0.0f, "Channel 1", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL2_PARAM, -1.0f, 1.0f, 0.0f, "Channel 2", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL3_PARAM, -1.0f, 1.0f, 0.0f, "Channel 3", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL4_PARAM, -1.0f, 1.0f, 0.0f, "Channel 4", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL5_PARAM, -1.0f, 1.0f, 0.0f, "Channel 5", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL6_PARAM, -1.0f, 1.0f, 0.0f, "Channel 6", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL7_PARAM, -1.0f, 1.0f, 0.0f, "Channel 7", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL8_PARAM, -1.0f, 1.0f, 0.0f, "Channel 8", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL9_PARAM, -1.0f, 1.0f, 0.0f, "Channel 9", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL10_PARAM, -1.0f, 1.0f, 0.0f, "Channel 10", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL11_PARAM, -1.0f, 1.0f, 0.0f, "Channel 11", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL12_PARAM, -1.0f, 1.0f, 0.0f, "Channel 12", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL13_PARAM, -1.0f, 1.0f, 0.0f, "Channel 13", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL14_PARAM, -1.0f, 1.0f, 0.0f, "Channel 14", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL15_PARAM, -1.0f, 1.0f, 0.0f, "Channel 15", "V", 0.0f, 10.0f);
- configParam<OutputRangeParamQuantity>(CHANNEL16_PARAM, -1.0f, 1.0f, 0.0f, "Channel 16", "V", 0.0f, 10.0f);
- }
-
- void processAll(const ProcessArgs& args) override;
-};
-
-} // namespace bogaudio
diff --git a/src/PolyCon16.cpp b/src/PolyCon16.cpp
@@ -0,0 +1,132 @@
+
+#include "PolyCon16.hpp"
+
+void PolyCon16::processAll(const ProcessArgs& args) {
+ 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) {
+ float out = clamp(params[CHANNEL1_PARAM + c].getValue(), -1.0f, 1.0f);
+ out += _rangeOffset;
+ out *= _rangeScale;
+ outputs[OUT_OUTPUT].setVoltage(out, c);
+ lights[CHANNEL1_LIGHT + c].value = 1.0f;
+ }
+ for (int c = cn; c < maxChannels; ++c) {
+ lights[CHANNEL1_LIGHT + c].value = 0.0f;
+ }
+}
+
+struct PolyCon16Widget : ModuleWidget {
+ static constexpr int hp = 8;
+
+ PolyCon16Widget(PolyCon16* 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/PolyCon16.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(0, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
+
+ // generated by svg_widgets.rb
+ auto channel1ParamPosition = Vec(25.3, 30.2);
+ auto channel2ParamPosition = Vec(25.2, 67.2);
+ auto channel3ParamPosition = Vec(25.2, 104.2);
+ auto channel4ParamPosition = Vec(25.2, 141.2);
+ auto channel5ParamPosition = Vec(25.2, 178.2);
+ auto channel6ParamPosition = Vec(25.2, 215.2);
+ auto channel7ParamPosition = Vec(25.2, 252.2);
+ auto channel8ParamPosition = Vec(25.2, 289.2);
+ auto channel9ParamPosition = Vec(75.2, 30.2);
+ auto channel10ParamPosition = Vec(75.2, 67.2);
+ auto channel11ParamPosition = Vec(75.2, 104.2);
+ auto channel12ParamPosition = Vec(75.2, 141.2);
+ auto channel13ParamPosition = Vec(75.2, 178.2);
+ auto channel14ParamPosition = Vec(75.2, 215.2);
+ auto channel15ParamPosition = Vec(75.2, 252.2);
+ auto channel16ParamPosition = Vec(75.2, 289.2);
+ auto channelsParamPosition = Vec(23.0, 332.0);
+
+ auto channelsInputPosition = Vec(55.5, 322.0);
+
+ auto outOutputPosition = Vec(86.5, 322.0);
+
+ auto channel1LightPosition = Vec(33.75, 52.0);
+ auto channel2LightPosition = Vec(33.75, 89.0);
+ auto channel3LightPosition = Vec(33.75, 126.0);
+ auto channel4LightPosition = Vec(33.75, 163.0);
+ auto channel5LightPosition = Vec(33.75, 200.0);
+ auto channel6LightPosition = Vec(33.75, 237.0);
+ auto channel7LightPosition = Vec(33.75, 274.0);
+ auto channel8LightPosition = Vec(33.75, 311.0);
+ auto channel9LightPosition = Vec(83.75, 52.0);
+ auto channel10LightPosition = Vec(83.75, 89.0);
+ auto channel11LightPosition = Vec(83.75, 126.0);
+ auto channel12LightPosition = Vec(83.75, 163.0);
+ auto channel13LightPosition = Vec(83.75, 200.0);
+ auto channel14LightPosition = Vec(83.75, 237.0);
+ auto channel15LightPosition = Vec(83.75, 274.0);
+ auto channel16LightPosition = Vec(83.75, 311.0);
+ // end generated by svg_widgets.rb
+
+ {
+ auto w = createParam<Knob16>(channelsParamPosition, module, PolyCon16::CHANNELS_PARAM);
+ dynamic_cast<Knob*>(w)->snap = true;
+ addParam(w);
+ }
+ addParam(createParam<Knob19>(channel1ParamPosition, module, PolyCon16::CHANNEL1_PARAM));
+ addParam(createParam<Knob19>(channel2ParamPosition, module, PolyCon16::CHANNEL2_PARAM));
+ addParam(createParam<Knob19>(channel3ParamPosition, module, PolyCon16::CHANNEL3_PARAM));
+ addParam(createParam<Knob19>(channel4ParamPosition, module, PolyCon16::CHANNEL4_PARAM));
+ addParam(createParam<Knob19>(channel5ParamPosition, module, PolyCon16::CHANNEL5_PARAM));
+ addParam(createParam<Knob19>(channel6ParamPosition, module, PolyCon16::CHANNEL6_PARAM));
+ addParam(createParam<Knob19>(channel7ParamPosition, module, PolyCon16::CHANNEL7_PARAM));
+ addParam(createParam<Knob19>(channel8ParamPosition, module, PolyCon16::CHANNEL8_PARAM));
+ addParam(createParam<Knob19>(channel9ParamPosition, module, PolyCon16::CHANNEL9_PARAM));
+ addParam(createParam<Knob19>(channel10ParamPosition, module, PolyCon16::CHANNEL10_PARAM));
+ addParam(createParam<Knob19>(channel11ParamPosition, module, PolyCon16::CHANNEL11_PARAM));
+ addParam(createParam<Knob19>(channel12ParamPosition, module, PolyCon16::CHANNEL12_PARAM));
+ addParam(createParam<Knob19>(channel13ParamPosition, module, PolyCon16::CHANNEL13_PARAM));
+ addParam(createParam<Knob19>(channel14ParamPosition, module, PolyCon16::CHANNEL14_PARAM));
+ addParam(createParam<Knob19>(channel15ParamPosition, module, PolyCon16::CHANNEL15_PARAM));
+ addParam(createParam<Knob19>(channel16ParamPosition, module, PolyCon16::CHANNEL16_PARAM));
+
+ addInput(createInput<Port24>(channelsInputPosition, module, PolyCon16::CHANNELS_INPUT));
+
+ addOutput(createOutput<Port24>(outOutputPosition, module, PolyCon16::OUT_OUTPUT));
+
+ addChild(createLight<TinyLight<GreenLight>>(channel1LightPosition, module, PolyCon16::CHANNEL1_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel2LightPosition, module, PolyCon16::CHANNEL2_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel3LightPosition, module, PolyCon16::CHANNEL3_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel4LightPosition, module, PolyCon16::CHANNEL4_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel5LightPosition, module, PolyCon16::CHANNEL5_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel6LightPosition, module, PolyCon16::CHANNEL6_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel7LightPosition, module, PolyCon16::CHANNEL7_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel8LightPosition, module, PolyCon16::CHANNEL8_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel9LightPosition, module, PolyCon16::CHANNEL9_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel10LightPosition, module, PolyCon16::CHANNEL10_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel11LightPosition, module, PolyCon16::CHANNEL11_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel12LightPosition, module, PolyCon16::CHANNEL12_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel13LightPosition, module, PolyCon16::CHANNEL13_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel14LightPosition, module, PolyCon16::CHANNEL14_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel15LightPosition, module, PolyCon16::CHANNEL15_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel16LightPosition, module, PolyCon16::CHANNEL16_LIGHT));
+ }
+
+ void appendContextMenu(Menu* menu) override {
+ menu->addChild(new MenuLabel());
+ OutputRangeOptionMenuItem::addOutputRangeOptionsToMenu(module, menu);
+ }
+};
+
+// Note slug is "Bogaudio-PolyCon" for backwards compatibility.
+Model* modelPolyCon16 = createModel<PolyCon16, PolyCon16Widget>("Bogaudio-PolyCon", "POLYCON16", "Polyphonic per-channel constant voltages", "Utility", "Polyphonic");
diff --git a/src/PolyCon16.hpp b/src/PolyCon16.hpp
@@ -0,0 +1,86 @@
+#pragma once
+
+#include "bogaudio.hpp"
+#include "output_range.hpp"
+
+extern Model* modelPolyCon16;
+
+namespace bogaudio {
+
+struct PolyCon16 : OutputRangeModule<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
+ };
+
+ PolyCon16() {
+ config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
+ configParam<OutputRangeParamQuantity>(CHANNELS_PARAM, 1.0f, 16.0f, 1.0f, "Polyphony channels");
+ configParam<OutputRangeParamQuantity>(CHANNEL1_PARAM, -1.0f, 1.0f, 0.0f, "Channel 1", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL2_PARAM, -1.0f, 1.0f, 0.0f, "Channel 2", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL3_PARAM, -1.0f, 1.0f, 0.0f, "Channel 3", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL4_PARAM, -1.0f, 1.0f, 0.0f, "Channel 4", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL5_PARAM, -1.0f, 1.0f, 0.0f, "Channel 5", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL6_PARAM, -1.0f, 1.0f, 0.0f, "Channel 6", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL7_PARAM, -1.0f, 1.0f, 0.0f, "Channel 7", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL8_PARAM, -1.0f, 1.0f, 0.0f, "Channel 8", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL9_PARAM, -1.0f, 1.0f, 0.0f, "Channel 9", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL10_PARAM, -1.0f, 1.0f, 0.0f, "Channel 10", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL11_PARAM, -1.0f, 1.0f, 0.0f, "Channel 11", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL12_PARAM, -1.0f, 1.0f, 0.0f, "Channel 12", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL13_PARAM, -1.0f, 1.0f, 0.0f, "Channel 13", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL14_PARAM, -1.0f, 1.0f, 0.0f, "Channel 14", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL15_PARAM, -1.0f, 1.0f, 0.0f, "Channel 15", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL16_PARAM, -1.0f, 1.0f, 0.0f, "Channel 16", "V", 0.0f, 10.0f);
+ }
+
+ void processAll(const ProcessArgs& args) override;
+};
+
+} // namespace bogaudio
diff --git a/src/PolyCon8.cpp b/src/PolyCon8.cpp
@@ -0,0 +1,89 @@
+
+#include "PolyCon8.hpp"
+
+void PolyCon8::processAll(const ProcessArgs& args) {
+ int cn = clamp(_polyChannels, 1, 8);
+
+ outputs[OUT_OUTPUT].setChannels(cn);
+ for (int c = 0; c < cn; ++c) {
+ float out = clamp(params[CHANNEL1_PARAM + c].getValue(), -1.0f, 1.0f);
+ out += _rangeOffset;
+ out *= _rangeScale;
+ outputs[OUT_OUTPUT].setVoltage(out, c);
+ lights[CHANNEL1_LIGHT + c].value = 1.0f;
+ }
+ for (int c = cn; c < 8; ++c) {
+ lights[CHANNEL1_LIGHT + c].value = 0.0f;
+ }
+}
+
+struct PolyCon8Widget : ModuleWidget {
+ static constexpr int hp = 3;
+
+ PolyCon8Widget(PolyCon8* 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/PolyCon8.svg")));
+ addChild(panel);
+ }
+
+ addChild(createWidget<ScrewSilver>(Vec(0, 0)));
+ addChild(createWidget<ScrewSilver>(Vec(box.size.x - 15, 365)));
+
+ // generated by svg_widgets.rb
+ auto channel1ParamPosition = Vec(14.5, 24.0);
+ auto channel2ParamPosition = Vec(14.5, 55.5);
+ auto channel3ParamPosition = Vec(14.5, 87.0);
+ auto channel4ParamPosition = Vec(14.5, 118.5);
+ auto channel5ParamPosition = Vec(14.5, 150.0);
+ auto channel6ParamPosition = Vec(14.5, 181.5);
+ auto channel7ParamPosition = Vec(14.5, 213.0);
+ auto channel8ParamPosition = Vec(14.5, 244.5);
+
+ auto outOutputPosition = Vec(10.5, 274.0);
+
+ auto channel1LightPosition = Vec(38.5, 30.4);
+ auto channel2LightPosition = Vec(38.5, 61.9);
+ auto channel3LightPosition = Vec(38.5, 93.4);
+ auto channel4LightPosition = Vec(38.5, 124.9);
+ auto channel5LightPosition = Vec(38.5, 156.4);
+ auto channel6LightPosition = Vec(38.5, 187.9);
+ auto channel7LightPosition = Vec(38.5, 219.4);
+ auto channel8LightPosition = Vec(38.5, 250.9);
+ // end generated by svg_widgets.rb
+
+ addParam(createParam<Knob16>(channel1ParamPosition, module, PolyCon8::CHANNEL1_PARAM));
+ addParam(createParam<Knob16>(channel2ParamPosition, module, PolyCon8::CHANNEL2_PARAM));
+ addParam(createParam<Knob16>(channel3ParamPosition, module, PolyCon8::CHANNEL3_PARAM));
+ addParam(createParam<Knob16>(channel4ParamPosition, module, PolyCon8::CHANNEL4_PARAM));
+ addParam(createParam<Knob16>(channel5ParamPosition, module, PolyCon8::CHANNEL5_PARAM));
+ addParam(createParam<Knob16>(channel6ParamPosition, module, PolyCon8::CHANNEL6_PARAM));
+ addParam(createParam<Knob16>(channel7ParamPosition, module, PolyCon8::CHANNEL7_PARAM));
+ addParam(createParam<Knob16>(channel8ParamPosition, module, PolyCon8::CHANNEL8_PARAM));
+
+ addOutput(createOutput<Port24>(outOutputPosition, module, PolyCon8::OUT_OUTPUT));
+
+ addChild(createLight<TinyLight<GreenLight>>(channel1LightPosition, module, PolyCon8::CHANNEL1_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel2LightPosition, module, PolyCon8::CHANNEL2_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel3LightPosition, module, PolyCon8::CHANNEL3_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel4LightPosition, module, PolyCon8::CHANNEL4_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel5LightPosition, module, PolyCon8::CHANNEL5_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel6LightPosition, module, PolyCon8::CHANNEL6_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel7LightPosition, module, PolyCon8::CHANNEL7_LIGHT));
+ addChild(createLight<TinyLight<GreenLight>>(channel8LightPosition, module, PolyCon8::CHANNEL8_LIGHT));
+ }
+
+ void appendContextMenu(Menu* menu) override {
+ auto m = dynamic_cast<PolyCon8*>(module);
+ assert(m);
+ menu->addChild(new MenuLabel());
+ menu->addChild(new PolyChannelsMenuItem(m, 8));
+ OutputRangeOptionMenuItem::addOutputRangeOptionsToMenu(module, menu);
+ }
+};
+
+Model* modelPolyCon8 = createModel<PolyCon8, PolyCon8Widget>("Bogaudio-PolyCon8", "POLYCON8", "Polyphonic per-channel constant voltages", "Utility", "Polyphonic");
diff --git a/src/PolyCon8.hpp b/src/PolyCon8.hpp
@@ -0,0 +1,60 @@
+#pragma once
+
+#include "bogaudio.hpp"
+#include "output_range.hpp"
+#include "poly_channels.hpp"
+
+extern Model* modelPolyCon8;
+
+namespace bogaudio {
+
+struct PolyCon8 : OutputRangeModule<PolyChannelsModule> {
+ enum ParamsIds {
+ CHANNEL1_PARAM,
+ CHANNEL2_PARAM,
+ CHANNEL3_PARAM,
+ CHANNEL4_PARAM,
+ CHANNEL5_PARAM,
+ CHANNEL6_PARAM,
+ CHANNEL7_PARAM,
+ CHANNEL8_PARAM,
+ NUM_PARAMS
+ };
+
+ enum InputsIds {
+ 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,
+ NUM_LIGHTS
+ };
+
+ PolyCon8() {
+ config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
+ configParam<OutputRangeParamQuantity>(CHANNEL1_PARAM, -1.0f, 1.0f, 0.0f, "Channel 1", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL2_PARAM, -1.0f, 1.0f, 0.0f, "Channel 2", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL3_PARAM, -1.0f, 1.0f, 0.0f, "Channel 3", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL4_PARAM, -1.0f, 1.0f, 0.0f, "Channel 4", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL5_PARAM, -1.0f, 1.0f, 0.0f, "Channel 5", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL6_PARAM, -1.0f, 1.0f, 0.0f, "Channel 6", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL7_PARAM, -1.0f, 1.0f, 0.0f, "Channel 7", "V", 0.0f, 10.0f);
+ configParam<OutputRangeParamQuantity>(CHANNEL8_PARAM, -1.0f, 1.0f, 0.0f, "Channel 8", "V", 0.0f, 10.0f);
+ }
+
+ void processAll(const ProcessArgs& args) override;
+};
+
+} // namespace bogaudio
diff --git a/src/bogaudio.cpp b/src/bogaudio.cpp
@@ -53,7 +53,8 @@
#include "OneEight.hpp"
#include "Pan.hpp"
#include "Pgmr.hpp"
-#include "PolyCon.hpp"
+#include "PolyCon8.hpp"
+#include "PolyCon16.hpp"
#include "PolyMult.hpp"
#include "Pressor.hpp"
#include "Pulse.hpp"
@@ -173,7 +174,8 @@ void init(rack::Plugin *p) {
p->addModel(modelArp);
p->addModel(modelAssign);
p->addModel(modelUnison);
- p->addModel(modelPolyCon);
+ p->addModel(modelPolyCon16);
+ p->addModel(modelPolyCon8);
p->addModel(modelPolyMult);
p->addModel(modelBool);
diff --git a/src/output_range.hpp b/src/output_range.hpp
@@ -18,7 +18,7 @@ struct OutputRange {
template<class BASE>
struct OutputRangeModule : BASE, OutputRange {
- json_t* dataToJson() {
+ json_t* dataToJson() override {
json_t* root = BASE::dataToJson();
if (!root) {
root = json_object();
@@ -28,7 +28,7 @@ struct OutputRangeModule : BASE, OutputRange {
return root;
}
- void dataFromJson(json_t* root) {
+ void dataFromJson(json_t* root) override {
BASE::dataFromJson(root);
json_t* ro = json_object_get(root, "range_offset");
diff --git a/src/poly_channels.cpp b/src/poly_channels.cpp
@@ -0,0 +1,42 @@
+
+#include "poly_channels.hpp"
+
+using namespace bogaudio;
+
+#define POLY_CHANNELS "poly_channels"
+
+json_t* PolyChannelsModule::dataToJson() {
+ json_t* root = json_object();
+ json_object_set_new(root, POLY_CHANNELS, json_integer(_polyChannels));
+ return root;
+}
+
+void PolyChannelsModule::dataFromJson(json_t* root) {
+ json_t* pc = json_object_get(root, POLY_CHANNELS);
+ if (!pc) {
+ pc = json_object_get(root, "noise_channels"); // backward compatibility hack.
+ }
+ if (pc) {
+ _polyChannels = json_integer_value(pc);
+ }
+}
+
+
+Menu* PolyChannelsMenuItem::createChildMenu() {
+ Menu* menu = new Menu;
+ PolyChannelsModule* m = _module;
+ menu->addChild(new OptionMenuItem("Monophonic", [m]() { return m->_polyChannels == 1; }, [m]() { m->_polyChannels = 1; }));
+ for (int i = 2; i <= _maxChannels; i++) {
+ char s[10];
+ snprintf(s, 10, "%d", i);
+ menu->addChild(new OptionMenuItem(s, [m, i]() { return m->_polyChannels == i; }, [m, i]() { m->_polyChannels = i; }));
+ }
+ return menu;
+}
+
+void PolyChannelsMenuItem::step() {
+ MenuItem::step();
+ char s[10];
+ snprintf(s, 10, "%d ▸", _module->_polyChannels);
+ this->rightText = s;
+}
diff --git a/src/poly_channels.hpp b/src/poly_channels.hpp
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "bogaudio.hpp"
+
+using namespace rack;
+
+namespace bogaudio {
+
+struct PolyChannelsModule : BGModule {
+ int _polyChannels = 1;
+
+ json_t* dataToJson() override;
+ void dataFromJson(json_t* root) override;
+};
+
+struct PolyChannelsMenuItem : MenuItem {
+ PolyChannelsModule* _module;
+ int _maxChannels;
+
+ PolyChannelsMenuItem(PolyChannelsModule* module, int maxChannels = 16, const char* label = "Polyphony channels")
+ : _module(module)
+ {
+ _maxChannels = clamp(maxChannels, 1, BGModule::maxChannels);
+ this->text = label;
+ }
+
+ Menu* createChildMenu() override;
+ void step() override;
+};
+
+} // namespace bogaudio