computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 756d65ab603b5b7bea80c73f3c8a4ee699c48116
parent 44c7d4de780ada83d3c6b12134807acef06889f9
Author: Adam M <aemalone@gmail.com>
Date:   Wed, 19 Dec 2018 01:43:09 -0600

Manual clock button for cookies

Diffstat:
Mres/ComputerscareILoveCookiesPanel.svg | 25+------------------------
Ares/computerscare-clk-text-red.svg | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ares/computerscare-clk-text.svg | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/Computerscare.hpp | 6++++++
Msrc/ComputerscareILoveCookies.cpp | 6++++--
Msrc/dtpulse.cpp | 5++++-
6 files changed, 183 insertions(+), 27 deletions(-)

diff --git a/res/ComputerscareILoveCookiesPanel.svg b/res/ComputerscareILoveCookiesPanel.svg @@ -35,7 +35,7 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="5.6568544" - inkscape:cx="165.90352" + inkscape:cx="134.26049" inkscape:cy="357.21727" inkscape:document-units="mm" inkscape:current-layer="text1651" @@ -146,29 +146,6 @@ 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.24368711" id="path1725" inkscape:connector-curvature="0" /> - <g - aria-label="clk" - transform="matrix(2.3525877,-0.10292753,0.2449229,1.9213172,40.276041,-190.37734)" - style="font-style:normal;font-weight:normal;font-size:1.90312397px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.01258837" - id="text868"> - <path - d="m -47.14865,203.94633 0.07098,0.19958 c -0.0692,-0.0333 -0.135769,-0.0581 -0.199658,-0.0743 -0.0634,-0.0169 -0.124526,-0.0254 -0.183372,-0.0254 -0.13166,0 -0.218211,0.0441 -0.259669,0.13228 -0.04174,0.0874 -0.0344,0.2104 0.022,0.36898 0.05639,0.15858 0.136684,0.28197 0.240879,0.37015 0.103904,0.0874 0.221685,0.1311 0.353342,0.1311 0.05884,0 0.114014,-0.008 0.165676,-0.0243 0.05203,-0.0171 0.08575,0.0217 0.13131,-0.0116 l 0.08526,0.13352 c -0.04671,0.0279 -0.09812,0.0488 -0.154244,0.0626 -0.05537,0.0139 -0.11726,0.0208 -0.185661,0.0208 -0.186089,0 -0.355794,-0.0614 -0.509142,-0.1845 -0.153336,-0.12299 -0.267144,-0.28891 -0.341426,-0.49777 -0.07538,-0.21195 -0.0795,-0.37865 -0.01236,-0.50009 0.06788,-0.12144 0.198163,-0.18217 0.390872,-0.18217 0.06252,0 0.125982,0.007 0.19056,0.0208 0.06425,0.0131 0.129133,0.0332 0.194664,0.0603 z" - style="stroke-width:0.01532727" - id="path877" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccscccsccccscscsccc" /> - <path - d="m -46.874682,203.57895 0.142911,-0.0353 0.477431,1.633 -0.142911,0.0353 z" - style="stroke-width:0.01266381" - id="path879" - inkscape:connector-curvature="0" /> - <path - d="m -45.316254,203.55297 h 0.105823 l -0.30408,0.97435 0.684115,-0.51209 0.06147,0.0849 0.0099,0.0299 -0.587562,0.44072 0.393944,0.6319 -0.370906,-0.0255 -0.220701,-0.55448 -0.180998,0.57995 h -0.176676 z" - style="stroke-width:0.01363125" - id="path881" - inkscape:connector-curvature="0" - sodipodi:nodetypes="ccccccccccccc" /> - </g> <text xml:space="preserve" style="font-style:normal;font-weight:normal;font-size:3.52777767px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.07000434" diff --git a/res/computerscare-clk-text-red.svg b/res/computerscare-clk-text-red.svg @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<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="10mm" + height="5mm" + viewBox="0 0 10 5" + version="1.1" + id="svg890" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="computerscare-clk-text-red.svg"> + <defs + id="defs884" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="11.2" + inkscape:cx="15.446429" + inkscape:cy="6.3727779" + inkscape:document-units="mm" + inkscape:current-layer="text1588" + showgrid="false" + units="mm" + inkscape:window-width="1440" + inkscape:window-height="855" + inkscape:window-x="0" + inkscape:window-y="1" + inkscape:window-maximized="1" /> + <metadata + id="metadata887"> + <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" + transform="translate(0,-292)"> + <g + aria-label="rst" + style="font-style:normal;font-weight:normal;font-size:6.29599571px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.15739989" + id="text1460"> + <g + aria-label="clk" + style="font-style:normal;font-weight:normal;font-size:5.05844212px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.01990495" + id="text1588"> + <path + d="m 2.9257701,293.36171 0.034763,0.45704 q -0.2390654,-0.13829 -0.4766353,-0.21845 -0.2348181,-0.0824 -0.4710995,-0.10709 -0.5286357,-0.0556 -0.798035,0.21727 -0.26955915,0.26976 -0.2281263,0.81448 0.0414319,0.54473 0.35687,0.87815 0.3152359,0.33076 0.8439147,0.38591 0.2362638,0.0248 0.4624051,-0.007 0.2288802,-0.034 0.450566,-0.12435 l 0.034358,0.45172 q -0.2201398,0.0718 -0.4616486,0.0942 -0.2385579,0.0225 -0.5132366,-0.006 -0.7472412,-0.0779 -1.21944741,-0.54634 -0.4722083,-0.46841 -0.52677688,-1.18585 -0.0553776,-0.72809 0.35591746,-1.09904 0.41424933,-0.37066 1.18807023,-0.28994 0.2510522,0.0261 0.493921,0.0991 0.2426765,0.0701 0.47421,0.18657 z" + style="stroke-width:0.02248672;fill:#ea0000;fill-opacity:1" + id="path1590" + inkscape:connector-curvature="0" /> + <path + d="m 3.6089628,293.07208 0.7058223,-0.18901 0.7372309,3.31648 -0.7058213,0.189 z" + style="stroke-width:0.02371932;fill:#ea0000;fill-opacity:1" + id="path1592" + inkscape:connector-curvature="0" /> + <path + d="m 6.8029782,292.75972 0.5463818,0.0572 -0.7653993,2.23004 2.0237512,-1.0029 0.6940731,0.0724 -2.170958,1.18675 1.5893239,1.30322 -0.986179,0.16156 -1.2249727,-1.50264 -0.4555763,1.32734 -0.5463819,-0.0572 z" + style="stroke-width:0.02195736;fill:#ea0000;fill-opacity:1" + id="path1594" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccccccc" /> + </g> + </g> + </g> +</svg> diff --git a/res/computerscare-clk-text.svg b/res/computerscare-clk-text.svg @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<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="10mm" + height="5mm" + viewBox="0 0 10 5" + version="1.1" + id="svg890" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="computerscare-clk-text.svg"> + <defs + id="defs884" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="11.2" + inkscape:cx="15.446429" + inkscape:cy="6.3727779" + inkscape:document-units="mm" + inkscape:current-layer="text1588" + showgrid="false" + units="mm" + inkscape:window-width="1440" + inkscape:window-height="855" + inkscape:window-x="0" + inkscape:window-y="1" + inkscape:window-maximized="1" /> + <metadata + id="metadata887"> + <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 /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-292)"> + <g + aria-label="rst" + style="font-style:normal;font-weight:normal;font-size:6.29599571px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.15739989" + id="text1460"> + <g + aria-label="clk" + style="font-style:normal;font-weight:normal;font-size:5.05844212px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.01990495" + id="text1588"> + <path + d="m 2.9257701,293.36171 0.034763,0.45704 q -0.2390654,-0.13829 -0.4766353,-0.21845 -0.2348181,-0.0824 -0.4710995,-0.10709 -0.5286357,-0.0556 -0.798035,0.21727 -0.26955915,0.26976 -0.2281263,0.81448 0.0414319,0.54473 0.35687,0.87815 0.3152359,0.33076 0.8439147,0.38591 0.2362638,0.0248 0.4624051,-0.007 0.2288802,-0.034 0.450566,-0.12435 l 0.034358,0.45172 q -0.2201398,0.0718 -0.4616486,0.0942 -0.2385579,0.0225 -0.5132366,-0.006 -0.7472412,-0.0779 -1.21944741,-0.54634 -0.4722083,-0.46841 -0.52677688,-1.18585 -0.0553776,-0.72809 0.35591746,-1.09904 0.41424933,-0.37066 1.18807023,-0.28994 0.2510522,0.0261 0.493921,0.0991 0.2426765,0.0701 0.47421,0.18657 z" + style="stroke-width:0.02248672" + id="path1590" + inkscape:connector-curvature="0" /> + <path + d="m 3.6089628,293.07208 0.7058223,-0.18901 0.7372309,3.31648 -0.7058213,0.189 z" + style="stroke-width:0.02371932" + id="path1592" + inkscape:connector-curvature="0" /> + <path + d="m 6.8029782,292.75972 0.5463818,0.0572 -0.7653993,2.23004 2.0237512,-1.0029 0.6940731,0.0724 -2.170958,1.18675 1.5893239,1.30322 -0.986179,0.16156 -1.2249727,-1.50264 -0.4555763,1.32734 -0.5463819,-0.0572 z" + style="stroke-width:0.02195736" + id="path1594" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cccccccccccc" /> + </g> + </g> + </g> +</svg> diff --git a/src/Computerscare.hpp b/src/Computerscare.hpp @@ -39,6 +39,12 @@ struct ComputerscareResetButton : SVGSwitch,MomentarySwitch { //SVG::load(assetPlugin(plugin, "res/computerscare-pentagon-jack-1-outline-flipped.svg")); } }; +struct ComputerscareClockButton : SVGSwitch,MomentarySwitch { + ComputerscareClockButton() { + addFrame(SVG::load(assetPlugin(plugin,"res/computerscare-clk-text.svg"))); + addFrame(SVG::load(assetPlugin(plugin,"res/computerscare-clk-text-red.svg"))); + } +}; struct ComputerscareInvisibleButton : SVGSwitch,MomentarySwitch { ComputerscareInvisibleButton() { addFrame(SVG::load(assetPlugin(plugin,"res/computerscare-invisible-button.svg"))); diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp @@ -337,6 +337,7 @@ void ComputerscareILoveCookies::step() { bool atFirstStep = false; bool globalTriggerClocked = globalClockTrigger.process(inputs[GLOBAL_CLOCK_INPUT].value); bool globalManualResetClicked = globalManualResetTrigger.process(params[MANUAL_RESET_PARAM].value); + bool globalManualClockClicked = globalManualClockTrigger.process(params[MANUAL_CLOCK_PARAM].value); bool currentTriggerIsHigh; bool currentTriggerClocked; bool globalResetTriggered = globalResetTriggerInput.process(inputs[GLOBAL_RESET_INPUT].value / 2.f); @@ -361,7 +362,7 @@ void ComputerscareILoveCookies::step() { } } else { - if (inputs[GLOBAL_CLOCK_INPUT].active && globalTriggerClocked) { + if ((inputs[GLOBAL_CLOCK_INPUT].active && globalTriggerClocked) || globalManualClockClicked) { incrementInternalStep(i); activeKnobIndex[i] = newABS[i].peekWorkingStep(); } @@ -539,7 +540,8 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget { //global reset input addInput(Port::create<InPort>(mm2px(Vec(12+xStart , 0)), Port::INPUT, module, ComputerscareILoveCookies::GLOBAL_RESET_INPUT)); addParam(ParamWidget::create<ComputerscareResetButton>(mm2px(Vec(12+xStart , 9)), module, ComputerscareILoveCookies::MANUAL_RESET_PARAM, 0.0, 1.0, 0.0)); - + addParam(ParamWidget::create<ComputerscareClockButton>(mm2px(Vec(2+xStart , 9)), module, ComputerscareILoveCookies::MANUAL_CLOCK_PARAM, 0.0, 1.0, 0.0)); + for(int i = 0; i < numFields; i++) { //first-step output diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -433,7 +433,10 @@ void AbsoluteSequence::incrementAndCheck() { } std::string AbsoluteSequence::getWorkingStepDisplay() { int stepIndex = peekWorkingStep(); - if(stepIndex < 52) { + if(stepIndex < 0) { + return "error"; + } + else if(stepIndex < 52) { std::string str(1,knobandinputlookup[stepIndex]); return str; }