computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit b4af126eb05aa5ea84ce49cb979c2e9b5968b413
parent 3df2764aaa40153d842dd1b7bb37e56f6ca6f3ef
Author: Adam M <aemalone@gmail.com>
Date:   Sat,  2 May 2020 09:50:05 -0500

Knoly Pobs re-arrange panel

Diffstat:
Mres/ComputerscareKnolyPobsPanel.svg | 24++++++++++++++++++------
Ares/computerscare-medium-small-knob-disabled.svg | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ares/computerscare-medium-small-knob.svg | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/ComputerscareDrolyPaw.cpp | 2+-
Msrc/ComputerscareKnolyPobs.cpp | 41+++++++++++++++++++++++++++++------------
Msrc/drawFunctions.hpp | 21++++++++++++---------
6 files changed, 208 insertions(+), 28 deletions(-)

diff --git a/res/ComputerscareKnolyPobsPanel.svg b/res/ComputerscareKnolyPobsPanel.svg @@ -26,9 +26,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="8.0000004" - inkscape:cx="27.305316" - inkscape:cy="336.88022" + inkscape:zoom="5.6568545" + inkscape:cx="17.20124" + inkscape:cy="304.59469" inkscape:document-units="mm" inkscape:current-layer="g1669" showgrid="false" @@ -146,7 +146,7 @@ style="opacity:1;vector-effect:none;fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.263;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> <path style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.37162125;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="M 2.0835936,196.45833 H 15.874998 v 13.86979 H 9.0738 l -7.7404456,-3.00771 -0.1427295,-1.75433 z" + d="M 2.0835936,196.45833 H 15.874998 l 0.01913,21.90633 -6.6800115,-0.45945 -7.7404456,-4.57458 -0.283046,-7.76455 z" id="rect888" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccc" /> @@ -331,15 +331,27 @@ inkscape:connector-curvature="0" /> <path style="fill:#afafaf;fill-opacity:1;stroke:none;stroke-width:0.36093959;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 2.0866913,196.46789 -2.08978901,1.62471 -0.01490492,11.57492 1.95193293,0.58729 -0.584701,-2.92828 0.065316,-1.91201 z" + d="m 2.0866913,196.46789 -2.08978901,1.62471 -0.01490492,17.11742 0.73585664,0.93808 0.77169179,-2.83473 -0.2854752,-7.82869 z" id="path890" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccc" /> <path style="fill:#626262;fill-opacity:1;stroke:none;stroke-width:0.42375344;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 1.3416925,207.31988 7.8257324,3.00376 6.6994311,0.01 -2.381744,1.9334 -11.7078953,-2.05413 z" + d="m 1.482009,213.29023 7.7789602,4.59402 6.6291508,0.47772 -2.311464,2.59486 -12.87719912,-4.77357 z" id="path892" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" /> + <path + style="fill:#8f8f8f;fill-opacity:1;stroke:none;stroke-width:0.26585639px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 1.498514,213.37135 0.9124551,2.30841 6.9266199,2.27527 6.551643,0.40571 0.0016,-7.10582 -14.5812224,-1.39148 z" + id="path2752" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccccc" /> + <path + style="fill:#585858;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 1.372526,209.88593 -1.40559891,-1.25677 v 6.48229 l 0.76067704,1.12448 0.74414057,-2.87734 z" + id="path2754" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccc" /> </g> </svg> diff --git a/res/computerscare-medium-small-knob-disabled.svg b/res/computerscare-medium-small-knob-disabled.svg @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + 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" + id="Layer_1" + data-name="Layer 1" + viewBox="0 0 24 24" + version="1.1" + sodipodi:docname="computerscare-medium-small-knob-disabled.svg" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + width="24" + height="24"> + <metadata + id="metadata1289"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title>01 Big Knob</dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1398" + inkscape:window-height="834" + id="namedview1287" + showgrid="false" + inkscape:zoom="15.733333" + inkscape:cx="20.493564" + inkscape:cy="8.0942941" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="Big_Knob" /> + <defs + id="defs1279"> + <style + id="style1277">.cls-1{fill:#245559;}.cls-2{fill:none;stroke:#24c9a6;stroke-miterlimit:10;stroke-width:3px;}</style> + </defs> + <title + id="title1281">01 Big Knob</title> + <g + id="Big_Knob" + data-name="Big Knob" + transform="translate(0,-36)"> + <path + style="fill:#aab8ba;fill-opacity:1;stroke:#000000;stroke-width:0.35600889;stroke-opacity:1" + d="M 22.491682,48.254816 C 23.155106,56.127452 18.03606,59.52617 12.16237,58.98522 6.76125,58.487793 0.02162388,53.919323 1.4821038,48.304954 3.4439431,40.763258 7.8139306,37.183756 12.16237,37.624687 c 3.258236,0.330383 4.796638,1.346299 7.984597,3.404748 1.981201,1.279251 2.16018,5.03558 2.344715,7.225381 z" + id="Big_Button_Circle" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ssssss" /> + <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:#6b7a77;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.22160442;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 12.017786,37.168227 c -0.713782,0.494401 -0.612605,2.666311 -0.612605,2.666311 l -0.360638,0.713752 -0.412717,0.725459 -0.0323,0.892057 0.655841,0.676405 -0.334972,0.779191 -0.45525,2.466053 c 1.218923,-0.245546 1.230481,-0.763929 3.324474,-0.57809 l -0.730737,-1.420035 -0.378245,-1.164016 -0.03063,-1.140663 0.241366,-0.493841 0.03495,-0.615543 -0.203967,-3.666321 c -0.580768,-0.05084 -0.659509,-0.06386 -0.664308,0.01632 -0.0034,0.05316 0,0 -0.04016,0.142957 0,0 -0.0609,0.04805 -0.07694,0.03132 -0.0161,-0.01671 0.07685,-0.03132 0.07685,-0.03132 z" + id="Button_Pointer" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccccccccccscacc" /> + </g> +</svg> diff --git a/res/computerscare-medium-small-knob.svg b/res/computerscare-medium-small-knob.svg @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + 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" + id="Layer_1" + data-name="Layer 1" + viewBox="0 0 24 24" + version="1.1" + sodipodi:docname="computerscare-medium-small-knob.svg" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + width="24" + height="24"> + <metadata + id="metadata1289"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title>01 Big Knob</dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1398" + inkscape:window-height="834" + id="namedview1287" + showgrid="false" + inkscape:zoom="15.733333" + inkscape:cx="20.493564" + inkscape:cy="14.442801" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="0" + inkscape:current-layer="Big_Knob" /> + <defs + id="defs1279"> + <style + id="style1277">.cls-1{fill:#245559;}.cls-2{fill:none;stroke:#24c9a6;stroke-miterlimit:10;stroke-width:3px;}</style> + </defs> + <title + id="title1281">01 Big Knob</title> + <g + id="Big_Knob" + data-name="Big Knob" + transform="translate(0,-36)"> + <path + style="fill:#245559;stroke:#000000;stroke-width:0.35463458;stroke-opacity:1" + d="M 22.47267,47.962007 C 23.133534,55.804253 18.03425,59.189849 12.183234,58.650989 6.8029644,58.15548 0.08935547,53.604648 1.5441974,48.01195 3.4984635,40.499369 7.8515812,36.933686 12.183234,37.372912 c 3.245657,0.329109 4.778121,1.341105 7.953773,3.391607 1.973553,1.274311 2.151842,5.016141 2.335663,7.197488 z" + id="Big_Button_Circle" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ssssss" /> + <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:#24c9a6;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.22074895;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 12.029236,37.816304 c -0.711027,0.492491 -0.610239,2.656017 -0.610239,2.656017 l -0.359247,0.710998 -0.411122,0.722656 -0.03218,0.888616 0.653308,0.673791 -0.333679,0.776185 -0.453493,2.456532 c 1.214218,-0.244598 1.225733,-0.76098 3.311642,-0.575857 l -0.727916,-1.414553 -0.376786,-1.159522 -0.03051,-1.13626 0.240433,-0.491936 0.03481,-0.613166 -0.203179,-3.652169 c -0.578528,-0.05065 -0.656965,-0.0636 -0.661743,0.01625 -0.0033,0.05295 0,0 -0.04002,0.142405 0,0 -0.06067,0.04786 -0.07664,0.03121 -0.01604,-0.01663 0.07657,-0.03121 0.07657,-0.03121 z" + id="Button_Pointer" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccccccccccscacc" /> + </g> +</svg> diff --git a/src/ComputerscareDrolyPaw.cpp b/src/ComputerscareDrolyPaw.cpp @@ -313,7 +313,7 @@ struct DrolyPawDisplay : FramebufferWidget { } else if( mode==3) { //number,-dTHickness,dAngle,dColor (passed to sincolor) - draw.drawLines(20,3,0.1); + draw.drawLines(fmin(65,std::floor(exp(40*buffer[0][1])+2)),buffer[1][0],buffer[2][0]/4,buffer[3][0]*2); } else { int nx = (mode * 17) % 10; diff --git a/src/ComputerscareKnolyPobs.cpp b/src/ComputerscareKnolyPobs.cpp @@ -37,8 +37,8 @@ struct ComputerscareKnolyPobs : ComputerscarePolyModule { configParam(KNOB + i, 0.f, 10.f, 0.f, "Channel " + std::to_string(i + 1)); } configParam(POLY_CHANNELS, 1.f, 16.f, 16.f, "Poly Channels"); - configParam(GLOBAL_SCALE, -2.f, 2.f, 1.f, "Scale","%",0,100); - configParam(GLOBAL_OFFSET, -10.f, 10.f, 0.f, "Offset","Volts"); + configParam(GLOBAL_SCALE, -2.f, 2.f, 1.f, "Scale"); + configParam(GLOBAL_OFFSET, -10.f, 10.f, 0.f, "Offset"," volts"); } void process(const ProcessArgs &args) override { ComputerscarePolyModule::checkCounter(); @@ -66,10 +66,21 @@ struct NoRandomSmallKnob : SmallKnob { return; } }; +struct NoRandomMediumSmallKnob : RoundKnob { + std::shared_ptr<Svg> enabledSvg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-medium-small-knob.svg")); + + NoRandomMediumSmallKnob() { + setSvg(enabledSvg); + RoundKnob(); + }; + void randomize() override { + return; + } +}; struct DisableableSmoothKnob : RoundKnob { - std::shared_ptr<Svg> enabledSvg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-medium-knob-effed.svg")); - std::shared_ptr<Svg> disabledSvg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-medium-knob-disabled.svg")); + std::shared_ptr<Svg> enabledSvg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-medium-small-knob.svg")); + std::shared_ptr<Svg> disabledSvg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-medium-small-knob-disabled.svg")); int channel = 0; bool disabled = false; @@ -77,6 +88,8 @@ struct DisableableSmoothKnob : RoundKnob { DisableableSmoothKnob() { setSvg(enabledSvg); + shadow->box.size = math::Vec(0, 0); + shadow->opacity = 0.f; } void draw(const DrawArgs& args) override { @@ -106,30 +119,34 @@ struct ComputerscareKnolyPobsWidget : ModuleWidget { panel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ComputerscareKnolyPobsPanel.svg"))); addChild(panel); } - channelWidget = new PolyOutputChannelsWidget(Vec(1,23),module,ComputerscareKnolyPobs::POLY_CHANNELS); - + channelWidget = new PolyOutputChannelsWidget(Vec(1,24),module,ComputerscareKnolyPobs::POLY_CHANNELS); + addOutput(createOutput<PointingUpPentagonPort>(Vec(30, 22), module, ComputerscareKnolyPobs::POLY_OUTPUT)); addChild(channelWidget); - addParam(createParam<NoRandomSmallKnob>(Vec(1,3), module, ComputerscareKnolyPobs::GLOBAL_SCALE)); - addParam(createParam<NoRandomSmallKnob>(Vec(15,3), module, ComputerscareKnolyPobs::GLOBAL_OFFSET)); + + + addParam(createParam<NoRandomSmallKnob>(Vec(11,54), module, ComputerscareKnolyPobs::GLOBAL_SCALE)); + addParam(createParam<NoRandomMediumSmallKnob>(Vec(32,57), module, ComputerscareKnolyPobs::GLOBAL_OFFSET)); float xx; float yy; + float yInitial=84; + float ySpacing = 34; + float yRightColumnOffset=14.3/8; for (int i = 0; i < numKnobs; i++) { xx = 1.4f + 24.3 * (i - i % 8) / 8; - yy = 64 + 37.5 * (i % 8) + 14.3 * (i - i % 8) / 8; - addLabeledKnob(std::to_string(i + 1), xx, yy, module, i, (i - i % 8) * 1.2 - 2, 0); + yy = yInitial + ySpacing* (i % 8) + yRightColumnOffset* (i - i % 8) ; + addLabeledKnob(std::to_string(i + 1), xx, yy, module, i, (i - i % 8) * 1.2 - 2 +(i==8 ? 5 : 0), 2); } - addOutput(createOutput<PointingUpPentagonPort>(Vec(28, 24), module, ComputerscareKnolyPobs::POLY_OUTPUT)); } void addLabeledKnob(std::string label, int x, int y, ComputerscareKnolyPobs *module, int index, float labelDx, float labelDy) { smallLetterDisplay = new SmallLetterDisplay(); smallLetterDisplay->box.size = Vec(5, 10); - smallLetterDisplay->fontSize = 16; + smallLetterDisplay->fontSize = 14; smallLetterDisplay->value = label; smallLetterDisplay->textAlign = 1; diff --git a/src/drawFunctions.hpp b/src/drawFunctions.hpp @@ -104,30 +104,33 @@ struct DrawHelper { nvgStroke(vg); nvgRestore(vg); } - drawLines(int n, float dThickness,float dTheta,float dColor=0.1) { + void drawLines(int n, float dThickness,float dTheta,float dColor=0.1) { nvgSave(vg); // nvgBeginPath(vg); //nvgMoveTo(vg, 0,0); - float initialThick=20.f; - float radius=100; - for (unsigned int i = 0; i < n; i++) { - float thickness=initialThick-dThickness*i/n; + float radius=100000; + float thickness=10; + for (int i = 0; i < n; i++) { + NVGcolor color = sincolor(dColor*i/n); float angle = dTheta*i/n*2*M_PI; nvgBeginPath(vg); nvgStrokeColor(vg, color); nvgStrokeWidth(vg, thickness); - float x0=100*cosf(angle); - float y0 = 100*sinf(angle); - float x1 = 100*cosf(angle+M_PI); - float y1 = 100*sinf(angle+M_PI); + float x0=radius*cosf(angle); + float y0 = radius*sinf(angle); + float x1 = radius*cosf(angle+M_PI); + float y1 = radius*sinf(angle+M_PI); nvgMoveTo(vg,x0,y0); nvgLineTo(vg,x1,y1); nvgClosePath(vg); nvgStroke(vg); + + thickness*=expf(dThickness); + } nvgRestore(vg); }