computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 23c3a5c3f44faaf62714a896a007a4dd2afeed5b
parent a21fda6d02ecee672930202213f18f0f85969969
Author: Adam M <aemalone@gmail.com>
Date:   Mon, 29 Jun 2020 12:34:33 -0500

Input attenuation for patrix

Diffstat:
Mres/ComputerscareMolyPatrixPanel.svg | 44++++++++++++++++++++++----------------------
Msrc/ComputerscareDrolyPaw.cpp | 3---
Msrc/ComputerscareMolyPatrix.cpp | 38++++++++++++++++++++++++--------------
3 files changed, 46 insertions(+), 39 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="360" + width="390" height="380" - viewBox="0 0 95.25 100.54167" + viewBox="0 0 103.1875 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="4.0000002" - inkscape:cx="76.731208" - inkscape:cy="355.04977" + inkscape:zoom="2.8284273" + inkscape:cx="165.01547" + inkscape:cy="294.04472" inkscape:document-units="mm" inkscape:current-layer="g1669" showgrid="false" @@ -53,7 +53,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title /> + <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> @@ -140,39 +140,39 @@ inkscape:groupmode="layer" inkscape:label="Layer 1 copy"> <rect - style="fill:#a7a7a7;fill-opacity:1;stroke:#171717;stroke-width:0.36300001;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.57097405;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers" id="rect873" - width="10.649479" - height="8.7973871" - x="2.1166666" - y="199.96405" /> + width="24.098976" + height="9.6184006" + x="1.6593875" + y="199.03903" /> <path inkscape:connector-curvature="0" id="path1647" - d="m 12.236979,208.24901 -0.661459,-5.82083 0.661458,-2.97657 80.564465,-0.7276 v 98.27598 H 0 l 0.06614583,-90.48749 2.38124987,1.19061 z" - style="opacity:1;vector-effect:none;fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.68660867;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" + 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" + 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 32.813533,196.45833 h 62.658494 v 8.08714 H 64.572145 c -18.33529,-1.39489 -18.301741,-1.40936 -31.758612,-2.83448 z" + 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" id="rect888" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" /> <path - style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-width:0.57281995;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 32.853748,196.46391 -20.567441,2.91266 -0.0012,6.93688 20.052995,0.43823 0.565363,-3.51134 0.02581,-0.0264 z" + 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 32.953325,201.64596 32.044186,2.89689 30.437524,0.006 -2.682618,1.34551 -61.330846,-1.4159 z" + d="m 40.89083,201.64596 32.044186,2.89689 30.437544,0.006 -2.68264,1.34551 -61.330844,-1.4159 z" id="path892" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" /> <g aria-label="MOLYPATRIX" - transform="matrix(1.0524052,0,0,0.55404123,0,81.908224)" + transform="matrix(1.0524052,0,0,0.55404123,7.9375004,81.908224)" 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 @@ -234,9 +234,9 @@ </g> <g id="g9547" - transform="matrix(0.57977965,-0.08585884,0,0.11855262,12.537718,199.37261)" - inkscape:transform-center-x="-0.066270788" - inkscape:transform-center-y="0.34109619"> + 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"> <g style="display:inline" inkscape:label="Layer 1" @@ -290,7 +290,7 @@ </g> <g aria-label="computerscare" - transform="matrix(0.90699297,0.02966973,0.20071732,1.8412997,-53.991671,-339.27307)" + transform="matrix(0.80835697,0.02966973,0.17888919,1.8412997,-36.601455,-339.27307)" 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 diff --git a/src/ComputerscareDrolyPaw.cpp b/src/ComputerscareDrolyPaw.cpp @@ -477,9 +477,6 @@ struct DrolyPawWidget : ModuleWidget { addInput(createInput<PointingUpPentagonPort>(Vec(114, 333), module, DrolyPaw::DRAW_TRIGGER)); addInput(createInput<PointingUpPentagonPort>(Vec(134, 333), module, DrolyPaw::DRAW_GATE)); - - - ComputerscareResizeHandle *leftHandle = new ComputerscareResizeHandle(); ComputerscareResizeHandle *rightHandle = new ComputerscareResizeHandle(); diff --git a/src/ComputerscareMolyPatrix.cpp b/src/ComputerscareMolyPatrix.cpp @@ -15,9 +15,12 @@ struct ComputerscareMolyPatrix : ComputerscarePolyModule { enum ParamIds { KNOB, INPUT_ROW_TRIM = KNOB + numKnobs, - OUTPUT_COLUMN_TRIM=INPUT_ROW_TRIM+numRows, - OUTPUT_TRIM=OUTPUT_COLUMN_TRIM+numColumns, + OUTPUT_COLUMN_TRIM = INPUT_ROW_TRIM + numRows, + OUTPUT_TRIM = OUTPUT_COLUMN_TRIM + numColumns, POLY_CHANNELS, + INPUT_TRIM, + INPUT_OFFSET, + OUTPUT_OFFSET, NUM_PARAMS }; enum InputIds { @@ -40,13 +43,17 @@ struct ComputerscareMolyPatrix : ComputerscarePolyModule { configParam(KNOB+n,-1.f,1.f,0.f); }*/ for (int i = 0; i < numRows; i++) { - configParam(INPUT_ROW_TRIM+i,-2.f,2.f,1.f,"Input Channel "+std::to_string(i+1)+" Attenuation"); - configParam(OUTPUT_COLUMN_TRIM+i,-2.f,2.f,1.f,"Output Channel "+std::to_string(i+1)+" Attenuation"); + configParam(INPUT_ROW_TRIM + i, -2.f, 2.f, 1.f, "Input Channel " + std::to_string(i + 1) + " Attenuation"); + configParam(OUTPUT_COLUMN_TRIM + i, -2.f, 2.f, 1.f, "Output Channel " + std::to_string(i + 1) + " Attenuation"); for (int j = 0; j < numColumns; j++) { - configParam(KNOB + i * 16 + j, -2.f, 2.f, i == j ? 1.f : 0.f, "i:" + std::to_string(i) + ",j:" + std::to_string(j)); + configParam(KNOB + i * 16 + j, -2.f, 2.f, i == j ? 1.f : 0.f, "Input ch." + std::to_string(i+1) + " → Output ch." + std::to_string(j+1)); } - configParam(OUTPUT_TRIM,-2.f,2.f,1.f,"Output Attenuation"); - configParam<AutoParamQuantity>(POLY_CHANNELS,0.f,16.f,0.f,"Poly Channels"); + configParam(OUTPUT_TRIM, -2.f, 2.f, 1.f, "Output Attenuation"); + configParam(OUTPUT_OFFSET, -10.f, 10.f, 0.f, "Output Offset"); + configParam(INPUT_TRIM, -2.f, 2.f, 1.f, "Input Attenuation"); + + configParam(INPUT_OFFSET, -10.f, 10.f, 0.f, "Input Offset"); + configParam<AutoParamQuantity>(POLY_CHANNELS, 0.f, 16.f, 0.f, "Poly Channels"); } } @@ -66,11 +73,11 @@ struct ComputerscareMolyPatrix : ComputerscarePolyModule { outputs[POLY_OUTPUT].setChannels(polyChannels); } void process(const ProcessArgs &args) override { - ComputerscarePolyModule::checkCounter(); + ComputerscarePolyModule::checkCounter(); for (int j = 0; j < numRows; j++) { float out = 0.f; for (int i = 0; i < numColumns; i++) { - out += params[KNOB + j * 16 + i].getValue() * inputs[POLY_INPUT].getVoltage(i); + out += params[KNOB + i * 16 + j].getValue() * inputs[POLY_INPUT].getVoltage(i)*params[INPUT_ROW_TRIM+i].getValue()*params[INPUT_TRIM].getValue(); } outputs[POLY_OUTPUT].setVoltage(out, j); } @@ -83,7 +90,7 @@ struct ComputerscareMolyPatrixWidget : ModuleWidget { setModule(module); //setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ComputerscareMolyPatrixPanel.svg"))); - box.size = Vec(24 * 15, 380); + box.size = Vec(26 * 15, 380); { ComputerscareSVGPanel *panel = new ComputerscareSVGPanel(); panel->box.size = box.size; @@ -96,22 +103,25 @@ struct ComputerscareMolyPatrixWidget : ModuleWidget { } float xx; float yy; - float x0 = 6; + float x0 = 30; float dx = 21.4; - float y0 = 40; + float y0 = 41; float dy = 21; - addInput(createInput<PointingUpPentagonPort>(Vec(11, 14), module, ComputerscareMolyPatrix::POLY_INPUT)); + addInput(createInput<PointingUpPentagonPort>(Vec(9, 12), module, ComputerscareMolyPatrix::POLY_INPUT)); + addLabeledKnob("",36,16,module,ComputerscareMolyPatrix::INPUT_TRIM,0,0); + for (int i = 0; i < numRows; i++) { for (int j = 0; j < numColumns; j++) { xx = x0 + j * dx; yy = y0 + i * dy; addLabeledKnob(std::to_string(i + 1), xx, yy, module, i * 16 + j, 0, 0); } + addLabeledKnob("",x0-25,y0+i*dy,module,ComputerscareMolyPatrix::INPUT_ROW_TRIM+i,0,0); } - + channelWidget = new PolyOutputChannelsWidget(Vec(290, 1), module, ComputerscareMolyPatrix::POLY_CHANNELS); addChild(channelWidget); addOutput(createOutput<InPort>(Vec(318, 1), module, ComputerscareMolyPatrix::POLY_OUTPUT));