computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 44c7d4de780ada83d3c6b12134807acef06889f9
parent 19c8e642d64e3fa2f8b2b0394156222397abbccd
Author: Adam <1319733+freddyz@users.noreply.github.com>
Date:   Wed, 19 Dec 2018 00:25:49 -0600

Merge pull request #5 from freddyz/ilovecookies-mutate

Ilovecookies mutate
Diffstat:
M.gitignore | 3+++
MREADME.MD | 16+++++++++++++++-
Adoc/all-computerscare-modules.png | 0
Mres/ComputerscareILoveCookiesPanel.svg | 77+++++++++++++++++++++++++++--------------------------------------------------
Ares/computerscare-invisible-button-frame2.svg | 70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ares/computerscare-invisible-button.svg | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mres/computerscare-medium-knob-effed.svg | 18+++++++++---------
Ares/computerscare-rst-text-red.svg | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ares/computerscare-rst-text.svg | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/Computerscare.cpp | 1-
Msrc/Computerscare.hpp | 19++++++++++++++++++-
Msrc/ComputerscareILoveCookies.cpp | 432+++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
Msrc/ComputerscareLaundrySoup.cpp | 10+++-------
Msrc/dtpulse.cpp | 716+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Msrc/dtpulse.hpp | 98++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Asrc/test.cpp | 46++++++++++++++++++++++++++++++++++++++++++++++
16 files changed, 1505 insertions(+), 219 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -2,3 +2,6 @@ build dist .DS_Store plugin.* +a.out +*.swp +*.swo diff --git a/README.MD b/README.MD @@ -1,4 +1,7 @@ # computerscare modules for VCV Rack + +![ComputerscarePatchSequencer](./doc/all-computerscare-modules.png) + ~~~~ oo o Q 6 6 Q 6 o o Q 6 6 6 @@ -13,7 +16,18 @@ YLX LY5 2X5 Y2L 2LY X25 YLX YLL 5YX XLX 5YX 25X LY5 L2Y L5X 55L ~~~~ # I Love Cookies -Because, after all, don't we all love cookies? +Signal & CV Sequencer. Uses Text as input. Because after all, don't we all love cookies? + +Knobs are labeled with lowercase letters: a-z. Inputs are labeled with uppercase letters A-Z. Programming in the sequence: ~abcd~ will sequentially output the values of knobs a, b, c, and finally d. It will then loop back to step 0: knob a again. An exact voltage can be programmed by enclosing the value in square brackets. For example: ~<4.20>~. Surrounding + +All of the following are valid ILC programs: +~~~~ +<4.20> +{abc} +ab(cd) +def@10 +[abc,de]@6 +~~~~ ~~~~ diff --git a/doc/all-computerscare-modules.png b/doc/all-computerscare-modules.png Binary files differ. diff --git a/res/ComputerscareILoveCookiesPanel.svg b/res/ComputerscareILoveCookiesPanel.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="200" + width="320" height="380" - viewBox="0 0 52.916669 100.54167" + viewBox="0 0 84.666671 100.54167" version="1.1" id="svg8" inkscape:version="0.92.2 5c3e80d, 2017-08-06" @@ -34,11 +34,11 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="4.0000001" - inkscape:cx="86.288455" - inkscape:cy="164.40634" + inkscape:zoom="5.6568544" + inkscape:cx="165.90352" + inkscape:cy="357.21727" inkscape:document-units="mm" - inkscape:current-layer="g1669" + inkscape:current-layer="text1651" showgrid="false" units="px" inkscape:snap-bbox="true" @@ -74,11 +74,11 @@ <path inkscape:connector-curvature="0" id="path1647" - d="M 0,196.45832 H 52.916667 V 297 H 0 Z" - style="opacity:1;vector-effect:none;fill:#f9f9f9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.72459143;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> + d="M 0,196.45832 H 84.666667 V 297 H 0 Z" + style="opacity:1;vector-effect:none;fill:#f9f9f9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.91654366;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> <g aria-label="computerscare" - transform="matrix(0.98656289,0.0441007,-0.12576361,1.0079983,50.102321,-2.779225)" + transform="matrix(0.98656289,0.0441007,-0.12576361,1.0079983,81.852341,-2.779225)" 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 @@ -147,31 +147,8 @@ id="path1725" inkscape:connector-curvature="0" /> <g - aria-label="rst" - transform="matrix(1.9119826,-0.34464307,0.50786191,1.8921039,-36.824295,-191.79951)" - 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="text864"> - <path - d="m -41.222698,203.11196 c -0.0243,-0.0201 -0.05121,-0.0379 -0.08076,-0.0533 -0.0287,-0.0156 -0.06084,-0.0294 -0.09636,-0.0415 -0.125965,-0.0431 -0.225004,-0.043 -0.296963,-5.9e-4 -0.07117,0.0422 -0.110664,0.12465 -0.118454,0.24721 l -0.03634,0.5709 -0.224066,-0.0766 0.06898,-1.08373 0.224066,0.0766 0.01495,0.12355 c 0.05102,-0.0499 0.0894,-0.0329 0.166524,-0.0389 0.07716,-0.007 0.169424,0.008 0.276797,0.0452 0.01535,0.005 0.03225,0.0123 0.0507,0.0205 0.01854,0.007 0.03894,0.0169 0.0613,0.0284 z" - style="stroke-width:0.01482364" - id="path870" - inkscape:connector-curvature="0" - sodipodi:nodetypes="ccccccccccccccc" /> - <path - d="m -40.401321,202.83793 0.0011,0.14697 q -0.06978,-0.0343 -0.144779,-0.0517 -0.075,-0.0174 -0.155216,-0.018 -0.122114,-0.001 -0.183335,0.0341 -0.06033,0.035 -0.05979,0.10599 3.7e-4,0.054 0.04433,0.0857 0.04391,0.0307 0.17603,0.0595 l 0.05623,0.0122 q 0.174966,0.0367 0.248551,0.10231 0.07447,0.0647 0.07535,0.18045 9.74e-4,0.13177 -0.10892,0.20783 -0.10904,0.0761 -0.30156,0.0747 -0.0802,-4e-4 -0.167681,-0.0164 -0.08656,-0.0149 -0.183052,-0.0452 l -0.0012,-0.16049 q 0.09126,0.0455 0.179669,0.0689 0.08841,0.0226 0.174861,0.0232 0.115868,8.1e-4 0.177973,-0.0359 0.0621,-0.0375 0.06158,-0.10597 -4.76e-4,-0.0634 -0.0462,-0.0975 -0.04482,-0.0341 -0.197475,-0.0665 l -0.05714,-0.013 q -0.152644,-0.0315 -0.220863,-0.0945 -0.06822,-0.0639 -0.06906,-0.17366 -0.001,-0.13345 0.09824,-0.20537 0.09927,-0.0719 0.282876,-0.0706 0.09091,7.5e-4 0.171226,0.0139 0.08031,0.0132 0.148246,0.0391 z" - style="stroke-width:0.01175369" - id="path872" - inkscape:connector-curvature="0" /> - <path - d="m -39.839506,202.58274 -0.03466,0.33779 0.477995,0.0428 -0.03109,0.13976 -0.462511,-0.0314 -0.06636,0.64583 c -0.0099,0.097 -0.0044,0.1602 0.01679,0.18955 0.02181,0.0294 0.07002,0.0467 0.144625,0.0522 l 0.183936,0.0126 -0.01685,0.16358 -0.183936,-0.0127 c -0.138173,-0.01 -0.230656,-0.0447 -0.277449,-0.10469 -0.04673,-0.0604 -0.06245,-0.16502 -0.04717,-0.31376 l 0.06636,-0.64582 -0.13137,-0.009 0.01561,-0.15191 0.131371,0.009 0.03466,-0.33777 z" - style="stroke-width:0.0138234" - id="path874" - inkscape:connector-curvature="0" - sodipodi:nodetypes="ccccccccccccccccccc" /> - </g> - <g aria-label="clk" - transform="matrix(2.3525877,-0.10292753,0.2449229,1.9213172,39.209243,-190.33066)" + 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 @@ -206,7 +183,7 @@ style="stroke-width:0.07000434" /></text> <g aria-label="out" - transform="matrix(0.961494,-0.26224736,0.34559745,0.86694168,-28.446637,78.572455)" + transform="matrix(1.0743225,-0.26898724,0.37322674,0.87295797,-37.671603,34.123373)" 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" id="text888"> <path @@ -227,7 +204,7 @@ </g> <g aria-label="one" - transform="matrix(0.96137546,-0.34508222,-0.14753322,1.1131988,64.324907,27.967859)" + transform="matrix(0.96175882,-0.34207491,-0.14893339,1.102215,59.092309,-13.079623)" 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" id="text892"> <path @@ -275,41 +252,41 @@ inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccccscccsccccccc" /> <path - d="m -22.945679,200.82302 v 0.61693 q -0.325406,-0.27515 -0.695476,-0.41129 -0.366879,-0.13612 -0.781611,-0.13612 -0.816705,0 -1.250579,0.45473 -0.433875,0.45184 -0.433875,1.30918 0,0.85445 0.433875,1.30918 0.433874,0.45185 1.250579,0.45185 0.414732,0 0.781611,-0.13614 0.37007,-0.13612 0.695476,-0.4113 v 0.61115 q -0.338168,0.20855 -0.717807,0.31282 -0.37645,0.10427 -0.797563,0.10427 -1.081496,0 -1.703594,-0.59957 -0.6221,-0.60246 -0.6221,-1.64227 0,-1.04271 0.6221,-1.64228 0.622098,-0.60245 1.703594,-0.60245 0.427494,0 0.803944,0.10427 0.379639,0.10143 0.711426,0.30703 z" - style="stroke-width:0.04117904" + d="m -22.945679,200.64122 v 0.4474 q -0.325406,-0.20099 -0.695476,-0.30136 -0.366879,-0.10035 -0.781611,-0.1022 -0.816705,-0.004 -1.250579,0.32421 -0.433875,0.32575 -0.433875,0.9475 0,0.61966 0.433875,0.95137 0.433874,0.32962 1.250579,0.33325 0.414732,0.002 0.781611,-0.0952 0.37007,-0.0971 0.695476,-0.29519 v 0.44322 q -0.338168,0.14974 -0.717807,0.22366 -0.37645,0.0739 -0.797563,0.0721 -1.081496,-0.005 -1.703594,-0.44239 -0.6221,-0.43968 -0.6221,-1.19377 0,-0.75618 0.6221,-1.18823 0.622098,-0.43414 1.703594,-0.42932 0.427494,0.002 0.803944,0.0792 0.379639,0.0753 0.711426,0.22583 z" + style="stroke-width:0.03506782" id="path914" inkscape:connector-curvature="0" /> <path - d="m -21.466727,202.53026 q -0.357169,0 -0.48726,0.27994 -0.130756,0.27753 0.0035,0.7626 0.134213,0.48508 0.416798,0.76502 0.284331,0.27753 0.643914,0.27753 0.354756,0 0.484846,-0.27994 0.130087,-0.27995 -0.0035,-0.76261 -0.132874,-0.48024 -0.417875,-0.76019 -0.285665,-0.28235 -0.640421,-0.28235 z m -0.104166,-0.37648 q 0.579193,0 1.013982,0.37648 0.434785,0.37647 0.619075,1.04254 0.183622,0.66366 -0.04217,1.04255 -0.226457,0.37648 -0.80565,0.37648 -0.581607,0 -1.016396,-0.37648 -0.433041,-0.37889 -0.616663,-1.04255 -0.18429,-0.66607 0.03976,-1.04254 0.226457,-0.37648 0.808064,-0.37648 z" - style="stroke-width:0.03269225" + d="m -21.466727,201.88591 q -0.357169,-0.002 -0.48726,0.20085 -0.130756,0.20068 0.0035,0.55306 0.134213,0.35238 0.416798,0.55666 0.284331,0.20253 0.643914,0.20413 0.354756,0.002 0.484846,-0.20086 0.130087,-0.20244 -0.0035,-0.55307 -0.132874,-0.34886 -0.417875,-0.55316 -0.285665,-0.20603 -0.640421,-0.20761 z m -0.104166,-0.27349 q 0.579193,0.003 1.013982,0.27754 0.434785,0.27496 0.619075,0.75882 0.183622,0.48211 -0.04217,0.75588 -0.226457,0.27202 -0.80565,0.26944 -0.581607,-0.003 -1.016396,-0.27755 -0.433041,-0.2767 -0.616663,-0.75881 -0.18429,-0.48387 0.03976,-0.75589 0.226457,-0.27202 0.808064,-0.26943 z" + style="stroke-width:0.02784052" id="path916" inkscape:connector-curvature="0" /> <path - d="m -18.929377,200.90397 q -0.464482,0 -0.633659,0.34453 -0.170042,0.34157 0.0046,0.93855 0.174538,0.597 0.542027,0.94153 0.36976,0.34157 0.83738,0.34157 0.461344,0 0.630522,-0.34453 0.169172,-0.34454 -0.0046,-0.93857 -0.172796,-0.59104 -0.543427,-0.93558 -0.371496,-0.3475 -0.83284,-0.3475 z m -0.135463,-0.46334 q 0.753216,0 1.318639,0.46334 0.565417,0.46333 0.805078,1.28308 0.238792,0.81679 -0.05484,1.2831 -0.294497,0.46334 -1.047713,0.46334 -0.756353,0 -1.321776,-0.46334 -0.563152,-0.46631 -0.801944,-1.2831 -0.239661,-0.81975 0.05171,-1.28308 0.294497,-0.46334 1.05085,-0.46334 z" - style="stroke-width:0.04135929" + d="m -18.929377,200.7178 q -0.464482,-0.002 -0.633659,0.24704 -0.170042,0.24695 0.0046,0.68066 0.174538,0.43373 0.542027,0.68522 0.36976,0.24936 0.83738,0.25144 0.461344,0.002 0.630522,-0.24705 0.169172,-0.24911 -0.0046,-0.68068 -0.172796,-0.4294 -0.543427,-0.68091 -0.371496,-0.25367 -0.83284,-0.25572 z m -0.135463,-0.33662 q 0.753216,0.003 1.318639,0.34188 0.565417,0.33853 0.805078,0.93409 0.238792,0.59341 -0.05484,0.93028 -0.294497,0.33471 -1.047713,0.33135 -0.756353,-0.003 -1.321776,-0.3419 -0.563152,-0.34068 -0.801944,-0.93409 -0.239661,-0.59556 0.05171,-0.93027 0.294497,-0.33471 1.05085,-0.33134 z" + style="stroke-width:0.03522132" id="path918" inkscape:connector-curvature="0" /> <path - d="m -16.865342,201.16674 h 0.446462 l 0.613634,2.21783 1.002396,-1.16563 0.368688,0.19844 -0.885181,1.06613 1.891796,1.43833 h -0.579193 l -1.738414,-1.32008 0.365243,1.32008 h -0.446462 z" - style="stroke-width:0.03269225" + d="m -16.865342,200.91755 0.446462,0.002 0.613634,1.61113 1.002396,-0.84087 0.368688,0.14556 -0.885181,0.76923 1.891796,1.05151 -0.579193,-0.003 -1.738414,-0.96507 0.365243,0.95896 -0.446462,-0.002 z" + style="stroke-width:0.02784052" id="path920" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccccc" /> <path - d="m -13.4376,201.37704 h 0.582962 v 2.7029 H -13.4376 Z m 0,-1.0522 h 0.582962 l 0.132292,0.59537 -0.715254,-0.0331 z" - style="stroke-width:0.03745848" + d="m -13.4376,201.08531 0.582962,0.003 v 1.96017 l -0.582962,-0.003 z m 0,-0.76306 0.582962,0.003 0.132292,0.43236 -0.715254,-0.0272 z" + style="stroke-width:0.03189941" id="path922" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccc" /> <path - d="m -8.6028135,202.61748 v 0.2172 h -2.6803615 c 0.02535,0.30568 0.145741,0.53896 0.361184,0.69985 0.217554,0.15928 0.519596,0.23892 0.906126,0.23892 0.223892,0 0.440391,-0.0209 0.649497,-0.0627 0.2112179,-0.0418 0.4203237,-0.10455 0.6273175,-0.18824 v 0.41991 c -0.2091057,0.0676 -0.4234922,0.11906 -0.6431595,0.15445 -0.2196665,0.0354 -0.4425018,0.0531 -0.668506,0.0531 -0.566065,0 -1.014904,-0.12549 -1.346517,-0.37648 -0.329501,-0.25098 -0.494251,-0.59045 -0.494251,-1.01841 0,-0.44244 0.156302,-0.79318 0.468906,-1.05221 0.314715,-0.26063 0.738207,-0.39095 1.270477,-0.39095 0.4773537,0 0.8543785,0.11745 1.1310746,0.35234 0.2788086,0.23329 0.4182129,0.55104 0.4182129,0.95326 z m -0.8310103,-0.24608 c -0.0042,-0.24294 0.1540791,-0.32105 -0.021256,-0.46585 -0.1731991,-0.14479 -0.403427,-0.21719 -0.6906832,-0.21719 -0.325276,0 -0.586131,0.07 -0.782564,0.20995 -0.194321,0.13997 0.0079,0.2213 -0.02164,0.4755 z" - style="stroke-width:0.03745848" + d="m -8.6028135,202.00641 v 0.15752 l -2.6803615,-0.0119 c 0.02535,0.2218 0.145741,0.39151 0.361184,0.50915 0.217554,0.11648 0.519596,0.17558 0.906126,0.1773 0.223892,9.9e-4 0.440391,-0.0132 0.649497,-0.0426 0.2112179,-0.0294 0.4203237,-0.0739 0.6273175,-0.13373 v 0.30453 c -0.2091057,0.0481 -0.4234922,0.0845 -0.6431595,0.10915 -0.2196665,0.0247 -0.4425018,0.0365 -0.668506,0.0355 -0.566065,-0.003 -1.014904,-0.0955 -1.346517,-0.27902 -0.329501,-0.18348 -0.494251,-0.4304 -0.494251,-0.74076 0,-0.32087 0.156302,-0.57453 0.468906,-0.76099 0.314715,-0.18761 0.738207,-0.28024 1.270477,-0.27787 0.4773537,0.002 0.8543785,0.089 1.1310746,0.26055 0.2788086,0.17043 0.4182129,0.40149 0.4182129,0.69318 z m -0.8310103,-0.18216 c -0.0042,-0.1762 0.1540791,-0.23214 -0.021256,-0.33793 -0.1731991,-0.10578 -0.403427,-0.1593 -0.6906832,-0.16058 -0.325276,-0.001 -0.586131,0.0481 -0.782564,0.14877 -0.194321,0.10065 0.0079,0.16053 -0.02164,0.34474 z" + style="stroke-width:0.03189941" id="path924" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccsccccscscscccccsccc" /> <path - d="m -5.1228851,200.82694 v 0.53064 c -0.1817981,-0.0927 -0.3705884,-0.16546 -0.5663711,-0.21839 -0.1957826,-0.0529 -0.3985574,-0.0859 -0.6083245,-0.099 -0.3193121,-0.0199 -0.5593788,0.008 -0.7202002,0.0831 -0.1584907,0.0755 -0.1219808,0.19862 -0.1219808,0.36939 0,0.13013 -0.058652,0.23637 0.055554,0.31873 0.1142066,0.0804 0.343785,0.16484 0.6887353,0.25348 l 0.2202553,0.0565 c 0.4568261,0.11395 0.7807998,0.25518 0.9719209,0.42368 0.1934518,0.16661 0.2901777,0.38918 0.2901777,0.66771 0,0.31717 -0.1445062,0.55922 -0.4335186,0.72617 -0.2866815,0.16709 -0.6817428,0.28451 -1.1851839,0.25304 -0.2097671,-0.0131 -0.1146644,0.0546 -0.4919054,-0.0132 -0.4245198,-0.0652 -0.6138119,-6.7e-4 -0.8820689,-0.33567 l 0.3141927,-0.46368 c 0.2377361,0.12261 0.1577833,0.10281 0.388527,0.17214 0.2307438,0.0672 0.4591568,0.1079 0.6852391,0.12203 0.3029969,0.0189 0.5360714,-0.0112 0.6992236,-0.0905 0.1631521,-0.0813 0.2447282,-0.20428 0.2447282,-0.36895 0,-0.15249 -0.059434,-0.27311 -0.178302,-0.36186 -0.1165373,-0.0886 -0.3740847,-0.18296 -0.772642,-0.28313 l -0.2237516,-0.0597 c -0.3985574,-0.0981 -0.6864044,-0.22794 -0.863541,-0.38945 -0.1771366,-0.16355 -0.2657049,-0.37748 -0.2657049,-0.64179 0,-0.32123 0.1305217,-0.56111 0.3915651,-0.71964 0.2610434,-0.15852 0.6316318,-0.22277 1.1117653,-0.19275 0.2377361,0.0149 0.4614877,0.0441 0.6712548,0.0877 0.2097671,0.0436 0.4032189,0.10144 0.5803555,0.17352 z" - style="stroke-width:0.04423349" + d="m -5.1228851,200.72338 v 0.38482 c -0.1817981,-0.068 -0.3705884,-0.12164 -0.5663711,-0.1609 -0.1957826,-0.0392 -0.3985574,-0.0641 -0.6083245,-0.0745 -0.3193121,-0.0159 -0.5593788,0.003 -0.7202002,0.0571 -0.1584907,0.0541 -0.1219808,0.1435 -0.1219808,0.26734 0,0.0944 -0.058652,0.17116 0.055554,0.2314 0.1142066,0.0588 0.343785,0.12107 0.6887353,0.18689 l 0.2202553,0.042 c 0.4568261,0.0847 0.7807998,0.18853 0.9719209,0.31158 0.1934518,0.12169 0.2901777,0.28353 0.2901777,0.48552 0,0.23002 -0.1445062,0.40491 -0.4335186,0.5247 -0.2866815,0.1199 -0.6817428,0.2033 -1.1851839,0.17823 -0.2097671,-0.0104 -0.1146644,0.0391 -0.4919054,-0.0118 -0.4245198,-0.0492 -0.6138119,-0.003 -0.8820689,-0.24736 l 0.3141927,-0.33486 c 0.2377361,0.09 0.1577833,0.0753 0.388527,0.12656 0.2307438,0.0498 0.4591568,0.0803 0.6852391,0.0916 0.3029969,0.0151 0.5360714,-0.006 0.6992236,-0.0625 0.1631521,-0.0582 0.2447282,-0.14706 0.2447282,-0.26648 0,-0.11059 -0.059434,-0.19833 -0.178302,-0.26322 -0.1165373,-0.0648 -0.3740847,-0.13435 -0.772642,-0.20876 l -0.2237516,-0.0443 c -0.3985574,-0.0729 -0.6864044,-0.16836 -0.863541,-0.28627 -0.1771366,-0.1194 -0.2657049,-0.27494 -0.2657049,-0.46662 0,-0.23296 0.1305217,-0.40634 0.3915651,-0.52015 0.2610434,-0.1138 0.6316318,-0.15874 1.1117653,-0.13484 0.2377361,0.0119 0.4614877,0.034 0.6712548,0.0666 0.2097671,0.0326 0.4032189,0.0754 0.5803555,0.12842 z" + style="stroke-width:0.03766897" id="path926" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccsccccsccccccccsccccsccscc" /> @@ -356,7 +333,7 @@ id="text1057" /> <g id="g8072" - transform="matrix(0.26889251,-0.01002392,-0.03200614,0.19788514,10.15233,292.24297)"> + transform="matrix(0.26889251,-0.01002392,-0.03200614,0.19788514,41.90235,292.24297)"> <g style="display:inline" inkscape:label="Layer 1" diff --git a/res/computerscare-invisible-button-frame2.svg b/res/computerscare-invisible-button-frame2.svg @@ -0,0 +1,70 @@ +<?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="20mm" + height="10mm" + viewBox="0 0 20 10" + version="1.1" + id="svg890" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="computerscare-invisible-button-frame2.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="35.06195" + inkscape:cy="16.512059" + inkscape:document-units="mm" + inkscape:current-layer="text1460" + 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,-287)"> + <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"> + <rect + style="fill:#00628d;fill-opacity:1;stroke:none;stroke-width:0.08491325;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect1582" + width="19.84375" + height="9.8746281" + x="0.094494052" + y="287.07812" /> + </g> + </g> +</svg> diff --git a/res/computerscare-invisible-button.svg b/res/computerscare-invisible-button.svg @@ -0,0 +1,62 @@ +<?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="20mm" + height="10mm" + viewBox="0 0 20 10" + version="1.1" + id="svg890" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="computerscare-invisible-button.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="35.06195" + inkscape:cy="16.512059" + inkscape:document-units="mm" + inkscape:current-layer="text1460" + 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,-287)"> + <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> +</svg> diff --git a/res/computerscare-medium-knob-effed.svg b/res/computerscare-medium-knob-effed.svg @@ -9,12 +9,12 @@ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="Layer_1" data-name="Layer 1" - viewBox="0 0 28 28" + viewBox="0 0 25 25" version="1.1" sodipodi:docname="computerscare-medium-knob-effed.svg" inkscape:version="0.92.2 5c3e80d, 2017-08-06" - width="28" - height="28"> + width="25" + height="25"> <metadata id="metadata1289"> <rdf:RDF> @@ -41,7 +41,7 @@ id="namedview1287" showgrid="false" inkscape:zoom="15.733333" - inkscape:cx="10.260513" + inkscape:cx="11.595259" inkscape:cy="14.442801" inkscape:window-x="0" inkscape:window-y="0" @@ -57,16 +57,16 @@ <g id="Big_Knob" data-name="Big Knob" - transform="translate(0,-32)"> + transform="translate(0,-35)"> <path - style="fill:#245559;stroke:#000000;stroke-width:0.44949234;stroke-opacity:1" - d="M 27.281965,45.86697 C 28.119596,55.806861 21.656355,60.098038 14.240308,59.415042 7.4209214,58.786996 -1.0884456,53.018905 0.75553789,45.930272 3.2325316,36.408223 8.7500225,31.88879 14.240308,32.445502 c 4.113807,0.417138 6.056174,1.699822 10.081252,4.298793 2.501437,1.615165 2.727415,6.357859 2.960405,9.122675 z" + style="fill:#245559;stroke:#000000;stroke-width:0.40182629;stroke-opacity:1" + d="M 24.481712,47.462047 C 25.230517,56.347871 19.452665,60.183994 12.823046,59.573425 6.7268169,59.011979 -0.88018101,53.855561 0.76825872,47.518636 2.9825816,39.006345 7.9149746,34.966172 12.823046,35.463848 c 3.677562,0.372903 5.413953,1.519566 9.012194,3.842931 2.236175,1.443886 2.438189,5.683646 2.646472,8.155268 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.27979493;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 14.045118,33.007491 c -0.901212,0.624222 -0.773465,3.36645 -0.773465,3.36645 l -0.45534,0.901175 -0.521089,0.915953 -0.04079,1.126303 0.828056,0.854017 -0.422931,0.983799 -0.574795,3.113605 c 1.538999,-0.310021 1.553591,-0.964526 4.197441,-0.729889 l -0.92262,-1.792916 -0.477568,-1.469672 -0.03868,-1.440186 0.304744,-0.623519 0.04412,-0.777177 -0.257525,-4.62905 c -0.733272,-0.06419 -0.832689,-0.08062 -0.838748,0.02061 -0.0042,0.06712 0,0 -0.05072,0.180496 0,0 -0.07689,0.06066 -0.09712,0.03956 -0.02032,-0.02109 0.09704,-0.03956 0.09704,-0.03956 z" + 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.25012431;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.648556,35.966241 c -0.805644,0.558027 -0.691444,3.009458 -0.691444,3.009458 l -0.407053,0.80561 -0.465831,0.818822 -0.03646,1.006865 0.740245,0.763454 -0.378082,0.879472 -0.51384,2.783426 c 1.375796,-0.277146 1.388841,-0.862244 3.752326,-0.652488 l -0.824782,-1.602788 -0.426925,-1.313821 -0.03457,-1.287464 0.272428,-0.557398 0.03944,-0.694762 -0.230216,-4.138167 c -0.655513,-0.05738 -0.744387,-0.07207 -0.749803,0.01842 -0.0038,0.06 0,0 -0.04534,0.161355 0,0 -0.06874,0.05423 -0.08683,0.03536 -0.01817,-0.01885 0.08676,-0.03536 0.08676,-0.03536 z" id="Button_Pointer" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccccccccscacc" /> diff --git a/res/computerscare-rst-text-red.svg b/res/computerscare-rst-text-red.svg @@ -0,0 +1,78 @@ +<?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-rst-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="31.428572" + inkscape:cy="16.512059" + inkscape:document-units="mm" + inkscape:current-layer="text1460" + 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"> + <path + d="m 3.1741321,293.87751 q -0.09872,-0.0559 -0.2142721,-0.084 -0.1126317,-0.0309 -0.2484227,-0.037 -0.4814513,-0.0219 -0.7234135,0.25827 -0.2390457,0.27745 -0.2068562,0.82132 l 0.099956,1.68886 -0.5709549,-0.026 -0.1897489,-3.20597 0.5709551,0.026 0.029479,0.49807 q 0.1617211,-0.28382 0.4404383,-0.41103 0.2785477,-0.13006 0.6890162,-0.11138 0.058653,0.003 0.1301158,0.0143 0.071266,0.008 0.158587,0.0272 z" + style="fill:#b63900;fill-opacity:1;stroke-width:0.15197389" + id="path1462" + inkscape:connector-curvature="0" /> + <path + d="m 5.9131608,293.30639 0.036975,0.51822 q -0.2482889,-0.11913 -0.5107727,-0.17869 -0.2624845,-0.0596 -0.539164,-0.0596 -0.4211677,0 -0.6243636,0.12509 -0.2001212,0.12509 -0.1822718,0.37526 0.013603,0.19061 0.172099,0.30081 0.1582865,0.10721 0.6202832,0.2055 l 0.1966489,0.0417 q 0.6114707,0.12508 0.8799193,0.35441 0.2713097,0.22635 0.300422,0.63438 0.033149,0.4646 -0.3287158,0.73563 -0.3587914,0.27102 -1.0228222,0.27102 -0.2766795,0 -0.5817774,-0.0536 -0.3018108,-0.0506 -0.6412646,-0.15488 l -0.040375,-0.56587 q 0.3248324,0.15785 0.6349175,0.23826 0.3098682,0.0774 0.6080672,0.0774 0.3996482,0 0.6054941,-0.13104 0.2056321,-0.13402 0.1884201,-0.37526 -0.015937,-0.22338 -0.1812227,-0.34251 -0.1622107,-0.11913 -0.6957639,-0.22932 l -0.199936,-0.0446 q -0.5333408,-0.10722 -0.7827061,-0.32761 -0.2495781,-0.22338 -0.2772031,-0.61056 -0.033574,-0.47056 0.2924631,-0.72669 0.3260373,-0.25613 0.9593259,-0.25613 0.3135701,0 0.5934356,0.0446 0.2798656,0.0447 0.5198822,0.13402 z" + style="fill:#b63900;fill-opacity:1;stroke-width:0.15492441" + id="path1464" + inkscape:connector-curvature="0" /> + <path + d="m 7.1675079,292.41989 0.1355192,0.91257 1.3146089,0.031 0.060941,0.41037 -1.3146088,-0.031 0.2591037,1.74479 q 0.058385,0.39316 0.2033443,0.5081 0.1484277,0.11502 0.5473191,0.12441 l 0.6555643,0.0154 0.065629,0.44194 -0.6555642,-0.0154 q -0.7388215,-0.0174 -1.0534413,-0.25071 -0.3150515,-0.23619 -0.4045461,-0.83884 l -0.2591058,-1.7448 -0.4682615,-0.011 -0.060941,-0.41037 0.4682617,0.011 -0.1355192,-0.91257 z" + style="fill:#b63900;fill-opacity:1;stroke-width:0.16125326" + id="path1466" + inkscape:connector-curvature="0" /> + </g> + </g> +</svg> diff --git a/res/computerscare-rst-text.svg b/res/computerscare-rst-text.svg @@ -0,0 +1,78 @@ +<?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-rst-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="31.428572" + inkscape:cy="16.512059" + inkscape:document-units="mm" + inkscape:current-layer="text1460" + 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"> + <path + d="m 3.1741321,293.87751 q -0.09872,-0.0559 -0.2142721,-0.084 -0.1126317,-0.0309 -0.2484227,-0.037 -0.4814513,-0.0219 -0.7234135,0.25827 -0.2390457,0.27745 -0.2068562,0.82132 l 0.099956,1.68886 -0.5709549,-0.026 -0.1897489,-3.20597 0.5709551,0.026 0.029479,0.49807 q 0.1617211,-0.28382 0.4404383,-0.41103 0.2785477,-0.13006 0.6890162,-0.11138 0.058653,0.003 0.1301158,0.0143 0.071266,0.008 0.158587,0.0272 z" + style="fill:#000000;fill-opacity:1;stroke-width:0.15197389" + id="path1462" + inkscape:connector-curvature="0" /> + <path + d="m 5.9131608,293.30639 0.036975,0.51822 q -0.2482889,-0.11913 -0.5107727,-0.17869 -0.2624845,-0.0596 -0.539164,-0.0596 -0.4211677,0 -0.6243636,0.12509 -0.2001212,0.12509 -0.1822718,0.37526 0.013603,0.19061 0.172099,0.30081 0.1582865,0.10721 0.6202832,0.2055 l 0.1966489,0.0417 q 0.6114707,0.12508 0.8799193,0.35441 0.2713097,0.22635 0.300422,0.63438 0.033149,0.4646 -0.3287158,0.73563 -0.3587914,0.27102 -1.0228222,0.27102 -0.2766795,0 -0.5817774,-0.0536 -0.3018108,-0.0506 -0.6412646,-0.15488 l -0.040375,-0.56587 q 0.3248324,0.15785 0.6349175,0.23826 0.3098682,0.0774 0.6080672,0.0774 0.3996482,0 0.6054941,-0.13104 0.2056321,-0.13402 0.1884201,-0.37526 -0.015937,-0.22338 -0.1812227,-0.34251 -0.1622107,-0.11913 -0.6957639,-0.22932 l -0.199936,-0.0446 q -0.5333408,-0.10722 -0.7827061,-0.32761 -0.2495781,-0.22338 -0.2772031,-0.61056 -0.033574,-0.47056 0.2924631,-0.72669 0.3260373,-0.25613 0.9593259,-0.25613 0.3135701,0 0.5934356,0.0446 0.2798656,0.0447 0.5198822,0.13402 z" + style="fill:#000000;fill-opacity:1;stroke-width:0.15492441" + id="path1464" + inkscape:connector-curvature="0" /> + <path + d="m 7.1675079,292.41989 0.1355192,0.91257 1.3146089,0.031 0.060941,0.41037 -1.3146088,-0.031 0.2591037,1.74479 q 0.058385,0.39316 0.2033443,0.5081 0.1484277,0.11502 0.5473191,0.12441 l 0.6555643,0.0154 0.065629,0.44194 -0.6555642,-0.0154 q -0.7388215,-0.0174 -1.0534413,-0.25071 -0.3150515,-0.23619 -0.4045461,-0.83884 l -0.2591058,-1.7448 -0.4682615,-0.011 -0.060941,-0.41037 0.4682617,0.011 -0.1355192,-0.91257 z" + style="fill:#000000;fill-opacity:1;stroke-width:0.16125326" + id="path1466" + inkscape:connector-curvature="0" /> + </g> + </g> +</svg> diff --git a/src/Computerscare.cpp b/src/Computerscare.cpp @@ -1,6 +1,5 @@ #include "Computerscare.hpp" - Plugin *plugin; diff --git a/src/Computerscare.hpp b/src/Computerscare.hpp @@ -1,3 +1,4 @@ +#pragma once #include "rack.hpp" @@ -30,6 +31,22 @@ extern Model *modelComputerscarePatchSequencer; extern Model *modelComputerscareLaundrySoup; extern Model *modelComputerscareILoveCookies; + +struct ComputerscareResetButton : SVGSwitch,MomentarySwitch { + ComputerscareResetButton() { + addFrame(SVG::load(assetPlugin(plugin,"res/computerscare-rst-text.svg"))); + addFrame(SVG::load(assetPlugin(plugin,"res/computerscare-rst-text-red.svg"))); + //SVG::load(assetPlugin(plugin, "res/computerscare-pentagon-jack-1-outline-flipped.svg")); + } +}; +struct ComputerscareInvisibleButton : SVGSwitch,MomentarySwitch { + ComputerscareInvisibleButton() { + addFrame(SVG::load(assetPlugin(plugin,"res/computerscare-invisible-button.svg"))); + addFrame(SVG::load(assetPlugin(plugin,"res/computerscare-invisible-button-frame2.svg"))); + //SVG::load(assetPlugin(plugin, "res/computerscare-pentagon-jack-1-outline-flipped.svg")); + } +}; + struct ComputerscareGreenLight : GrayModuleLightWidget { ComputerscareGreenLight() { addBaseColor(COLOR_COMPUTERSCARE_GREEN); @@ -114,7 +131,7 @@ struct LrgKnob : RoundBlackSnapKnob { } void randomize() override { return; } }; -struct SmoothKnob : RoundBlackKnob { +struct SmoothKnob : RoundKnob { SmoothKnob() { setSVG(SVG::load(assetPlugin(plugin, "res/computerscare-medium-knob-effed.svg"))); } diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp @@ -10,16 +10,74 @@ struct ComputerscareILoveCookies; -const int numFields = 3; -const int numKnobRows = 5; -const int numKnobColumns = 5; -const std::string knoblookup = "abcdefghijklmnopqrstuvwxy"; +const int numFields = 6; +const int numKnobRows = 13; +const int numKnobColumns = 2; +const int numInputRows = 13; +const int numInputColumns = 2; + +const int LG_FONT_SIZE = 18; +const int MED_FONT_SIZE = 12; +const int SM_FONT_SIZE = 8; + +const int numKnobs = numKnobRows * numKnobColumns; +const int numInputs = numInputRows * numInputColumns; const std::vector<NVGcolor> outlineColorMap = {COLOR_COMPUTERSCARE_RED,COLOR_COMPUTERSCARE_YELLOW,COLOR_COMPUTERSCARE_BLUE}; +//////////////////////////////////// +struct SmallLetterDisplay : TransparentWidget { + + std::string value; + std::shared_ptr<Font> font; + bool active = false; + bool blink = false; + bool doubleblink = false; + + SmallLetterDisplay() { + font = Font::load(assetPlugin(plugin, "res/Oswald-Regular.ttf")); + }; + + void draw(NVGcontext *vg) override + { + // Background + NVGcolor backgroundColor = COLOR_COMPUTERSCARE_RED; + NVGcolor doubleblinkColor = COLOR_COMPUTERSCARE_YELLOW; + + + if(doubleblink) { + nvgBeginPath(vg); + nvgRoundedRect(vg, -1.0, -1.0, box.size.x-3, box.size.y-3, 8.0); + nvgFillColor(vg, doubleblinkColor); + nvgFill(vg); + } + else { + if(blink) { + nvgBeginPath(vg); + nvgRoundedRect(vg, -1.0, -1.0, box.size.x-3, box.size.y-3, 8.0); + nvgFillColor(vg, backgroundColor); + nvgFill(vg); + } + } + + // text + nvgFontSize(vg, 19); + nvgFontFaceId(vg, font->handle); + nvgTextLetterSpacing(vg, 2.5); + nvgTextLineHeight(vg, 0.7); + + Vec textPos = Vec(6.0f, 12.0f); + NVGcolor textColor = (!blink || doubleblink) ? nvgRGB(0x10, 0x10, 0x00) : COLOR_COMPUTERSCARE_YELLOW; + nvgFillColor(vg, textColor); + nvgTextBox(vg, textPos.x, textPos.y,80,value.c_str(), NULL); + + } +}; + class MyTextFieldCookie : public LedDisplayTextField { public: - int fontSize = 18; + int fontSize = LG_FONT_SIZE; + int rowIndex=0; MyTextFieldCookie() : LedDisplayTextField() {} void setModule(ComputerscareILoveCookies* _module) { module = _module; @@ -69,14 +127,18 @@ private: struct ComputerscareILoveCookies : Module { enum ParamIds { KNOB_PARAM, - NUM_PARAMS = KNOB_PARAM + numKnobRows * numKnobColumns + MANUAL_CLOCK_PARAM = KNOB_PARAM + numKnobs, + MANUAL_RESET_PARAM, + INDIVIDUAL_RESET_PARAM, + NUM_PARAMS = INDIVIDUAL_RESET_PARAM + numFields }; enum InputIds { GLOBAL_CLOCK_INPUT, GLOBAL_RESET_INPUT, CLOCK_INPUT, RESET_INPUT = CLOCK_INPUT + numFields, - NUM_INPUTS = RESET_INPUT + numFields + SIGNAL_INPUT = RESET_INPUT + numFields , + NUM_INPUTS = SIGNAL_INPUT + numInputs }; enum OutputIds { TRG_OUTPUT, @@ -85,22 +147,32 @@ struct ComputerscareILoveCookies : Module { }; enum LightIds { SWITCH_LIGHTS, - NUM_LIGHTS = SWITCH_LIGHTS + numKnobRows * numKnobColumns * numFields + NUM_LIGHTS = SWITCH_LIGHTS + (numKnobs + numInputs)*numFields }; SchmittTrigger globalClockTrigger; SchmittTrigger globalResetTriggerInput; + SchmittTrigger globalManualClockTrigger; + SchmittTrigger globalManualResetTrigger; + + SchmittTrigger clockTriggers[numFields]; SchmittTrigger resetTriggers[numFields]; - MyTextFieldCookie* textFields[numFields]; + SchmittTrigger manualResetTriggers[numFields]; - std::vector<int> absoluteSequences[numFields]; + MyTextFieldCookie* textFields[numFields]; + SmallLetterDisplay* smallLetterDisplays[numFields]; - int absoluteStep[numFields] = {0}; - int numSteps[numFields] = {0}; + AbsoluteSequence newABS[numFields]; + bool shouldChange[numFields] = {false}; + bool changeImminent[numFields] = {false}; + + std::string displayString[numFields]; + int activeKnobIndex[numFields] = {0}; + ComputerscareILoveCookies() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {} void step() override; @@ -132,13 +204,16 @@ ComputerscareILoveCookies() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LI } void onRandomize() override { - randomizeAllFields(); } + void randomizeShuffle() { - void randomizeAllFields() { - std::string mainlookup =knoblookup; + } + void randomizeTextFields() { + std::string mainlookup = knobandinputlookup; std::string string = ""; std::string randchar = ""; + srand (time(NULL)); + float ru; int length = 0; for (int i = 0; i < numFields; i++) { @@ -147,38 +222,42 @@ ComputerscareILoveCookies() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LI for(int j = 0; j < length; j++) { randchar = mainlookup[rand() % mainlookup.size()]; string = string + randchar; + ru = randomUniform(); + if(ru < 0.1) { + string = "(" + string + ")"; + } } textFields[i]->text = string; + setNextAbsoluteSequence(i); } - onCreate(); - } - - void parseFormula(std::string input, int index) { - std::vector<int> absoluteSequence; - int currentVal; - absoluteSequence.resize(0); - - for(unsigned int i = 0; i < input.length(); i++) { - currentVal = knoblookup.find(input[i]); - absoluteSequence.push_back(currentVal); - } - - numSteps[index] = absoluteSequence.size(); - absoluteSequences[index] = absoluteSequence; + void checkLength(int index) { + std::string value=textFields[index]->text; + int length = value.length(); + textFields[index]->fontSize = length > 17 ? (length > 30 ? SM_FONT_SIZE : MED_FONT_SIZE) : LG_FONT_SIZE; + } + void setNextAbsoluteSequence(int index) { + shouldChange[index] = true; + } + void setAbsoluteSequenceFromQueue(int index) { + newABS[index] = AbsoluteSequence(textFields[index]->text,knobandinputlookup); + newABS[index].print(); } - int getAbsoluteStep(int index) { - return this->absoluteStep[index]; + void checkIfShouldChange(int index) { + if(shouldChange[index]) { + setAbsoluteSequenceFromQueue(index); + shouldChange[index] = false; + updateDisplayBlink(index); + } } - int getCurrentStep(int index) { - return absoluteSequences[index][getAbsoluteStep(index)]; + void updateDisplayBlink(int index) { + smallLetterDisplays[index]->blink = shouldChange[index]; } void onCreate () override { for(int i = 0; i < numFields; i++) { - if(textFields[i]->text.size() > 0) { - parseFormula(textFields[i]->text,i); - } + setNextAbsoluteSequence(i); + checkIfShouldChange(i); resetOneOfThem(i); } } @@ -188,76 +267,149 @@ void onCreate () override onCreate(); } - /* - lets say the sequence "332" is entered in the 0th (first) - numSteps[0] would then be 8 (3 + 3 + 2) - absoluteSequences[0] would be the vector (1,0,0,1,0,0,1,0) - absoluteStep[0] would run from 0 to 7 - - 332-4 (332 offset by 4) - - */ void incrementInternalStep(int i) { - this->absoluteStep[i] +=1; - this->absoluteStep[i] %= this->numSteps[i]; + newABS[i].incrementAndCheck(); + + this->displayString[i] = this->getDisplayString(i); + if(newABS[i].readHead == 0) { + this->setChangeImminent(i,false); + } + this->smallLetterDisplays[i]->value = this->displayString[i]; } void resetOneOfThem(int i) { - this->absoluteStep[i] = 0; + newABS[i].readHead = -1; + } + void setChangeImminent(int i,bool value) { + this->smallLetterDisplays[i]->doubleblink = value; + } + std::string getDisplayString(int index) { + std::string lhs = std::to_string(this->newABS[index].readHead); + std::string rhs = std::to_string(this->newABS[index].numTokens); + std::string thisVal = this->newABS[index].getWorkingStepDisplay(); + + padTo(lhs, 3,' '); + padTo(rhs, 3,' '); + + std::string val = lhs + "/" + rhs + "\n" + thisVal.substr(0,4); + return val; + } + float mapKnobValue(float rawValue, int rowIndex) { + // raw value is between 0 and +10 + /* + 0: -10,10 + 1: -5,5 + 2: 0,10 + 3: 0,5 + 4: 0,1 + 5: -1,1 + 6: 0,2 + 7: 0,3 + 8: -2,2 + */ + float mappedValue = 0.f; + int mapEnum = 2; + switch(mapEnum) { + case 0: mappedValue = mapValue(rawValue,-5.f,2.f); break; + case 1: mappedValue = mapValue(rawValue,-5.f,1.f); break; + case 2: mappedValue = rawValue; break; + case 3: mappedValue = mapValue(rawValue,0.f,0.5); break; + case 4: mappedValue = mapValue(rawValue,0.f,0.1); break; + case 5: mappedValue = mapValue(rawValue,-5,0.2); break; + case 6: mappedValue = mapValue(rawValue,0.f,0.2); break; + case 7: mappedValue = mapValue(rawValue,0.f,1/3); break; + case 8: mappedValue = mapValue(rawValue,-5.f,0.4); break; + } + return mappedValue; + } + float mapValue(float input, float offset, float multiplier) { + return (input + offset) * multiplier; } + }; void ComputerscareILoveCookies::step() { + bool globalGateIn = globalClockTrigger.isHigh(); bool activeStep = 0; - int activeKnob; bool atFirstStep = false; - bool clocked = globalClockTrigger.process(inputs[GLOBAL_CLOCK_INPUT].value); + bool globalTriggerClocked = globalClockTrigger.process(inputs[GLOBAL_CLOCK_INPUT].value); + bool globalManualResetClicked = globalManualResetTrigger.process(params[MANUAL_RESET_PARAM].value); bool currentTriggerIsHigh; bool currentTriggerClocked; bool globalResetTriggered = globalResetTriggerInput.process(inputs[GLOBAL_RESET_INPUT].value / 2.f); bool currentResetActive; bool currentResetTriggered; - + bool currentManualResetClicked; + float knobRawValue = 0.f; for(int i = 0; i < numFields; i++) { activeStep = false; currentResetActive = inputs[RESET_INPUT + i].active; currentResetTriggered = resetTriggers[i].process(inputs[RESET_INPUT+i].value / 2.f); + currentManualResetClicked = manualResetTriggers[i].process(params[INDIVIDUAL_RESET_PARAM + i].value); + currentTriggerIsHigh = clockTriggers[i].isHigh(); currentTriggerClocked = clockTriggers[i].process(inputs[CLOCK_INPUT + i].value); - if(this->numSteps[i] > 0) { + if(true) { if (inputs[CLOCK_INPUT + i].active) { if(currentTriggerClocked) { incrementInternalStep(i); + activeKnobIndex[i] = newABS[i].peekWorkingStep(); } } else { - if (inputs[GLOBAL_CLOCK_INPUT].active && clocked) { - incrementInternalStep(i); + if (inputs[GLOBAL_CLOCK_INPUT].active && globalTriggerClocked) { + incrementInternalStep(i); + activeKnobIndex[i] = newABS[i].peekWorkingStep(); } } if((currentResetActive && currentResetTriggered) || (!currentResetActive && globalResetTriggered)) { resetOneOfThem(i); } - activeKnob = absoluteSequences[i][this->absoluteStep[i]]; - //printf("%i, %f",i,activeKnob); + atFirstStep = (newABS[i].readHead == 0); - atFirstStep = (this->absoluteStep[i] == 0); - for(int k = 0; k < numKnobRows * numKnobColumns; k++) { - lights[SWITCH_LIGHTS + i*numKnobRows*numKnobColumns + k].value = (k==activeKnob) ? 1.0 : 0.0; + if(globalManualResetClicked || currentManualResetClicked) { + setChangeImminent(i,true); + resetOneOfThem(i); + } + if( (currentResetActive && currentResetTriggered) || (!currentResetActive && globalResetTriggered)) { + resetOneOfThem(i); + setChangeImminent(i,false); } + else { + if(atFirstStep && !currentResetActive && !inputs[GLOBAL_RESET_INPUT].active) { + checkIfShouldChange(i); + } + } + } + if(activeKnobIndex[i] < 0) { + outputs[TRG_OUTPUT + i].value = 0.f; + } + else if(activeKnobIndex[i] < 26) { + knobRawValue = params[activeKnobIndex[i]].value; + outputs[TRG_OUTPUT + i].value = mapKnobValue(knobRawValue,i); + } + else if(activeKnobIndex[i] < 52) { + knobRawValue = inputs[SIGNAL_INPUT + activeKnobIndex[i] - 26].value; + outputs[TRG_OUTPUT + i].value = knobRawValue; + } + else if(activeKnobIndex[i] < 78) { + outputs[TRG_OUTPUT + i].value = newABS[i].exactFloats[activeKnobIndex[i] - 52]; + } + else if(activeKnobIndex[i] < 104) { + outputs[TRG_OUTPUT + i].value = 2.22; + } + else { + outputs[TRG_OUTPUT+i].value = 0.f; } if(inputs[CLOCK_INPUT + i].active) { - outputs[TRG_OUTPUT + i].value = params[KNOB_PARAM + activeKnob].value; - outputs[FIRST_STEP_OUTPUT + i].value = (currentTriggerIsHigh && atFirstStep) ? 10.f : 0.0f; } else { - outputs[TRG_OUTPUT + i].value = params[KNOB_PARAM + activeKnob].value; outputs[FIRST_STEP_OUTPUT + i].value = (globalGateIn && atFirstStep) ? 10.f : 0.0f; } } @@ -269,6 +421,7 @@ struct NumberDisplayWidget3cookie : TransparentWidget { int *value; std::shared_ptr<Font> font; NVGcolor outlineColor; + //NVGcolor circleColor; NumberDisplayWidget3cookie() { font = Font::load(assetPlugin(plugin, "res/digital-7.ttf")); @@ -285,7 +438,7 @@ struct NumberDisplayWidget3cookie : TransparentWidget { nvgFill(vg); nvgBeginPath(vg); - nvgRoundedRect(vg, 0.0, 0.0, box.size.x, box.size.y, 4.0); + nvgRoundedRect(vg, 0.0, 0.0, box.size.x, box.size.y, 8.0); nvgFillColor(vg, backgroundColor); nvgFill(vg); @@ -303,56 +456,38 @@ struct NumberDisplayWidget3cookie : TransparentWidget { nvgText(vg, textPos.x, textPos.y, to_display.str().c_str(), NULL); } }; -//////////////////////////////////// -struct SmallLetterDisplay : TransparentWidget { - - std::string value; - std::shared_ptr<Font> font; - bool active = false; - - SmallLetterDisplay() { - font = Font::load(assetPlugin(plugin, "res/Oswald-Regular.ttf")); - }; - - void draw(NVGcontext *vg) override - { - // Background - NVGcolor backgroundColor = nvgRGB(0xC0, 0xE7, 0xDE); - if(active) { - nvgBeginPath(vg); - nvgRoundedRect(vg, -1.0, -1.0, box.size.x-3, box.size.y-3, 8.0); - nvgFillColor(vg, backgroundColor); - nvgFill(vg); - } - - // text - nvgFontSize(vg, 19); - nvgFontFaceId(vg, font->handle); - nvgTextLetterSpacing(vg, 2.5); - - Vec textPos = Vec(6.0f, 12.0f); - NVGcolor textColor = nvgRGB(0x10, 0x10, 0x00); - nvgFillColor(vg, textColor); - nvgTextBox(vg, textPos.x, textPos.y,80,value.c_str(), NULL); - - } -}; void MyTextFieldCookie::onTextChange() { - module->onCreate(); + module->checkLength(this->rowIndex); + std::string value = module->textFields[this->rowIndex]->text; + if(matchParens(value)) { + whoKnows(value); + module->setNextAbsoluteSequence(this->rowIndex); + module->updateDisplayBlink(this->rowIndex); + } } struct ComputerscareILoveCookiesWidget : ModuleWidget { double verticalSpacing = 18.4; - int verticalStart = 80; - int index; - double knobPosX; - double knobPosY; - double knobXStart = 2; - double knobYStart = 16; - double knobRowWidth = 13; - double knobColumnHeight = 10; + int verticalStart = 24; + double xStart = 41; + int index=0; + int inputindex=0; + double knobPosX=0.0; + double knobPosY=0.0; + double knobXStart = 20; + double knobYStart = 2; + double knobRowWidth = 11; + double knobColumnHeight = 9.2; + + double inputPosX = 0.0; + double inputPosY = 0.0; + double inputXStart = 0; + double inputYStart = 0; + double inputRowWidth = 8; + double inputColumnHeight = 9.7; + ComputerscareILoveCookiesWidget(ComputerscareILoveCookies *module) : ModuleWidget(module) { setPanel(SVG::load(assetPlugin(plugin, "res/ComputerscareILoveCookiesPanel.svg"))); @@ -360,71 +495,90 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget { for(int i = 0; i < numKnobRows; i++) { for(int j = 0; j < numKnobColumns; j++) { knobPosX = knobXStart + j*knobRowWidth; - knobPosY = knobYStart + i*knobColumnHeight; + knobPosY = knobYStart + i*knobColumnHeight + j*2.0; index = numKnobColumns*i + j; - addChild(ModuleLightWidget::create<ComputerscareMediumLight<ComputerscareRedLight>>(mm2px(Vec(knobPosX-3, knobPosY - 2)), module, ComputerscareILoveCookies::SWITCH_LIGHTS + index)); - addChild(ModuleLightWidget::create<ComputerscareMediumLight<ComputerscareYellowLight>>(mm2px(Vec(knobPosX-3, knobPosY )), module, ComputerscareILoveCookies::SWITCH_LIGHTS + index + numKnobColumns*numKnobRows)); - addChild(ModuleLightWidget::create<ComputerscareMediumLight<ComputerscareBlueLight>>(mm2px(Vec(knobPosX-3, knobPosY +2)), module, ComputerscareILoveCookies::SWITCH_LIGHTS + index + numKnobColumns*numKnobRows*2)); - - SmallLetterDisplay *letterDisplay = new SmallLetterDisplay(); - letterDisplay->box.pos = mm2px(Vec(knobPosX-3,knobPosY-2)); - letterDisplay->box.size = Vec(20, 20); - letterDisplay->value = knoblookup[index]; - //letterDisplay->active = (module->absoluteSequences[i][module->absoluteStep[i]]==index); - addChild(letterDisplay); + smallLetterDisplay = new SmallLetterDisplay(); + smallLetterDisplay->box.pos = mm2px(Vec(knobPosX+6,knobPosY-2)); + smallLetterDisplay->box.size = Vec(20, 20); + smallLetterDisplay->value = knoblookup[index]; + addChild(smallLetterDisplay); + ParamWidget* knob = ParamWidget::create<SmoothKnob>(mm2px(Vec(knobPosX,knobPosY)), module, ComputerscareILoveCookies::KNOB_PARAM +index, 0.f, 10.0f, 0.0f); - ParamWidget* knob = ParamWidget::create<SmoothKnob>(mm2px(Vec(knobPosX,knobPosY)), module, ComputerscareILoveCookies::KNOB_PARAM +index, -10.0f, 10.0f, 0.0f); addParam(knob); } } + for(int k = 0; k < numInputRows; k++) { + for(int m=0; m<numInputColumns; m++) { + inputPosX = inputXStart + m*inputRowWidth; + inputPosY = inputYStart + k*inputColumnHeight + m * 2.0; + inputindex = numInputColumns*k + m; + + if(m%2) { + addInput(Port::create<InPort>(mm2px(Vec(inputPosX , inputPosY)), Port::INPUT, module, ComputerscareILoveCookies::SIGNAL_INPUT + inputindex)); + } + else { + addInput(Port::create<PointingUpPentagonPort>(mm2px(Vec(inputPosX , inputPosY)), Port::INPUT, module, ComputerscareILoveCookies::SIGNAL_INPUT + inputindex)); + } + smallLetterDisplay = new SmallLetterDisplay(); + smallLetterDisplay->box.pos = mm2px(Vec(inputPosX+6,inputPosY-1)); + smallLetterDisplay->box.size = Vec(20, 20); + smallLetterDisplay->value = inputlookup[inputindex]; + + addChild(smallLetterDisplay); + //module->smallLetterDisplays[i] = smallLetterDisplay; + } + } //global clock input - addInput(Port::create<InPort>(mm2px(Vec(2 , 0)), Port::INPUT, module, ComputerscareILoveCookies::GLOBAL_CLOCK_INPUT)); + addInput(Port::create<InPort>(mm2px(Vec(2+xStart , 0)), Port::INPUT, module, ComputerscareILoveCookies::GLOBAL_CLOCK_INPUT)); //global reset input - addInput(Port::create<InPort>(mm2px(Vec(12 , 0)), Port::INPUT, module, ComputerscareILoveCookies::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)); + + for(int i = 0; i < numFields; i++) { //first-step output - addOutput(Port::create<OutPort>(mm2px(Vec(42 , verticalStart + verticalSpacing*i - 11)), Port::OUTPUT, module, ComputerscareILoveCookies::FIRST_STEP_OUTPUT + i)); + addOutput(Port::create<OutPort>(mm2px(Vec(42+xStart , verticalStart + verticalSpacing*i - 11)), Port::OUTPUT, module, ComputerscareILoveCookies::FIRST_STEP_OUTPUT + i)); //individual output - addOutput(Port::create<OutPort>(mm2px(Vec(54 , verticalStart + verticalSpacing*i - 11)), Port::OUTPUT, module, ComputerscareILoveCookies::TRG_OUTPUT + i)); + addOutput(Port::create<OutPort>(mm2px(Vec(54+xStart , verticalStart + verticalSpacing*i - 11)), Port::OUTPUT, module, ComputerscareILoveCookies::TRG_OUTPUT + i)); //individual clock input - addInput(Port::create<InPort>(mm2px(Vec(2, verticalStart + verticalSpacing*i-10)), Port::INPUT, module, ComputerscareILoveCookies::CLOCK_INPUT + i)); + addInput(Port::create<InPort>(mm2px(Vec(2+xStart, verticalStart + verticalSpacing*i-10)), Port::INPUT, module, ComputerscareILoveCookies::CLOCK_INPUT + i)); //individual reset input - addInput(Port::create<InPort>(mm2px(Vec(12, verticalStart + verticalSpacing*i-10)), Port::INPUT, module, ComputerscareILoveCookies::RESET_INPUT + i)); + addInput(Port::create<InPort>(mm2px(Vec(12+xStart, verticalStart + verticalSpacing*i-10)), Port::INPUT, module, ComputerscareILoveCookies::RESET_INPUT + i)); //sequence input field - textField = Widget::create<MyTextFieldCookie>(mm2px(Vec(1, verticalStart + verticalSpacing*i))); + textField = Widget::create<MyTextFieldCookie>(mm2px(Vec(1+xStart, verticalStart + verticalSpacing*i))); textField->setModule(module); textField->box.size = mm2px(Vec(63, 7)); textField->multiline = false; textField->color = nvgRGB(0xC0, 0xE7, 0xDE); + textField->rowIndex = i; addChild(textField); module->textFields[i] = textField; - //active step display - NumberDisplayWidget3cookie *display = new NumberDisplayWidget3cookie(); - display->box.pos = mm2px(Vec(23,verticalStart - 9.2 +verticalSpacing*i)); - display->box.size = Vec(50, 20); - display->outlineColor = outlineColorMap[i]; - if(&module->numSteps[i]) { - display->value = &module->absoluteStep[i]; - } - else { - display->value = 0; - } - addChild(display); + //active/total steps display + smallLetterDisplay = new SmallLetterDisplay(); + smallLetterDisplay->box.pos = mm2px(Vec(21+xStart,verticalStart - 9.2 +verticalSpacing*i)); + smallLetterDisplay->box.size = Vec(60, 30); + smallLetterDisplay->value = "?/?"; + addChild(smallLetterDisplay); + module->smallLetterDisplays[i] = smallLetterDisplay; + + addParam(ParamWidget::create<ComputerscareInvisibleButton>(mm2px(Vec(21+xStart,verticalStart - 9.9 +verticalSpacing*i)), module, ComputerscareILoveCookies::INDIVIDUAL_RESET_PARAM + i, 0.0, 1.0, 0.0)); } + module->onCreate(); } MyTextFieldCookie* textField; + SmallLetterDisplay* smallLetterDisplay; + }; Model *modelComputerscareILoveCookies = Model::create<ComputerscareILoveCookies, ComputerscareILoveCookiesWidget>("computerscare", "computerscare-i-love-cookies", "I Love Cookies", SEQUENCER_TAG); diff --git a/src/ComputerscareLaundrySoup.cpp b/src/ComputerscareLaundrySoup.cpp @@ -11,7 +11,6 @@ struct ComputerscareLaundrySoup; const int numFields = 6; -const std::string b64lookup = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&$0"; class MyTextField : public LedDisplayTextField { @@ -156,11 +155,9 @@ ComputerscareLaundrySoup() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIG } void setNextAbsoluteSequence(int index) { - //if(textFields[index]->text.size() > 0) { - shouldChange[index] = true; - nextAbsoluteSequences[index].resize(0); - nextAbsoluteSequences[index] = parseEntireString(textFields[index]->text,b64lookup); - //} + shouldChange[index] = true; + nextAbsoluteSequences[index].resize(0); + nextAbsoluteSequences[index] = parseStringAsTimes(textFields[index]->text,b64lookup); } void setAbsoluteSequenceFromQueue(int index) { absoluteSequences[index].resize(0); @@ -184,7 +181,6 @@ void onCreate () override void onReset () override { - onCreate(); } diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -1,19 +1,31 @@ #include "dtpulse.hpp" + std::string b64lookup = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&$0"; std::string integerlookup = "0123456789"; +std::string knoblookup = "abcdefghijklmnopqrstuvwxyz"; +std::string inputlookup= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +std::string knobandinputlookup="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; bool is_digits(const std::string &str) { return str.find_first_not_of(integerlookup) == std::string::npos; } -std::vector<int> parseStringAsValues(std::string input, std::string lookup) { -// "113" -> {1,1,3} - std::vector<int> absoluteSequence; - absoluteSequence.resize(0); - return absoluteSequence; +void padTo(std::string &str, const size_t num, const char paddingChar = ' ') +{ + if(num > str.size()) + str.insert(0, num - str.size(), paddingChar); } -std::vector<int> parseEntireString(std::string input,std::string lookup) { +std::vector<int> parseStringAsTimes(std::string input, std::string lookup) { // "113" -> {1,1,1,0,0} + return parseEntireString(input,lookup,0); +} + +std::vector<int> parseStringAsValues(std::string input, std::string lookup) { + // "113" -> {1,1,3} + return parseEntireString(input,lookup,1); +} + +std::vector<int> parseEntireString(std::string input,std::string lookup,int type) { std::vector<int> absoluteSequence; absoluteSequence.resize(0); bool noNumbers = true; @@ -28,14 +40,15 @@ std::vector<int> parseEntireString(std::string input,std::string lookup) { std::vector<std::string> atVec; std::vector<std::string> offsetVec; + std::string interleaved; std::string commaseg; std::string atseg; std::string offsetseg; std::string atlhs; std::string commalhs; - int atnum; - int offsetnum; + int atnum=-1; + int offsetnum=0; std::stringstream inputstream(input); std::stringstream atstream(input); @@ -50,7 +63,6 @@ std::vector<int> parseEntireString(std::string input,std::string lookup) { while(std::getline(atstream,atseg,'@')) { atVec.push_back(atseg); } - atnum = (atVec.size() > 1 && is_digits(atVec[1]) )? std::stoi(atVec[1]) : -1; if(atVec[0].empty() && atnum > 0) { for(int i = 0; i < atnum; i++) { @@ -75,8 +87,15 @@ std::vector<int> parseEntireString(std::string input,std::string lookup) { else { offsetnum = (offsetVec.size() > 1 && is_digits(offsetVec[1]))? std::stoi(offsetVec[1]) : 0; commaVec.resize(0); + interleaved = splitRecur(offsetVec[0]); // below may be the only line that has to change for a by value parse - commaVec = parseDt(atExpand(offsetVec[0],atnum,lookup),offsetnum,lookup); + if(type==0) { + commaVec = parseDt(atExpand(interleaved,atnum,lookup),offsetnum,lookup); + } + else { + commaVec = parseLookup(countExpand(interleaved,atnum),offsetnum,lookup); + } + absoluteSequence.insert(absoluteSequence.end(),commaVec.begin(),commaVec.end()); } } @@ -84,6 +103,20 @@ std::vector<int> parseEntireString(std::string input,std::string lookup) { } return absoluteSequence; } +std::vector<int> parseLookup(std::string input, int offset, std::string lookup) { + std::vector<int> absoluteSequence; + int currentVal; + int mappedIndex=0; + int length = input.length(); + absoluteSequence.resize(0); + + for(int i = 0; i < length; i++) { + mappedIndex = (i + offset) % length; + currentVal = lookup.find(input[mappedIndex]); + absoluteSequence.push_back(currentVal); + } + return absoluteSequence; +} std::vector<int> parseDt(std::string input, int offset, std::string lookup) { std::vector <int> absoluteSequence; @@ -109,6 +142,106 @@ std::vector<int> parseDt(std::string input, int offset, std::string lookup) { } return absoluteSequence; } +std::string splitRecur(std::string input) { + std::vector<std::vector<std::string>> stackVec; + std::string tempString; + std::string output; + std::string c; + stackVec.push_back({}); + for(unsigned int i = 0; i < input.length(); i++) { + c = input[i]; + if(c == "(") { + stackVec.push_back({}); + } + else if(c == ")") { + //evaluate top of stack + tempString = interleaveExpand(stackVec.back()); + //pop top of stack + stackVec.pop_back(); + if(stackVec.size() > 0) { + //push this evaluated string to new top + stackVec.back().push_back(tempString); + } + else { + return ""; + } + } + else { + stackVec.back().push_back(c); + } + } + std::vector<std::string> last = stackVec.back(); + output = interleaveExpand(last); + return output; +} + +std::string interleaveExpand(std::vector<std::string> blocks) { + // take a vector of strings and return a string interleave + // somewhat like bash shell expansion + // ["a","b","cd"] --> "abcabd" + // ["ab","cde"] ----> "acbdaebcadbe" + std::vector<int> indices; + std::vector<int> lengths; + int outerIndex = 0; + int outerLength = blocks.size(); + int steps = 0; + bool allAtZero = false; + std::string output=""; + for(int i = 0; i < outerLength; i++) { + indices.push_back(0); + lengths.push_back(blocks[i].length()); + } + while(outerLength && ((!allAtZero && steps < 6000 ) || steps == 0)) { + if(lengths[outerIndex]) { + output+=blocks[outerIndex][indices[outerIndex]]; + indices[outerIndex]++; + indices[outerIndex]%=lengths[outerIndex]; + } + outerIndex++; + outerIndex%=outerLength; + steps++; + allAtZero = outerIndex==0; + + for(int i = 0; i < outerLength; i++) { + allAtZero &= (indices[i] == 0); + } + } + return output; +} +std::vector<Token> interleaveExpand(std::vector<std::vector<Token>> blocks) { + // take a vector of strings and return a string interleave + // somewhat like bash shell expansion + // ["a","b","cd"] --> "abcabd" + // ["ab","cde"] ----> "acbdaebcadbe" + std::vector<Token> output; + std::vector<int> indices; + std::vector<int> lengths; + int outerIndex = 0; + int outerLength = blocks.size(); + int steps = 0; + bool allAtZero = false; + for(int i = 0; i < outerLength; i++) { + indices.push_back(0); + lengths.push_back(blocks[i].size()); + } + while(outerLength && ((!allAtZero && steps < 6000 ) || steps == 0)) { + if(lengths[outerIndex]) { + output.push_back(blocks[outerIndex][indices[outerIndex]]); + indices[outerIndex]++; + indices[outerIndex]%=lengths[outerIndex]; + } + outerIndex++; + outerIndex%=outerLength; + steps++; + allAtZero = outerIndex==0; + + for(int i = 0; i < outerLength; i++) { + allAtZero &= (indices[i] == 0); + } + } + return output; +} + std::string atExpand(std::string input, int atnum, std::string lookup) { std::string output=""; int length = input.length(); @@ -138,6 +271,22 @@ std::string atExpand(std::string input, int atnum, std::string lookup) { return output; } +std::string countExpand(std::string input, int atnum) { + std::string output=""; + int length = input.length(); + int index = 0; + if(atnum == -1) { + return input; + } + else if(atnum == 0) { + return ""; + } + for(index = 0; index < atnum; index++) { + output += input[index % length]; + } + return output; +} + std::string hashExpand(std::string input, int hashnum) { std::string output=""; int length = input.length(); @@ -148,3 +297,550 @@ std::string hashExpand(std::string input, int hashnum) { } return output; } + +std::string concatVectorFromLookup(std::vector<int> vector, std::string lookup) { + std::string output=""; + for (unsigned int i = 0; i < vector.size(); i++){ + output+=lookup[vector[i]]; + } + return output; +} +void printFloatVector(std::vector<float> floatVector) { + for(unsigned int i = 0; i < floatVector.size(); i++) { + printf("floatVector[%i]: %f\n",i,floatVector[i]); + } +} +void printTokenVector(std::vector<std::vector<Token>> tokenVector) { + for(unsigned int i = 0; i < tokenVector.size(); i++) { + printf("tokenVector[%i]: ",i); + for(unsigned int j = 0; j < tokenVector[i].size(); j++) { + printf("%i ",tokenVector[i][j].index); + } + printf("\n"); + + } +} + +bool matchParens(std::string value) { + std::string c=""; + int parensCount=0; + int squareCount=0; + int curlyCount=0; + int angleCount=0; + bool theyMatch=true; + for(unsigned int i = 0; i < value.length(); i++) { + c = value[i]; + if(c=="(") { + parensCount+=1; + } + else if(c==")") { + parensCount-=1; + } + if(c=="[") { + squareCount+=1; + } + else if(c=="]") { + squareCount-=1; + } + if(c=="{") { + curlyCount+=1; + } + else if(c=="}") { + curlyCount-=1; + } + if(c=="<") { + angleCount+=1; + } + else if(c==">") { + angleCount-=1; + } + } + theyMatch = (parensCount==0) && (squareCount ==0) && (curlyCount==0) && (angleCount==0); + return theyMatch; + } +void whoKnows(std::string input) { + AbsoluteSequence abs = AbsoluteSequence(input,knobandinputlookup); + abs.print(); + printf(" indexSequence:\n"); + printVector(abs.indexSequence); + printf(" workingIndexSequence:\n"); + printVector(abs.workingIndexSequence); + srand (time(NULL)); + printf(" iteration:\n"); + for(int j = 0; j < 13; j++) { + abs.incrementAndCheck(); + printVector(abs.workingIndexSequence); + } +} + +AbsoluteSequence::AbsoluteSequence() { + AbsoluteSequence("a",knobandinputlookup); +} +AbsoluteSequence::AbsoluteSequence(std::string expr, std::string lookup) { + std::vector<Token> defaultStack; + defaultStack.push_back(Token("Error", "error",-1)); + //expr = expr=="" ? "a" : expr; + if(expr != "") { + Parser p = Parser(expr); + exactFloats = p.exactFloats; + randomTokens=p.randomVector; + if(p.inError || !p.tokenStack.size()) { + tokenStack = defaultStack; + } + else { + tokenStack = p.tokenStack; + } + } + else { + tokenStack = defaultStack; + } + numTokens = tokenStack.size(); + indexSequence = getIndicesFromTokenStack(tokenStack); + workingIndexSequence = duplicateIntVector(indexSequence); + readHead = -1;//((int)indexSequence.size())-1 ; +} +void AbsoluteSequence::randomizeIndex(int index) { + int randomTokenIndex = indexSequence[index] - 78; + std::vector<int> myRandomTokens = getIndicesFromTokenStack(randomTokens[randomTokenIndex]); + int size = myRandomTokens.size(); + if(size) { + //random one from those enclosed by the {} + workingIndexSequence[index] = myRandomTokens[rand() % (myRandomTokens.size())]; + } + else { + //random address ie: a-z,A-Z + workingIndexSequence[index] = rand() % 26; + } +} +void AbsoluteSequence::skipStep() { + readHead++; + readHead %= indexSequence.size(); +} +int AbsoluteSequence::skipAndPeek() { + skipStep(); + return peekStep(); +} +int AbsoluteSequence::peekStep() { + return indexSequence[readHead]; +} +int AbsoluteSequence::peekWorkingStep() { + return (readHead >=0) ? workingIndexSequence[readHead] : 0; +} +void AbsoluteSequence::incrementAndCheck() { + if(skipAndPeek()>=78) { + randomizeIndex(readHead); + } +} +std::string AbsoluteSequence::getWorkingStepDisplay() { + int stepIndex = peekWorkingStep(); + if(stepIndex < 52) { + std::string str(1,knobandinputlookup[stepIndex]); + return str; + } + else { + return std::to_string((long double) exactFloats[stepIndex - 52]); + } +} + +std::vector<int> getIndicesFromTokenStack(std::vector<Token> tokens) { + std::vector<int> output; + for(unsigned int i = 0; i < tokens.size(); i++) { + output.push_back(tokens[i].index); + } + return output; +} +std::vector<int> duplicateIntVector(std::vector<int> input) { + std::vector<int> output; + for(unsigned int i = 0; i < input.size(); i++) { + output.push_back(input[i]); + } + return output; +} +void printTokenVector(std::vector<Token> tokenVector) { + + for(unsigned int i = 0; i < tokenVector.size(); i++) { + tokenVector[i].print(); + } +} +void AbsoluteSequence::print() { + printFloatVector(exactFloats); + printTokenVector(randomTokens); + printf(" stack:\n"); + printTokenVector(tokenStack); +} +Token::Token(std::string t, std::string v) { + type = t; + value = v; + index = -1; +} +Token::Token(std::string t, std::string v, int dex) { + type = t; + value = v; + index = dex; +} +Parser::Parser(std::string expr) { + tokens = tokenizeString(expr); + expression=expr; + inError = false; + if(tokens.size() > 0) { + currentIndex=0; + setExactValue(tokens[0]); + + //printTokenVector(tokenStack); + if(!inError) { + currentIndex=0; + tokens=tokenStack; + tokenStack = {}; + setForRandoms(tokens[0]); + if(!inError) { + //printTokenVector(tokenStack); + currentIndex = 0; + tokens = tokenStack; + tokenStack={}; + setForInterleave(tokens[0]); + + if(!inError) { + //printTokenVector(tokenStack); + currentIndex = 0; + tokens = tokenStack; + tokenStack = {}; + setForAtExpand(tokens[0]); + + if(!inError) { + currentIndex = 0; + tokens=tokenStack; + tokenStack = {}; + setForSquareBrackets(tokens[0]); + if(!inError) { + currentIndex = 0; + tokens=tokenStack; + tokenStack = {}; + setFinal(tokens[0]); + } + } + } + } + } + } + } +void Parser::setFinal(Token t) { + while (t.type!="NULL") { + if(t.type=="Letter" || t.type=="ExactValue" || t.type=="RandomSequence" || t.type =="Zero") { + tokenStack.push_back(t); + } + else if(t.type=="Comma") { + + } + else { + inError = true; + break; + } + t = skipAndPeekToken(); + } +} + +void Parser::setExactValue(Token t) { + while (t.type!="NULL") { + ParseExactValue(t); + if(peekToken().type !="NULL") { + tokenStack.push_back(peekToken()); + } + t = skipAndPeekToken(); + } +} +void Parser::setForRandoms(Token t) { + while (t.type!="NULL") { + ParseRandomSequence(t); + if(peekToken().type !="NULL") { + tokenStack.push_back(peekToken()); + } + t = skipAndPeekToken(); + } +} +void Parser::setForInterleave(Token t) { + while (t.type!="NULL") { + ParseInterleave(t); + if(peekToken().type !="NULL") { + tokenStack.push_back(peekToken()); + } + t = skipAndPeekToken(); + } +} +void Parser::setForAtExpand(Token t) { + while (t.type!="NULL") { + ParseAtExpand(t); + if(peekToken().type !="NULL") { + tokenStack.push_back(peekToken()); + } + t = skipAndPeekToken(); + } +} +void Parser::setForSquareBrackets(Token t) { + while (t.type!="NULL") { + ParseSquareBrackets(t); + if(peekToken().type !="NULL") { + tokenStack.push_back(peekToken()); + } + t = skipAndPeekToken(); + } +} + +void Parser::ParseExactValue(Token t) { + if(t.type=="LeftAngle") { + t=skipAndPeekToken(); + std::string num=""; + if(t.type=="Minus") { + num+="-"; + t=skipAndPeekToken(); + } + if(t.type=="Digit" || t.type=="Period") { + num += parseFloat(t); + t=peekToken(); + if(!inError && t.type=="RightAngle") { + skipToken(); + int sizeInt = static_cast<int>(exactFloats.size()); + num = ((num.length() == 0) || num=="." || num=="-") ? "0" : num; + tokenStack.push_back(Token("ExactValue",num,sizeInt + 52)); + exactFloats.push_back(std::stof(num)); + setExactValue(peekToken()); + } + else { + inError = true; + } + } + else { + inError=true; + } + } // not a LeftAngle, dont do shit +} +void Parser::ParseRandomSequence(Token t) { + std::vector<Token> proposedRandomVector; + if(t.type=="LeftCurly") { + t=skipAndPeekToken(); + std::string num=""; + while(t.type=="Letter" || t.type=="ExactValue") { + if(t.type=="Letter") { + proposedRandomVector.push_back(Token(t.type,t.value,knobandinputlookup.find(t.value))); + t=skipAndPeekToken(); + } + if(t.type=="ExactValue") { + proposedRandomVector.push_back(Token("ExactValue",t.value,t.index)); + t=skipAndPeekToken(); + } + t=peekToken(); + } + if(t.type=="RightCurly") { + skipToken(); + randomVector.push_back(proposedRandomVector); + int sizeInt = static_cast<int>(randomVector.size()); + int myIndex = 52 + 26 + sizeInt -1; + std::string stringDex = std::to_string(static_cast<long long>(myIndex)); + tokenStack.push_back(Token("RandomSequence",stringDex,myIndex)); + } + else { + inError = true; + } + ParseRandomSequence(peekToken()); + } // not a LeftCurly, dont do shit +} +void Parser::ParseInterleave(Token t) { + std::vector<std::vector<std::vector<Token>>> stackVec; + std::vector<Token> tempStack; + std::vector<Token> output; + stackVec.push_back({}); + while(t.type=="Letter"||t.type=="ExactValue"||t.type=="RandomSequence"||t.type=="LeftParen"||t.type=="RightParen") { + if(t.type=="LeftParen") { + stackVec.push_back({}); + } + else if(t.type=="RightParen") { + //evaluate top of stack + tempStack = interleaveExpand(stackVec.back()); + + //pop top of stack + stackVec.pop_back(); + if(stackVec.size() > 0) { + //push this evaluated vector<Token> to new top + stackVec.back().push_back(tempStack); + } + else { + + } + } + //Letter, ExactValue, or RandomSequence + else { + stackVec.back().push_back({t}); + } + t=skipAndPeekToken(); + } + output = interleaveExpand(stackVec.back()); + tokenStack.insert(tokenStack.end(),output.begin(),output.end()); +} +void Parser::ParseAtExpand(Token t) { + // for letter,{},<> followed by an optional "@" and an integer + // ab@3 da@2 cad + std::vector<std::vector<Token>> tokenVec; + std::vector<Token> proposedTokens; + tokenVec.push_back({}); + int atNum = -1; + if(t.type=="Letter" || t.type=="RandomSequence" || t.type=="ExactValue") { + while(t.type=="Letter" || t.type=="RandomSequence"||t.type=="ExactValue") { + tokenVec.back().push_back(t); + t = skipAndPeekToken(); + } + atNum = ParseAtPart(t); + proposedTokens = countExpandTokens(tokenVec,atNum); + tokenStack.insert(tokenStack.end(),proposedTokens.begin(),proposedTokens.end()); + } +} +void Parser::ParseSquareBrackets(Token t) { + std::vector<Token> proposedTokens; + std::vector<std::vector<Token>> insideOfBrackets; + int atNum; + if(t.type=="LeftSquare") { + t=skipAndPeekToken(); + insideOfBrackets.push_back({}); + while(t.type=="ExactValue" || t.type=="Letter" || t.type=="RandomSequence" || t.type=="Comma") { + if(t.type=="Comma") { + insideOfBrackets.push_back({}); + } + else { + insideOfBrackets.back().push_back(t); + } + t=skipAndPeekToken(); + } + if(t.type=="RightSquare") { + t = skipAndPeekToken(); + atNum = ParseAtPart(t); + proposedTokens = countExpandTokens(insideOfBrackets,atNum); + tokenStack.insert(tokenStack.end(),proposedTokens.begin(),proposedTokens.end()); + } + else { + inError = true; + } + } +} +std::vector<Token> Parser::countExpandTokens(std::vector<std::vector<Token>> tokenVecVec, int atNum) { + std::vector<Token> output; + printTokenVector(tokenVecVec); + for(unsigned int i=0; i < tokenVecVec.size(); i++) { + int sizeMod = (int) tokenVecVec[i].size(); + atNum = atNum==-1 ? sizeMod : atNum; + if(sizeMod > 0 ) { + for(int j = 0; j < atNum; j++) { + if(tokenVecVec[i].size()) { + output.push_back(tokenVecVec[i][j % sizeMod]); + } + else { //tokenVecVec[i].size()==0 + //output.push_back(Token("Zero","")); + } + } + } + else { //sizeMod <= 0 + output.push_back(Token("Zero","")); + } + } + return output; +} +int Parser::ParseAtPart(Token t) { + std::string atString = ""; + int atNum = -1; + if(t.type=="At") { + t=skipAndPeekToken(); + while(t.type=="Digit") { + atString+=t.value; + t=skipAndPeekToken(); + } + atNum = atString != "" ? std::stoi(atString) : -1; + } + return atNum; +} +char Parser::peekChar() { + if (currentIndex < (int) expression.size()) return expression[currentIndex]; + return 0; +} +Token Parser::peekToken() { + if (currentIndex < (int) tokens.size()) return tokens[currentIndex]; + return Token("NULL","NULL"); +} +void Parser::skipToken() { + currentIndex++; + } +void Parser::skipChar() { + currentIndex++; +} +char Parser::skipAndPeekChar() { + skipChar(); + return peekChar(); +} +Token Parser::skipAndPeekToken() { + skipToken(); + return peekToken(); +} +std::string Parser::parseFloat(Token t) +{ + std::string number = ""; + if (t.type != "Period") + { + // parse before '.' + while (t.type!="NULL" && t.type=="Digit" && t.type != "Period" ) { + number += t.value; + t = skipAndPeekToken(); + } + } + if (t.type=="Period") + { + // parse after '.' + number += t.value; + t = skipAndPeekToken(); + if (t.type!="NULL" && t.type == "Digit") { + while (t.type!="NULL" && t.type=="Digit" ) { + number += t.value; + t = skipAndPeekToken(); + } + } else { + inError = true; + printf("Expected digit after '.', number: %s\n",number.c_str()); + } + } + return number; +} +void Token::print() { + printf("type: %s value: %s index: %i\n",type.c_str(),value.c_str(),index); +} +std::vector<Token> tokenizeString(std::string input) { + std::vector<Token> stack; + for(unsigned int i = 0; i < input.length(); i++) { + std::string token(1,input[i]); + if(token=="(") stack.push_back(Token("LeftParen",token)); + else if(token== ")") stack.push_back(Token("RightParen",token)); + else if(token== "[") stack.push_back(Token("LeftSquare",token)); + else if(token== "]") stack.push_back(Token("RightSquare",token)); + else if(token== "{") stack.push_back(Token("LeftCurly",token)); + else if(token== "}") stack.push_back(Token("RightCurly",token)); + else if(token== "<") stack.push_back(Token("LeftAngle",token)); + else if(token== ">") stack.push_back(Token("RightAngle",token)); + else if(token== "@") stack.push_back(Token("At",token)); + else if(token== ",") stack.push_back(Token("Comma",token)); + else if(token== "+") stack.push_back(Token("Plus",token)); + else if(token== "-") stack.push_back(Token("Minus",token)); + else if(token== "*") stack.push_back(Token("Asterix",token)); + else if(token== "/") stack.push_back(Token("Backslash",token)); + else if(token== " ") stack.push_back(Token("Whitespace",token)); + else if(token== ".") stack.push_back(Token("Period",token)); + else if(token== "!") stack.push_back(Token("Bang",token)); + else if(token== "?") stack.push_back(Token("Question",token)); + else if(token== "#") stack.push_back(Token("Hash",token)); + else if(token== "^") stack.push_back(Token("Caret",token)); + else if(token== ":") stack.push_back(Token("Colon",token)); + else if(token== ";") stack.push_back(Token("Semicolon",token)); + else if(token== "|") stack.push_back(Token("Pipe",token)); + else if(knobandinputlookup.find(token) != -1) { + stack.push_back(Token("Letter",token,knobandinputlookup.find(token))); + } + else if(integerlookup.find(token) != -1) { + stack.push_back(Token("Digit",token)); + } + else stack.push_back(Token("Unknown",token)); + } + return stack; +} diff --git a/src/dtpulse.hpp b/src/dtpulse.hpp @@ -1,14 +1,110 @@ + #include <string> #include <sstream> #include <iomanip> #include <iostream> #include <vector> #include <algorithm> +#include <typeinfo> +#include <stdexcept> + +#ifndef MY_GLOBALS_H +#define MY_GLOBALS_H +extern std::string b64lookup; +extern std::string integerlookup; +extern std::string knoblookup; +extern std::string inputlookup; +extern std::string knobandinputlookup; +#endif + +class Token { + public: + std::string type; + std::string value; + int index; + Token(std::string t, std::string v); + Token(std::string t, std::string v, int dex); + void print(); +}; +class Parser { + public: + Parser(std::string expr); + std::string expression; + std::vector<Token> tokens; + char peekChar(); + char skipAndPeekChar(); + void skipChar(); + + Token peekToken(); + Token skipAndPeekToken(); + void skipToken(); + void setExactValue(Token t); + void setForRandoms(Token t); + void setForInterleave(Token t); + void setForAtExpand(Token t); + void setForSquareBrackets(Token t); + void setFinal(Token t); + bool inError; + std::string parseFloat(Token t); + std::vector<Token> tokenStack; + std::vector<float> exactFloats; + std::vector<std::vector<Token>> randomVector; + std::vector<Token> countExpandTokens(std::vector<std::vector<Token>> tokenVecVec, int atNum); + private: + int currentIndex; + void ParseExactValue(Token t); + void ParseRandomSequence(Token t); + void ParseInterleave(Token t); + void ParseAtExpand(Token t); + void ParseSquareBrackets(Token t); + int ParseAtPart(Token t); +}; +class AbsoluteSequence { + public: + AbsoluteSequence(std::string expr, std::string lookup); + AbsoluteSequence(); + void randomizeIndex(int index); + std::vector<int> indexSequence; + std::vector<int> workingIndexSequence; + std::vector<float> exactFloats; + std::vector<std::vector<int>> randomIndexes; + std::vector<std::vector<Token>> randomTokens; + std::vector<Token> tokenStack; + int readHead; + int numTokens; + void print(); + void skipStep(); + int peekStep(); + int peekWorkingStep(); + int skipAndPeek(); + void incrementAndCheck(); + int getReadHead(); + int getCurrentAddressAtReadHead(); + std::string getWorkingStepDisplay(); +}; bool is_digits(const std::string &str); +void padTo(std::string &str, const size_t num, const char paddingChar ); std::vector <int> parseString(std::string expr); std::vector <int> parseDt(std::string input, int offset, std::string lookup); -std::vector<int> parseEntireString(std::string input,std::string lookup); +std::vector <int> parseLookup(std::string input, int offset, std::string lookup); +std::vector<int> parseEntireString(std::string input,std::string lookup, int type); std::vector<int> parseStringAsValues(std::string input,std::string lookup); +std::vector<int> parseStringAsTimes(std::string input,std::string lookup); void printVector(std::vector <int> intVector); +void printFloatVector(std::vector<float> floatVector); +void printTokenVector(std::vector<std::vector<Token>> tokenVector); +void printTokenVector(std::vector<Token> tokenVector); +std::string splitRecur(std::string input); +void parseRecur(Token t); +std::string interleaveExpand(std::vector<std::string> blocks); +std::vector<Token> interleaveExpand(std::vector<std::vector<Token>> blocks); std::string hashExpand(std::string input, int hashnum); std::string atExpand(std::string input, int atnum, std::string lookup); +std::string countExpand(std::string input, int atnum); +std::string concatVectorFromLookup(std::vector<int> vector, std::string lookup); +std::vector<Token> tokenizeString(std::string input); +bool matchParens(std::string value); +std::string evalToken(std::string input, std::string type,std::vector<Token> tStack); +void whoKnows(std::string input); +std::vector<int> getIndicesFromTokenStack(std::vector<Token> tokens); +std::vector<int> duplicateIntVector(std::vector<int> input); diff --git a/src/test.cpp b/src/test.cpp @@ -0,0 +1,46 @@ +#include "dtpulse.hpp" +int main(int argc, char** argv) +{ + int type = 0; + std::vector<int> output; + std::string strResult = ""; + std::string strParens = ""; + std::vector <std::string> input; + if(argv[2]) { + type = std::stoi(argv[2]); + } + if(type == 0) { + output = parseEntireString(argv[1],b64lookup,0); + printVector(output); + } + else if(type==1) { + output = parseEntireString(argv[1],knobandinputlookup,1); + printVector(output); + } + else if(type==2) { + strParens = splitRecur(argv[1]); + printf("%s\n",strParens.c_str()); + } + else if(type==3) { + for(int i = 0; i < argc-3; i++) { + input.push_back(argv[i+3]); + } + strResult = interleaveExpand(input); + printf("%s\n",strResult.c_str()); + } + else if(type==4) { + output = parseEntireString(argv[1],knobandinputlookup,1); + strResult = concatVectorFromLookup(output,knobandinputlookup); + printf("%s\n",strResult.c_str()); + } + else if(type==5) { + whoKnows(argv[1]); + } + return 0; +} +void printVector(std::vector <int> intVector) { + for (std::vector<int>::const_iterator i = intVector.begin(); i != intVector.end(); ++i){ + std::cout << *i << ' '; + } + std::cout << std::endl; +}