computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 63aa338839c87fdcd34caf41e981eaaeb6f5cd1d
parent ccf630341d19e77f1f3313ce7ce2bc9c96e1e916
Author: Adam M <[email protected]>
Date:   Tue, 30 Jun 2020 12:04:39 -0500

Themes for column and row patrix attenuators

Diffstat:
Mres/ComputerscareMolyPatrixPanel.svg | 66+++++++++++++++++++++++++++++++++++++++---------------------------
Mres/computerscare-small-knob-effed-dark.svg | 6+++---
Msrc/ComputerscareMolyPatrix.cpp | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
3 files changed, 96 insertions(+), 57 deletions(-)

diff --git a/res/ComputerscareMolyPatrixPanel.svg b/res/ComputerscareMolyPatrixPanel.svg @@ -9,9 +9,9 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="390" + width="420" height="380" - viewBox="0 0 103.1875 100.54167" + viewBox="0 0 111.125 100.54167" version="1.1" id="svg8" inkscape:version="0.92.2 5c3e80d, 2017-08-06" @@ -26,9 +26,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="2.8284273" - inkscape:cx="165.01547" - inkscape:cy="294.04472" + inkscape:zoom="11.313709" + inkscape:cx="140.41392" + inkscape:cy="325.28079" inkscape:document-units="mm" inkscape:current-layer="g1669" showgrid="false" @@ -140,44 +140,38 @@ inkscape:groupmode="layer" inkscape:label="Layer 1 copy"> <rect - style="fill:#a7a7a7;fill-opacity:1;stroke:#171717;stroke-width:0.57097405;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" + style="fill:#a7a7a7;fill-opacity:1;stroke:#171717;stroke-width:0.65265042;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" id="rect873" - width="24.098976" - height="9.6184006" - x="1.6593875" - y="199.03903" /> + width="31.756361" + height="9.5367241" + x="1.7002257" + y="199.07986" /> <path inkscape:connector-curvature="0" id="path1647" - d="m 21.766113,207.5942 0.02689,-6.3821 -0.588154,-1.66695 80.015584,-0.82114 v 98.27598 H 0 l 0.07214661,-90.48749 2.59727799,1.19061 z" + d="m 33.540071,207.52806 0.291473,-5.05919 3.545961,-0.60862 70.391025,-3.51042 v 98.65016 H 0 l 0.07214661,-90.48749 2.59727799,1.19061 z" style="opacity:1;vector-effect:none;fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.71707737;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" sodipodi:nodetypes="ccccccccc" /> <path style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.60485148;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 40.751038,196.45833 h 62.658512 v 8.08714 h -30.8999 c -18.33529,-1.39489 -18.301741,-1.40936 -31.758612,-2.83448 z" + d="m 48.556246,196.59062 h 62.584104 l 0.008,8.07887 -30.833752,0.008 c -18.33529,-1.39489 -18.301741,-1.40936 -31.758612,-2.83448 z" id="rect888" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" /> <path - style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-width:0.54077643;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 40.799475,196.46391 -18.33072,2.91266 -0.001,6.93688 17.87222,0.43823 0.50388,-3.51134 0.023,-0.0264 z" - id="path890" - inkscape:connector-curvature="0" - sodipodi:nodetypes="ccccccc" /> - <path style="fill:#626262;fill-opacity:1;stroke:none;stroke-width:0.68970191;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 40.89083,201.64596 32.044186,2.89689 30.437544,0.006 -2.68264,1.34551 -61.330844,-1.4159 z" + d="m 48.696038,201.77825 32.044186,2.89689 30.387936,-0.0106 -3.3689,1.36204 -60.594976,-1.4159 z" id="path892" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" /> <g aria-label="MOLYPATRIX" - transform="matrix(1.0524052,0,0,0.55404123,7.9375004,81.908224)" + transform="matrix(0.82834525,0,0,0.55404123,23.136226,82.040516)" style="font-style:normal;font-weight:normal;font-size:7.10298109px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#585858;fill-opacity:1;stroke:none;stroke-width:0.17757453" id="text1034"> <path d="m 33.183503,208.48071 h 1.196289 l 1.51424,3.80797 1.522188,-3.80797 h 1.196289 l 0.06285,7.54491 -0.908658,-0.41767 0.06285,-6.44511 -1.530136,3.83796 H 35.49262 l -1.530138,-3.83796 v 4.91364 h -0.778979 z" - style="fill:#585858;fill-opacity:1;stroke-width:0.19760819" + style="fill:#a6a6a6;fill-opacity:1;stroke-width:0.19760819" id="path1036" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccccccc" /> @@ -232,11 +226,17 @@ id="path1054" inkscape:connector-curvature="0" /> </g> + <path + style="fill:#c5c5c5;fill-opacity:1;stroke:none;stroke-width:0.54077643;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 50.932513,196.44786 -3.846812,0.0128 -14.483908,2.89982 -10e-4,6.93688 17.87222,0.43823 0.50388,-3.51134 0.023,-0.0264 z" + id="path890" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccc" /> <g id="g9547" - transform="matrix(0.52002266,-0.10414724,0,0.14380498,23.095848,199.01864)" - inkscape:transform-center-x="-0.05944033" - inkscape:transform-center-y="0.4137482"> + transform="matrix(0.59876004,-0.1518551,0,0.22273869,30.814273,198.93071)" + inkscape:transform-center-x="-0.068440388" + inkscape:transform-center-y="0.63558778"> <g style="display:inline" inkscape:label="Layer 1" @@ -290,7 +290,7 @@ </g> <g aria-label="computerscare" - transform="matrix(0.80835697,0.02966973,0.17888919,1.8412997,-36.601455,-339.27307)" + transform="matrix(0.80835697,0.02966973,0.17888919,1.8412997,-26.468417,-339.28912)" style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" id="text1651"> <path @@ -309,8 +309,8 @@ id="path1705" inkscape:connector-curvature="0" /> <path - d="m 14.742929,294.81667 v 0.81855 h -0.254937 v -2.13044 h 0.254937 v 0.23426 q 0.07993,-0.1378 0.201194,-0.20395 0.122645,-0.0675 0.292144,-0.0675 0.28112,0 0.45613,0.22324 0.176389,0.22324 0.176389,0.58705 0,0.3638 -0.176389,0.58704 -0.17501,0.22324 -0.45613,0.22324 -0.169499,0 -0.292144,-0.0661 -0.121268,-0.0675 -0.201194,-0.20533 z m 0.862652,-0.53881 q 0,-0.27975 -0.115755,-0.43822 -0.114377,-0.15985 -0.315571,-0.15985 -0.201193,0 -0.316949,0.15985 -0.114377,0.15847 -0.114377,0.43822 0,0.27974 0.114377,0.43959 0.115756,0.15847 0.316949,0.15847 0.201194,0 0.315571,-0.15847 0.115755,-0.15985 0.115755,-0.43959 z" - style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222223px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332" + d="m 14.88837,295.01649 0.01168,0.6162 -0.208407,2.4e-4 -0.0304,-1.60376 0.208407,-2.4e-4 0.0033,0.17634 q 0.06337,-0.10382 0.161564,-0.15374 0.0993,-0.051 0.237859,-0.0511 0.229808,-1.7e-4 0.376067,0.16757 0.147381,0.16787 0.152571,0.44175 0.0052,0.27386 -0.135819,0.44209 -0.139884,0.16824 -0.369696,0.16853 -0.138564,1.8e-4 -0.23977,-0.0494 -0.100097,-0.0507 -0.167403,-0.15436 z m 0.69752,-0.4065 q -0.004,-0.21059 -0.100881,-0.32976 -0.09578,-0.12022 -0.260257,-0.12001 -0.164472,2.1e-4 -0.25682,0.12066 -0.09124,0.11942 -0.08725,0.33001 0.004,0.21058 0.09977,0.3308 0.09689,0.11917 0.261364,0.11896 0.164473,-2.1e-4 0.255714,-0.11962 0.09235,-0.12046 0.08835,-0.33104 z" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222223px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.20756014" id="path1707" inkscape:connector-curvature="0" /> <path @@ -362,5 +362,17 @@ inkscape:connector-curvature="0" sodipodi:nodetypes="ccccscccsscscscccccsccc" /> </g> + <path + style="fill:#4b4f54;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 32.577987,206.28136 0.817337,1.24348 18.33469,0.39755 -1.26285,-1.19268 z" + id="path3458" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + <path + style="fill:#828487;fill-opacity:1;stroke:none;stroke-width:0.23473436px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 51.741194,207.93776 -0.647599,-10.60926 -0.266905,-0.86528 0.04602,6.61826 -0.402792,3.66025 z" + id="path3460" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccc" /> </g> </svg> diff --git a/res/computerscare-small-knob-effed-dark.svg b/res/computerscare-small-knob-effed-dark.svg @@ -42,7 +42,7 @@ showgrid="false" inkscape:zoom="22.378007" inkscape:cx="-0.98240185" - inkscape:cy="9.9790231" + inkscape:cy="4.6166153" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" @@ -59,13 +59,13 @@ data-name="Big Knob" transform="translate(0,-42)"> <path - style="fill:#0d8691;fill-opacity:1;stroke:#000000;stroke-width:0.794;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" + style="fill:#257279;fill-opacity:1;stroke:#000000;stroke-width:0.794;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" d="m 17.306156,50.928799 c 0.547144,6.492783 -3.674677,9.295802 -8.5188736,8.849665 -4.4544548,-0.410243 -9.25218903,-4.158274 -8.1261913,-8.808316 1.8128765,-7.48665 4.5399117,-8.489838 8.8083151,-8.808316 0.2710372,-0.02022 0.4944121,-0.0716 0.6174528,0.01303 0.851296,0.585106 -1.6051492,2.237455 4.408529,3.087358 0,0 2.658576,3.860647 2.810768,5.666637 z" id="Big_Button_Circle" inkscape:connector-curvature="0" sodipodi:nodetypes="sssssss" /> <path - style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#5ce8e8;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.23041919;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#7eeded;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.23041919;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="m 9.6493062,42.217346 c 0.6901338,1.262844 -0.548965,3.216837 -0.548965,3.216837 l -0.3231724,0.861123 -0.3698409,0.875245 -0.02896,1.076248 0.4536482,0.994808 0.2552772,1.369224 -0.8293436,2.367331 c 1.5767568,0.128967 1.6355518,0.105956 2.9791143,-0.697449 l -0.654823,-1.713233 -0.338963,-1.404356 -0.0276,-1.376181 0.21628,-0.595809 -0.415667,-1.10013 1.174804,-3.480722 -0.910737,-0.425652 c -0.6312958,0.192164 -0.6394358,-0.0063 -0.6437358,0.09061 -0.00293,0.06413 0.04844,-0.230324 0.0124,-0.05784 0,0 -0.071022,0.01167 -0.06892,0.03779 0.0016,0.01993 0.05652,0.02005 0.05652,0.02005 z" id="Button_Pointer" inkscape:connector-curvature="0" diff --git a/src/ComputerscareMolyPatrix.cpp b/src/ComputerscareMolyPatrix.cpp @@ -25,6 +25,12 @@ struct ComputerscareMolyPatrix : ComputerscarePolyModule { }; enum InputIds { POLY_INPUT, + ZERO_INPUT, + ONE_INPUT, + INPUT_ATTENUATION_CV, + INPUT_OFFSET_CV, + OUTPUT_ATTENUATION_CV, + OUTPUT_ATTENUATION_OFFSET, NUM_INPUTS }; enum OutputIds { @@ -74,55 +80,78 @@ struct ComputerscareMolyPatrix : ComputerscarePolyModule { } void process(const ProcessArgs &args) override { ComputerscarePolyModule::checkCounter(); - for (int j = 0; j < numRows; j++) { - float out = 0.f; + float outTrim = params[OUTPUT_TRIM].getValue(); + float outOffset = params[OUTPUT_OFFSET].getValue(); + + for (int outIndex = 0; outIndex < numRows; outIndex++) { + float outVoltage = 0.f; for (int i = 0; i < numColumns; i++) { - out += params[KNOB + i * 16 + j].getValue() * inputs[POLY_INPUT].getVoltage(i) * params[INPUT_ROW_TRIM + i].getValue() * params[INPUT_TRIM].getValue(); + outVoltage += params[KNOB + i * 16 + outIndex].getValue() * inputs[POLY_INPUT].getVoltage(i) * params[INPUT_ROW_TRIM + i].getValue() * params[INPUT_TRIM].getValue() + params[OUTPUT_OFFSET].getValue(); } - outputs[POLY_OUTPUT].setVoltage(out, j); + outputs[POLY_OUTPUT].setVoltage(params[OUTPUT_COLUMN_TRIM + outIndex].getValue()*outTrim * outVoltage + outOffset, outIndex); } } + }; + + + struct DisableableSmallKnob : RoundKnob { - std::vector<std::shared_ptr<Svg>> enabledThemes = {APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-small-knob-effed.svg")),APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-small-knob-dark.svg"))}; + std::vector<std::shared_ptr<Svg>> enabledThemes = {APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-small-knob-effed.svg")), APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-small-knob-effed-dark.svg"))}; + std::shared_ptr<Svg> enabledSvg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-small-knob-effed.svg")); std::shared_ptr<Svg> disabledSvg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-small-knob-effed-disabled.svg")); int inputChannel = 0; int outputChannel = 0; + int themeIndex = 0; bool disabled = false; + bool initialized=false; + bool randomizable=true; ComputerscareMolyPatrix *module; DisableableSmallKnob() { - setSvg(enabledSvg); + setSvg(enabledThemes[themeIndex]); shadow->box.size = math::Vec(0, 0); shadow->opacity = 0.f; + dirtyValue=-21.f; } void draw(const DrawArgs& args) override { if (module) { - bool candidateDisabled = (module->numInputChannels !=0 && inputChannel > module->numInputChannels-1 || outputChannel > module->polyChannels-1) ; - if (disabled != candidateDisabled) { - setSvg(candidateDisabled ? disabledSvg : enabledSvg); + bool candidateDisabled = (module->numInputChannels != 0 && inputChannel > module->numInputChannels - 1 || outputChannel > module->polyChannels - 1) ; + if (disabled != candidateDisabled || !initialized) { + setSvg(candidateDisabled ? disabledSvg : enabledThemes[themeIndex]); dirtyValue = -20.f; disabled = candidateDisabled; + initialized=true; } } else { } RoundKnob::draw(args); } + void randomize() override { + if(randomizable) { + RoundKnob::randomize(); + } + else { + return; + } + } }; struct ComputerscareMolyPatrixWidget : ModuleWidget { + ComputerscareMolyPatrixWidget(ComputerscareMolyPatrix *module) { setModule(module); + //setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ComputerscareMolyPatrixPanel.svg"))); - box.size = Vec(26 * 15, 380); + box.size = Vec(28 * 15, 380); { ComputerscareSVGPanel *panel = new ComputerscareSVGPanel(); panel->box.size = box.size; @@ -137,43 +166,41 @@ struct ComputerscareMolyPatrixWidget : ModuleWidget { float yy; float x0 = 30; float dx = 21.4; - float y0 = 41; + float y0 = 43; float dy = 21; addInput(createInput<PointingUpPentagonPort>(Vec(9, 12), module, ComputerscareMolyPatrix::POLY_INPUT)); - addKnob(36, 16, module, ComputerscareMolyPatrix::INPUT_TRIM, 0, 0); + addKnob(36, 16, module, ComputerscareMolyPatrix::INPUT_TRIM, 0, 0,1,0); for (int i = 0; i < numRows; i++) { for (int j = 0; j < numColumns; j++) { xx = x0 + j * dx; yy = y0 + i * dy; - addKnob( xx, yy, module, i * 16 + j, i,j); + addKnob( xx, yy, module, i * 16 + j, i, j); } - addKnob( x0 - 25, y0 + i * dy, module, ComputerscareMolyPatrix::INPUT_ROW_TRIM + i,i,0); + addKnob( x0 - 25, y0 + i * dy, module, ComputerscareMolyPatrix::INPUT_ROW_TRIM + i, i, 0,1,0); + addKnob( 420 - 40, y0 + i * dy, module, ComputerscareMolyPatrix::OUTPUT_COLUMN_TRIM + i, 0, i,1,0); + } - channelWidget = new PolyOutputChannelsWidget(Vec(290, 1), module, ComputerscareMolyPatrix::POLY_CHANNELS); + channelWidget = new PolyOutputChannelsWidget(Vec(352, 5), module, ComputerscareMolyPatrix::POLY_CHANNELS); addChild(channelWidget); - addOutput(createOutput<InPort>(Vec(318, 1), module, ComputerscareMolyPatrix::POLY_OUTPUT)); - } - void addKnob(int x, int y, ComputerscareMolyPatrix *module, int index, int row,int column) { + addKnob(372, 1, module, ComputerscareMolyPatrix::OUTPUT_TRIM, 0, 0,1,0); + addOutput(createOutput<InPort>(Vec(390, 1), module, ComputerscareMolyPatrix::POLY_OUTPUT)); - /* smallLetterDisplay = new SmallLetterDisplay(); - smallLetterDisplay->box.size = Vec(5, 10); - smallLetterDisplay->fontSize = 16; - smallLetterDisplay->value = label; - smallLetterDisplay->textAlign = 1;*/ + + } + void addKnob(int x, int y, ComputerscareMolyPatrix *module, int index, int row, int column, int theme = 0,bool randomizable=true) { knob = createParam<DisableableSmallKnob>(Vec(x, y), module, ComputerscareMolyPatrix::KNOB + index); + knob->module = module; knob->inputChannel = row; knob->outputChannel = column; + knob->themeIndex = theme; + knob->randomizable=randomizable; addParam(knob); - //smallLetterDisplay->box.pos = Vec(x + labelDx, y - 12 + labelDy); - - -// addChild(smallLetterDisplay); } DisableableSmallKnob* knob;