computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 6398bb402bbf0a93366faad4c9b3f3a41dba5bc6
parent 04053e569777cdbc192474399e6cd6cbeeb83bd3
Author: Adam M <aemalone@gmail.com>
Date:   Wed, 13 Jan 2021 22:43:59 -0600

Show sad logo when expander not connected

Diffstat:
Mres/ComputerscareCustomBlankExpanderPanel.svg | 61+++----------------------------------------------------------
Ares/computerscare-logo-normal.svg | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ares/computerscare-logo-sad.svg | 123+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/ComputerscareBlank.cpp | 2+-
Msrc/ComputerscareBlankExpander.cpp | 32+++++++++++++++++++++++++++-----
5 files changed, 265 insertions(+), 64 deletions(-)

diff --git a/res/ComputerscareCustomBlankExpanderPanel.svg b/res/ComputerscareCustomBlankExpanderPanel.svg @@ -24,10 +24,10 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="3.959798" - inkscape:cx="12.478159" - inkscape:cy="265.05363" + inkscape:cx="17.023845" + inkscape:cy="57.467285" inkscape:document-units="mm" - inkscape:current-layer="text929" + inkscape:current-layer="layer1" inkscape:document-rotation="0" showgrid="false" inkscape:window-width="1252" @@ -59,61 +59,6 @@ d="M 0.11351532,0.11283527 H 7.999953 L 7.952706,100.43718 0.11351532,99.96175 Z" sodipodi:nodetypes="ccccc" /> <g - id="g9547" - transform="matrix(0.34537853,-0.08593646,0,0.33853324,-3.4926401,0.35544723)" - style="display:inline;enable-background:new"> - <g - style="display:inline" - inkscape:label="Layer 1" - id="layer4" /> - <path - id="rect5872" - d="m 11.987289,9.3234482 h 7.991524 v 3.9957608 h -7.991524 z" - style="opacity:1;fill:#0f0f00;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - inkscape:connector-curvature="0" /> - <path - id="rect5874" - d="m 14.667374,10.662096 h 3.995763 v 1.331921 h -3.995763 z" - style="opacity:1;fill:#ffffff;fill-opacity:0.985714;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - inkscape:connector-curvature="0" /> - <path - id="rect5878" - d="m -29.323654,9.3234482 h 7.989551 v 3.9957608 h -7.989551 z" - style="opacity:1;fill:#0c0c00;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - transform="scale(-1,1)" - inkscape:connector-curvature="0" /> - <path - id="rect5880" - d="m 26.64423,10.662096 -3.171232,0.209056 v 1.331921 l 3.171232,-0.209056 z" - style="opacity:1;fill:#ffffff;fill-opacity:0.985714;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - inkscape:connector-curvature="0" /> - <path - id="rect5882" - d="m 19.995058,14.667374 h 1.331921 v 3.995762 h -1.331921 z" - style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - inkscape:connector-curvature="0" /> - <path - id="rect5884" - d="m 20.888507,17.21991 2.579094,0.32072 v 1.33192 l -2.579094,-0.32072 z" - style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - inkscape:connector-curvature="0" /> - <path - id="rect5886" - d="m 11.954803,20.011301 h 2.696328 v 2.663842 h -2.696328 z" - style="opacity:1;fill:#000200;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - inkscape:connector-curvature="0" /> - <path - id="rect5888" - d="m 27.970341,20.011301 h 2.696327 v 2.663842 h -2.696327 z" - style="opacity:1;fill:#000200;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - inkscape:connector-curvature="0" /> - <path - id="rect5890" - d="m 14.651131,20.011301 h 13.351695 v 1.33192 H 14.651131 Z" - style="opacity:1;fill:#000200;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - inkscape:connector-curvature="0" /> - </g> - <g aria-label="eoc trg out" diff --git a/res/computerscare-logo-normal.svg b/res/computerscare-logo-normal.svg @@ -0,0 +1,111 @@ +<?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" + width="30" + height="30" + viewBox="0 0 7.9374997 7.9375005" + version="1.1" + id="svg960" + inkscape:version="1.0.1 (c497b03c, 2020-09-10)" + sodipodi:docname="computerscare-logo-normal.svg"> + <defs + id="defs954" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="5.6" + inkscape:cx="2.0871469" + inkscape:cy="47.064626" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + inkscape:document-rotation="0" + showgrid="false" + units="px" + inkscape:window-width="1252" + inkscape:window-height="855" + inkscape:window-x="0" + inkscape:window-y="23" + inkscape:window-maximized="0" /> + <metadata + id="metadata957"> + <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></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <g + id="g9547" + transform="matrix(0.34537854,-0.08593646,0,0.33853324,-3.2465207,0.04172361)" + style="display:inline;enable-background:new"> + <g + style="display:inline" + inkscape:label="Layer 1" + id="layer4" /> + <path + id="rect5872" + d="m 11.987289,9.3234482 h 7.991524 v 3.9957608 h -7.991524 z" + style="opacity:1;fill:#0f0f00;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5874" + d="m 14.667374,10.662096 h 3.995763 v 1.331921 h -3.995763 z" + style="opacity:1;fill:#ffffff;fill-opacity:0.985714;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5878" + d="m -29.323654,9.3234482 h 7.989551 v 3.9957608 h -7.989551 z" + style="opacity:1;fill:#0c0c00;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + transform="scale(-1,1)" + inkscape:connector-curvature="0" /> + <path + id="rect5880" + d="m 26.64423,10.662096 -3.171232,0.209056 v 1.331921 l 3.171232,-0.209056 z" + style="opacity:1;fill:#ffffff;fill-opacity:0.985714;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5882" + d="m 19.995058,14.667374 h 1.331921 v 3.995762 h -1.331921 z" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5884" + d="m 20.888507,17.21991 2.579094,0.32072 v 1.33192 l -2.579094,-0.32072 z" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5886" + d="m 11.954803,20.011301 h 2.696328 v 2.663842 h -2.696328 z" + style="opacity:1;fill:#000200;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5888" + d="m 27.970341,20.011301 h 2.696327 v 2.663842 h -2.696327 z" + style="opacity:1;fill:#000200;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5890" + d="m 14.651131,20.011301 h 13.351695 v 1.33192 H 14.651131 Z" + style="opacity:1;fill:#000200;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + </g> + </g> +</svg> diff --git a/res/computerscare-logo-sad.svg b/res/computerscare-logo-sad.svg @@ -0,0 +1,123 @@ +<?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" + width="30" + height="30" + viewBox="0 0 7.9374997 7.9375005" + version="1.1" + id="svg960" + inkscape:version="1.0.1 (c497b03c, 2020-09-10)" + sodipodi:docname="computerscare-logo-sad.svg"> + <defs + id="defs954" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="11.2" + inkscape:cx="8.6942898" + inkscape:cy="24.386054" + inkscape:document-units="mm" + inkscape:current-layer="g9547" + inkscape:document-rotation="0" + showgrid="false" + units="px" + inkscape:window-width="1252" + inkscape:window-height="855" + inkscape:window-x="0" + inkscape:window-y="23" + inkscape:window-maximized="0" /> + <metadata + id="metadata957"> + <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></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <g + id="g9547" + transform="matrix(0.34537854,-0.08593646,0,0.33853324,-3.2465207,0.04172361)" + style="display:inline;enable-background:new"> + <g + style="display:inline" + inkscape:label="Layer 1" + id="layer4" /> + <path + id="rect5872" + d="m 11.987289,9.3234482 h 7.991524 l 1.348166,5.3439258 -9.33969,-1.348165 z" + style="opacity:1;fill:#0f0f00;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + <path + id="rect5874" + d="m 14.667374,10.662096 h 3.995763 v 1.331921 h -3.995763 z" + style="opacity:1;fill:#ff1818;fill-opacity:0.98571402;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5878" + d="m -29.323654,9.3234482 4.227612,1.5830038 3.761939,2.412757 -9.90472,-2.095768 z" + style="opacity:1;fill:#0c0c00;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + transform="scale(-1,1)" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + <path + id="rect5880" + d="m 26.64423,10.662096 -3.171232,0.209056 v 1.331921 l 3.171232,-0.209056 z" + style="opacity:1;fill:#d43232;fill-opacity:0.98571402;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5882" + d="m 19.995058,14.667374 h 1.331921 v 3.995762 h -1.331921 z" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5884" + d="m 20.888507,17.21991 2.579094,0.32072 v 1.33192 l -2.579094,-0.32072 z" + style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5886" + d="m 11.954803,20.011301 h 2.696328 v 2.663842 h -2.696328 z" + style="opacity:1;fill:#000200;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" /> + <path + id="rect5888" + d="m 26.263837,20.026582 2.145667,1.505198 0.205197,2.36789 -2.350864,0.536172 z" + style="opacity:1;fill:#000200;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + <path + id="rect5890" + d="m 13.214754,17.286219 13.077406,2.733904 v 2.204628 l -11.641029,2.65502 z" + style="opacity:1;fill:#000200;fill-opacity:1;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + <path + style="fill:#feffcb;stroke:#000000;stroke-width:0.77377399999999985px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" + d="m 20.001721,24.074433 0.752388,3.819655 4.30913,0.74496 -1.299579,-6.261363 -4.309131,0.301769 z" + id="path1586" /> + <path + style="fill:none;stroke:#000000;stroke-width:0.773774px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 21.574895,22.380323 1.367978,5.999599" + id="path1588" /> + </g> + </g> +</svg> diff --git a/src/ComputerscareBlank.cpp b/src/ComputerscareBlank.cpp @@ -210,7 +210,7 @@ struct ComputerscareBlank : ComputerscareMenuParamModule { expanderConnected = false; } - if (clockConnected && (clockMode == 2)) { + if (expanderConnected && clockConnected && (clockMode == 2)) { } else { diff --git a/src/ComputerscareBlankExpander.cpp b/src/ComputerscareBlankExpander.cpp @@ -19,7 +19,7 @@ struct FrameOffsetParam : ParamQuantity { struct ComputerscareBlankExpander : Module { float rightMessages[2][10] = {}; - bool isConnected = false; + bool motherConnected = false; float lastFrame = -1; int numFrames = 1; bool scrubbing = false; @@ -81,7 +81,7 @@ struct ComputerscareBlankExpander : Module { if (rightExpander.module && rightExpander.module->model == modelComputerscareBlank) { // Get consumer message float *messageFromMother = (float*) rightExpander.consumerMessage; - isConnected = true; + motherConnected = true; float *messageToSendToMother = (float*) rightExpander.module->leftExpander.producerMessage; @@ -98,8 +98,6 @@ struct ComputerscareBlankExpander : Module { frameOffsetQuantity->setNumFrames(numFrames); } - float currentSyncTime = syncTimer.process(args.sampleTime); - if (eocMessageReadTrigger.process(mappedFrame == scrubFrame ? 10.f : 0.f)) { eocPulse.trigger(1e-3); } @@ -134,7 +132,7 @@ struct ComputerscareBlankExpander : Module { lastTick = tick; } else { - isConnected = false; + motherConnected = false; // No mother module is connected. } } @@ -164,6 +162,26 @@ struct ClockModeButton : app::SvgSwitch { addFrame(APP->window->loadSvg(asset::plugin(pluginInstance, "res/blank-clock-mode-frame.svg"))); } }; +struct LogoWidget : SvgWidget { + ComputerscareBlankExpander *module; + int motherConnected = -1; + LogoWidget() { + setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-logo-normal.svg"))); + SvgWidget(); + } + void step() override { + if(module) { + if(module->motherConnected != motherConnected) { + if(module->motherConnected) { + setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-logo-normal.svg"))); + } else { + setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/computerscare-logo-sad.svg"))); + } + } + motherConnected = module->motherConnected; + } + } +}; struct ComputerscareBlankExpanderWidget : ModuleWidget { ComputerscareBlankExpanderWidget(ComputerscareBlankExpander *module) { setModule(module); @@ -175,6 +193,10 @@ struct ComputerscareBlankExpanderWidget : ModuleWidget { addChild(panel); } + LogoWidget *logo = new LogoWidget(); + logo->module = module; + addChild(logo); + float inStartY = 20; float dY = 40;