commit 02745cba6c0d176d445d186849ffa09d447d2017
parent 77ed6b4ef31e7a93bbf5a5d6edabf3ad04427005
Author: Adam M <aemalone@gmail.com>
Date: Sat, 16 Feb 2019 22:40:11 -0600
Make Debug work with v1. Add output port to debug
Diffstat:
5 files changed, 102 insertions(+), 90 deletions(-)
diff --git a/res/ComputerscareDebugPanel.svg b/res/ComputerscareDebugPanel.svg
@@ -34,9 +34,9 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="4.0000002"
- inkscape:cx="29.704569"
- inkscape:cy="358.68215"
+ inkscape:zoom="8.0000004"
+ inkscape:cx="36.534855"
+ inkscape:cy="364.83589"
inkscape:document-units="mm"
inkscape:current-layer="text1667"
showgrid="false"
@@ -49,7 +49,8 @@
inkscape:window-height="856"
inkscape:window-x="0"
inkscape:window-y="0"
- inkscape:window-maximized="0" />
+ inkscape:window-maximized="0"
+ inkscape:snap-global="false" />
<metadata
id="metadata5">
<rdf:RDF>
@@ -58,7 +59,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -282,34 +283,39 @@
</g>
<g
aria-label="debug"
- transform="matrix(1.0139335,-0.02825079,0.06854811,0.98434808,0,0)"
+ transform="matrix(0.87695926,-0.04700004,0.05928781,1.6376321,0.72575314,-127.94726)"
style="font-style:normal;font-weight:normal;font-size:10.74719143px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26867977"
id="text1667">
<path
- d="m -8.0187684,202.28597 v -1.48404 H -7.56817 v 3.8105 h -0.4505984 v -0.41142 q -0.1420364,0.24489 -0.3599889,0.36489 -0.2155036,0.11754 -0.5191677,0.11754 -0.4971276,0 -0.8105874,-0.39672 -0.3110106,-0.39672 -0.3110106,-1.04323 0,-0.64651 0.3110106,-1.04323 0.3134598,-0.39673 0.8105874,-0.39673 0.3036641,0 0.5191677,0.12 0.2179525,0.11755 0.3599889,0.36244 z m -1.535463,0.95752 q 0,0.49713 0.2032591,0.7812 0.2057079,0.28162 0.563248,0.28162 0.35754,0 0.563248,-0.28162 0.2057079,-0.28407 0.2057079,-0.7812 0,-0.49713 -0.2057079,-0.77875 -0.205708,-0.28408 -0.563248,-0.28408 -0.3575401,0 -0.563248,0.28408 -0.2032591,0.28162 -0.2032591,0.77875 z"
- style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.01535606px;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.26867977"
+ d="m -11.553796,199.77619 0.109394,-1.58794 0.50487,6.3e-4 -0.280817,4.07727 -0.504869,-6.3e-4 c 0.0083,-0.14551 -0.484924,0.0531 0.0303,-0.44022 -0.118127,0.17456 -0.26154,0.30454 -0.430238,0.38993 -0.166748,0.0837 -0.363535,0.12534 -0.590361,0.12505 -0.371335,-4.5e-4 -0.664328,-0.14233 -0.878979,-0.42562 -0.212823,-0.28328 -0.303354,-0.65551 -0.271591,-1.11669 0.03177,-0.46118 0.33502,-0.99006 0.586815,-1.27277 0.253634,-0.28271 0.404657,-0.2669 0.775992,-0.26644 0.226826,2.8e-4 0.222764,0.13868 0.377841,0.2245 0.157027,0.084 0.477587,0.11811 0.57165,0.29293 z m -1.790964,1.02242 c -0.02446,0.35463 0.03226,0.63335 0.17017,0.83617 0.139821,0.20109 0.343265,0.3018 0.610333,0.30213 0.267069,3.3e-4 0.48435,-0.0999 0.651842,-0.30056 0.167613,-0.20245 0.263631,-0.48099 0.288055,-0.8356 0.02446,-0.35462 -0.233705,-0.45646 -0.373559,-0.65755 -0.139699,-0.20283 -0.207512,-0.0784 -0.474581,-0.0787 -0.267069,-3.3e-4 -0.430419,-0.14007 -0.598032,0.0624 -0.165662,0.2007 -0.249803,0.31711 -0.274228,0.67173 z"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.01535606px;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.29419962"
id="path1671"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccccccccccccccccccsccc" />
<path
- d="m -4.2939849,203.12839 v 0.2204 h -2.071773 q 0.029387,0.46529 0.2791751,0.71018 0.2522371,0.24245 0.7003866,0.24245 0.2595839,0 0.5020254,-0.0637 0.2448904,-0.0637 0.484883,-0.19101 v 0.42611 q -0.2424415,0.10285 -0.4971275,0.15673 -0.2546861,0.0539 -0.5167189,0.0539 -0.6563063,0 -1.0407843,-0.38202 -0.3820291,-0.38203 -0.3820291,-1.03344 0,-0.67345 0.3624379,-1.06772 0.3648867,-0.39673 0.9820106,-0.39673 0.5534524,0 0.8742589,0.35754 0.3232553,0.35509 0.3232553,0.96732 z m -0.4505984,-0.13224 q -0.0049,-0.36978 -0.2081568,-0.59019 -0.2008102,-0.2204 -0.5338612,-0.2204 -0.3771313,0 -0.6048794,0.21306 -0.2252992,0.21305 -0.2595838,0.59998 z"
+ d="m -8.1057085,200.78544 0,0.2204 h -2.0717725 c 0.01959,0.31019 0.112652,0.54692 0.2791746,0.71018 0.1681581,0.16163 0.41661,0.0207 0.7153763,0.0207 0.1730559,0 0.5285984,-0.0158 0.6902261,-0.0583 0.1632603,-0.0425 0.1216975,0.11018 0.2816926,0.0253 l 0,0.42611 c -0.1616277,0.0686 -0.3273368,0.12081 -0.4971275,0.15673 -0.1697907,0.0359 -0.3420304,0.0539 -0.5167189,0.0539 -0.4375375,0 -0.7844652,-0.12734 -1.0407842,-0.38202 -0.254686,-0.25469 -0.382029,-0.59917 -0.382029,-1.03344 0,-0.44897 0.05643,-0.96829 0.298059,-1.23113 0.243258,-0.26449 0.6041467,-0.33518 1.0155627,-0.33518 0.3689682,0 0.6912145,0.22104 0.9050855,0.4594 0.2155035,0.23673 0.3232553,0.55917 0.3232553,0.96732 z m -0.4505984,-0.13224 c -0.00327,-0.24652 -0.072652,-0.44325 -0.2081568,-0.59019 -0.1338735,-0.14693 -0.3118272,-0.2204 -0.5338612,-0.2204 -0.2514209,0 -0.2716601,0.1772 -0.6048794,0.21306 -0.1501987,0.14203 -0.082078,0.28588 -0.1049347,0.54383 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.01535606px;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.26867977"
id="path1673"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccsccccscscscccccsccc" />
<path
- d="m -1.5013251,203.28116 q 0.019267,-0.49759 -0.1856192,-0.78849 -0.2022218,-0.29328 -0.5773042,-0.30899 -0.3750826,-0.0157 -0.6018934,0.2596 -0.2241464,0.27294 -0.2434136,0.77052 -0.019268,0.49758 0.1829552,0.79084 0.2048862,0.29092 0.5799687,0.30663 0.3750826,0.0157 0.5992288,-0.25724 0.2268106,-0.27529 0.2460777,-0.77287 z m -1.57112,-1.02575 q 0.1584963,-0.23887 0.3891293,-0.34706 0.2332971,-0.11053 0.549291,-0.0973 0.5240878,0.0219 0.8349824,0.43271 0.31346385,0.41085 0.2884073,1.05795 -0.025057,0.64709 -0.3692715,1.0304 -0.3416461,0.38342 -0.8657339,0.36147 -0.3159942,-0.0132 -0.5400848,-0.14046 -0.2214264,-0.12957 -0.3609406,-0.38093 l -0.015945,0.4118 -0.4752756,-0.0199 0.1476823,-3.81397 0.4752756,0.0199 z"
- style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.01535606px;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.27554041"
+ d="m -5.6043964,200.58039 c 0.00511,-0.27418 -0.068546,-0.49166 -0.2209738,-0.65245 -0.1505543,-0.1621 -0.3608165,-0.24792 -0.6307868,-0.25745 -0.2699891,-0.009 -0.2537715,0.0421 -0.4120096,0.19321 -0.1563724,0.14988 -0.2371145,0.3619 -0.242228,0.63607 -0.00511,0.27417 0.067608,0.49229 0.2181624,0.65438 0.152429,0.1608 0.363629,0.24597 0.6335994,0.2555 0.2699891,0.009 0.2528324,-0.0415 0.4091961,-0.19124 0.1582468,-0.15118 0.2399268,-0.36385 0.2450403,-0.63802 z m -1.491226,-0.87272 c 0.1097672,-0.13127 0.2466159,-0.22645 0.4105469,-0.28553 0.1658112,-0.0604 0.362427,-0.0865 0.5898642,-0.0785 0.9083532,0.35639 0.036175,0.0254 0.9119631,0.36063 -0.3897581,0.0959 0.3455835,0.519 0.338935,0.87555 -0.00665,0.35655 -0.1303583,0.64004 -0.3711241,0.85047 -0.238917,0.21049 -0.5469851,0.30908 -0.924204,0.29576 -0.2274262,-0.008 -0.4228393,-0.0474 -0.5862035,-0.11801 -0.1614894,-0.0719 -0.2945962,-0.17731 -0.3993256,-0.31616 l -0.00635,0.34036 -0.6386716,0.0556 0.1842986,-3.22559 0.5131417,0.0179 z"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.01535606px;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.26015803"
id="path1675"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="scccscccscccccccccccccc" />
<path
- d="m -0.4173698,203.53001 v -1.66036 h 0.45059839 v 1.64322 q 0,0.38937 0.15183207,0.58529 0.15183207,0.19346 0.45549621,0.19346 0.36488673,0 0.57549253,-0.23265 0.2130547,-0.23264 0.2130547,-0.63426 v -1.55506 h 0.4505984 v 2.74278 H 1.4291041 v -0.42121 q -0.1640766,0.24978 -0.3820291,0.37223 -0.2155036,0.11999 -0.5020254,0.11999 -0.47263854,0 -0.71752897,-0.29386 -0.24489043,-0.29387 -0.24489043,-0.85957 z"
- style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.01535606px;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.26867977"
+ d="m -4.2026675,200.67851 0.047494,-1.049 0.6936507,-0.0658 -0.2501469,1.12327 c -0.00743,0.164 0.042082,0.28942 0.148539,0.37626 0.106497,0.0858 0.4730837,0.0479 0.6934557,0.0566 0.2648264,0.0102 0.2727063,0.0546 0.4299802,-0.0374 0.1590548,-0.0919 0.4455596,-0.30757 0.453219,-0.47674 l -0.158662,-0.89738 0.6936508,-0.0657 -0.2816044,1.81795 -0.4905085,-0.0193 0.012052,-0.26611 c -0.1238369,0.10054 -0.2660087,0.17349 -0.4265178,0.21888 -0.1586846,0.0444 -0.3419956,0.0626 -0.5499317,0.0544 -0.3430212,-0.0133 -0.6005669,-0.0855 -0.772683,-0.21627 -0.1721187,-0.13073 -0.2527835,-0.31524 -0.2419945,-0.55352 z"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.01535606px;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.22301689"
id="path1677"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccccccccccccccc" />
<path
- d="m 5.0589196,203.27151 q 0.047331,-0.43814 -0.1766022,-0.71731 -0.2209217,-0.27871 -0.6696527,-0.3473 -0.4456794,-0.0684 -0.7217128,0.13462 -0.2729845,0.20322 -0.3203148,0.64135 -0.047093,0.43594 0.1738294,0.71464 0.2239325,0.27918 0.6696498,0.34733 0.4486948,0.0688 0.7217141,-0.13463 0.2759955,-0.20276 0.3230892,-0.6387 z m 0.4514319,1.03543 q -0.067682,0.62652 -0.4830488,0.87254 -0.4156064,0.24822 -1.20465,0.12762 -0.2921873,-0.0442 -0.5475811,-0.11706 -0.2556757,-0.0703 -0.4925219,-0.1733 l 0.04236,-0.39212 q 0.2335303,0.13366 0.4664762,0.21604 0.2329446,0.0824 0.479905,0.12008 0.5451752,0.0828 0.8386306,-0.0834 0.2932897,-0.16448 0.3384895,-0.58289 l 0.021539,-0.19937 q -0.1950898,0.19063 -0.4747191,0.25699 -0.2796264,0.0663 -0.6530776,0.009 -0.6204135,-0.0947 -0.9627019,-0.49677 -0.342309,-0.40193 -0.2810175,-0.9693 0.061528,-0.56955 0.4781454,-0.85548 0.4166184,-0.28594 1.0370098,-0.1911 0.3734564,0.057 0.629875,0.20542 0.2564397,0.1483 0.4046721,0.39142 l 0.040229,-0.3724 0.554221,0.0841 z"
- style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.01535606px;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.28412068"
+ d="m 1.0169714,200.13205 c 0.056751,-0.34063 0.2810694,-0.60434 0.1480886,-0.82731 -0.1310016,-0.22255 -0.3438816,-0.36578 -0.63863467,-0.42977 -0.29274065,-0.0637 -0.53679424,-0.02 -0.73226804,0.13223 -0.19342717,0.15214 -0.51573799,-0.0313 -0.57248847,0.30934 -0.0564658,0.33891 0.17802723,1.0494 0.30903,1.27194 0.13298014,0.22296 0.34585666,0.36624 0.63863003,0.42979 0.29471741,0.0641 0.5388056,0.0201 0.73227016,-0.13223 0.19540289,-0.15169 0.0589067,-0.41508 0.11537239,-0.75399 z m 0.6237025,1.24525 c -0.081152,0.48709 -0.2670645,0.82171 -0.5577358,1.00389 -0.29095744,0.1839 -0.69558393,0.21961 -1.21387823,0.10709 -0.1919479,-0.0413 -1.05380917,-0.0321 -1.21961417,-0.095 -0.1661487,-0.0607 -3.7530647,-0.19203 -3.0671636,-0.39531 l 1.039839,-0.20745 c 0.1477474,0.10977 2.6064637,0.0637 2.756783,0.13341 0.15032038,0.0696 0.0441509,0.1041 0.20637642,0.1392 0.35813072,0.0774 0.63965677,0.0547 0.84459073,-0.0683 0.20471291,-0.1215 0.33416337,-0.3448 0.38835907,-0.67008 l 0.30117048,-0.21442 c -0.14084807,0.14409 -0.30625434,0.23879 -0.49621888,0.28403 -0.18996065,0.0452 -0.40758738,0.0411 -0.65284226,-0.0128 -0.40754193,-0.0882 -0.71364321,-0.2933 -0.91832791,-0.61489 -0.20470715,-0.32147 -0.27031525,-0.70275 -0.19682535,-1.14384 0.073773,-0.44279 0.25756117,-0.77083 0.55136482,-0.98411 0.29380546,-0.21329 0.64446305,-0.2757 1.05197434,-0.18726 0.24531879,0.0531 0.44904479,0.14062 0.61117904,0.26239 0.1621593,0.12167 0.2855723,0.27902 0.3702384,0.4721 l 0.072353,-0.43427 0.5461283,0.11776 z"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.01535606px;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.30748096"
id="path1679"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="scccscccsccccccccccccccsccccccc" />
</g>
<g
id="g9547"
diff --git a/src/Computerscare.hpp b/src/Computerscare.hpp
@@ -208,14 +208,13 @@ struct SmallLetterDisplay : TransparentWidget {
bool doubleblink = false;
SmallLetterDisplay() {
- //APP->window->loadFont()
font = APP->window->loadFont(asset::plugin(pluginInstance,defaultFontPath));
};
SmallLetterDisplay(std::string fontPath) {
font = APP->window->loadFont(asset::plugin(pluginInstance,fontPath));
};
- void draw(const DrawContext &ctx) override
+ void draw(const DrawArgs &ctx) override
{
// Background
NVGcolor backgroundColor = COLOR_COMPUTERSCARE_RED;
diff --git a/src/ComputerscareDebug.cpp b/src/ComputerscareDebug.cpp
@@ -7,12 +7,15 @@
#include <iomanip>
#define NUM_LINES 16
+struct ComputerscareDebug;
+
struct ComputerscareDebug : Module {
enum ParamIds {
- PITCH_PARAM,
MANUAL_TRIGGER,
MANUAL_CLEAR_TRIGGER,
+ CHANNEL_FOCUS,
+ SWITCH_VIEW,
NUM_PARAMS
};
enum InputIds {
@@ -22,7 +25,7 @@ struct ComputerscareDebug : Module {
NUM_INPUTS
};
enum OutputIds {
- SINE_OUTPUT,
+ POLY_OUTPUT,
NUM_OUTPUTS
};
enum LightIds {
@@ -37,15 +40,23 @@ struct ComputerscareDebug : Module {
int lineCounter = 0;
+ int inputChannel = 0;
+
dsp::SchmittTrigger clockTrigger;
dsp::SchmittTrigger clearTrigger;
dsp::SchmittTrigger manualClockTrigger;
dsp::SchmittTrigger manualClearTrigger;
+ //StringDisplayWidget3* textDisplay;
+
ComputerscareDebug() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
- params[MANUAL_TRIGGER].config(0.0f, 1.0f, 0.0f);
+ params[MANUAL_TRIGGER].config(0.0f, 1.0f, 0.0f);
params[MANUAL_CLEAR_TRIGGER].config(0.0f, 1.0f, 0.0f);
+ params[SWITCH_VIEW].config(0.0f, 1.0f, 0.0f);
+ params[CHANNEL_FOCUS].config(0.f,15.f,0.f);
+ outputs[POLY_OUTPUT].setChannels(16);
+
}
void step() override;
@@ -53,27 +64,35 @@ struct ComputerscareDebug : Module {
// - toJson, fromJson: serialization of internal data
// - onSampleRateChange: event triggered by a change of sample rate
// - onReset, onRandomize, onCreate, onDelete: implements special behavior when user clicks these from the context menu
-};
+
+};
+
void ComputerscareDebug::step() {
std::string thisVal;
- if (clockTrigger.process(inputs[TRG_INPUT].value / 2.f) || manualClockTrigger.process(params[MANUAL_TRIGGER].value)) {
+ if (clockTrigger.process(inputs[TRG_INPUT].getVoltage() / 2.f) || manualClockTrigger.process(params[MANUAL_TRIGGER].value)) {
for( unsigned int a = NUM_LINES-1; a > 0; a = a - 1 )
{
logLines[a] = logLines[a-1];
}
- logLines[0] = inputs[VAL_INPUT].value;
-
- thisVal = std::to_string(logLines[0]).substr(0,10);
- for( unsigned int a = 1; a < NUM_LINES; a = a + 1 )
+ inputChannel = floor(params[CHANNEL_FOCUS].value);
+ logLines[0] = inputs[VAL_INPUT].getVoltage(inputChannel);
+
+ //thisVal = std::to_string(logLines[0]).substr(0,10);
+ //outputs[POLY_OUTPUT].setVoltage(logLines[0],0);
+
+ thisVal = "";
+ for( unsigned int a = 0; a < NUM_LINES; a = a + 1 )
{
- thisVal = thisVal + "\n" + std::to_string(logLines[a]).substr(0,10);
+ thisVal += a > 0 ? "\n" : "";
+ thisVal+=logLines[a] >=0 ? "+" : "";
+ thisVal+= std::to_string(logLines[a]).substr(0,10);
+ outputs[POLY_OUTPUT].setVoltage(logLines[a],a);
}
-
strValue = thisVal;
}
- if(clearTrigger.process(inputs[CLR_INPUT].value / 2.f) || manualClearTrigger.process(params[MANUAL_CLEAR_TRIGGER].value)) {
+ if(clearTrigger.process(inputs[CLR_INPUT].getVoltage() / 2.f) || manualClearTrigger.process(params[MANUAL_CLEAR_TRIGGER].value)) {
for( unsigned int a = 0; a < NUM_LINES; a++ )
{
logLines[a] = 0;
@@ -83,48 +102,46 @@ void ComputerscareDebug::step() {
}
-
////////////////////////////////////
-struct StringDisplayWidget3 : TransparentWidget {
+struct StringDisplayWidget3 : Widget {
- std::string *value;
+ std::string value;
std::shared_ptr<Font> font;
+ ComputerscareDebug *module;
StringDisplayWidget3() {
font = APP->window->loadFont(asset::plugin(pluginInstance, "res/Oswald-Regular.ttf"));
};
- void draw(NVGcontext *vg) override
+ void draw(const DrawArgs &ctx) override
{
// Background
NVGcolor backgroundColor = nvgRGB(0x10, 0x00, 0x10);
NVGcolor StrokeColor = nvgRGB(0xC0, 0xC7, 0xDE);
- nvgBeginPath(vg);
- nvgRoundedRect(vg, -1.0, -1.0, box.size.x+2, box.size.y+2, 4.0);
- nvgFillColor(vg, StrokeColor);
- nvgFill(vg);
- nvgBeginPath(vg);
- nvgRoundedRect(vg, 0.0, 0.0, box.size.x, box.size.y, 4.0);
- nvgFillColor(vg, backgroundColor);
- nvgFill(vg);
-
- // text
- nvgFontSize(vg, 15);
- nvgFontFaceId(vg, font->handle);
- nvgTextLetterSpacing(vg, 2.5);
+ nvgBeginPath(ctx.vg);
+ nvgRoundedRect(ctx.vg, -1.0, -1.0, box.size.x+2, box.size.y+2, 4.0);
+ nvgFillColor(ctx.vg, StrokeColor);
+ nvgFill(ctx.vg);
+ nvgBeginPath(ctx.vg);
+ nvgRoundedRect(ctx.vg, 0.0, 0.0, box.size.x, box.size.y, 4.0);
+ nvgFillColor(ctx.vg, backgroundColor);
+ nvgFill(ctx.vg);
- std::stringstream to_display;
- to_display << std::setw(8) << *value;
+
+ nvgFontSize(ctx.vg, 15);
+ nvgFontFaceId(ctx.vg, font->handle);
+ nvgTextLetterSpacing(ctx.vg, 2.5);
+ std::string textToDraw = module ? module->strValue : "";
Vec textPos = Vec(6.0f, 12.0f);
NVGcolor textColor = nvgRGB(0xC0, 0xE7, 0xDE);
- nvgFillColor(vg, textColor);
- nvgTextBox(vg, textPos.x, textPos.y,80,to_display.str().c_str(), NULL);
+ nvgFillColor(ctx.vg, textColor);
+
+ nvgTextBox(ctx.vg, textPos.x, textPos.y,80,textToDraw.c_str(), NULL);
}
};
-
struct ComputerscareDebugWidget : ModuleWidget {
ComputerscareDebugWidget(ComputerscareDebug *module) {
@@ -137,18 +154,20 @@ struct ComputerscareDebugWidget : ModuleWidget {
addParam(createParam<LEDButton>(Vec(6, 290), module, ComputerscareDebug::MANUAL_TRIGGER));
addParam(createParam<LEDButton>(Vec(66, 290), module, ComputerscareDebug::MANUAL_CLEAR_TRIGGER));
+
+ addParam(createParam<MediumSnapKnob>(Vec(36,290),module,ComputerscareDebug::CHANNEL_FOCUS));
+
+ //addParam(createParam<IsoButton>(Vec(20,280),module,ComputerscareDebug::SWITCH_VIEW));
+
+
+ addOutput(createOutput<OutPort>(Vec(57, 1), module, ComputerscareDebug::POLY_OUTPUT));
+ StringDisplayWidget3 *stringDisplay = createWidget<StringDisplayWidget3>(Vec(1,34));
+ stringDisplay->box.size = Vec(88, 250);
+ stringDisplay->module = module;
+ addChild(stringDisplay);
- StringDisplayWidget3 *display = new StringDisplayWidget3();
- display->box.pos = Vec(1,24);
- display->box.size = Vec(88, 250);
- display->value = &module->strValue;
- addChild(display);
}
};
-// Specify the Module and ModuleWidget subclass, human-readable
-// author name for categorization per plugin, module slug (should never
-// change), human-readable module name, and any number of tags
-// (found in `include/tags.hpp`) separated by commas.
Model *modelComputerscareDebug = createModel<ComputerscareDebug, ComputerscareDebugWidget>("Debug");
diff --git a/src/ComputerscareIso.cpp b/src/ComputerscareIso.cpp
@@ -62,7 +62,7 @@ struct ComputerscareIsoWidget : ModuleWidget {
//setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ComputerscareIsoPanel.svg")));
float outputY = 334;
- box.size = Vec(150, 380);
+ box.size = Vec(15*10, 380);
{
ComputerscareSVGPanel *panel = new ComputerscareSVGPanel();
panel->box.size = box.size;
@@ -105,46 +105,34 @@ struct ComputerscareIsoWidget : ModuleWidget {
void addLabeledKnob(std::string label,int x, int y, ComputerscareIso *module,int index,int type) {
float ru = random::uniform();
- smallLetterDisplay = new SmallLetterDisplay();
+ smallLetterDisplay = new SmallLetterDisplay();
smallLetterDisplay->box.size = Vec(60, 30);
smallLetterDisplay->value = label;
if(type == 0) {
- addParam(createParam<SmoothKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
- smallLetterDisplay->box.pos = Vec(x+22,y+2);
-
+ addParam(createParam<SmoothKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
+ smallLetterDisplay->box.pos = Vec(x+22,y+2);
}
else if(type ==1) {
- addParam(createParam<SmallKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
- smallLetterDisplay->box.pos = Vec(x+12,y-10);
-
-
+ addParam(createParam<SmallKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
+ smallLetterDisplay->box.pos = Vec(x+12,y-10);
}
else if(type==2) {
- addParam(createParam<BigSmoothKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
- smallLetterDisplay->box.pos = Vec(x+22,y-12);
-
-
+ addParam(createParam<BigSmoothKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
+ smallLetterDisplay->box.pos = Vec(x+22,y-12);
}
else if (type==3) {
addParam(createParam<LrgKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
- smallLetterDisplay->box.pos = Vec(x+22,y-12);
-
+ smallLetterDisplay->box.pos = Vec(x+22,y-12);
}
else if (type==4) {
addParam(createParam<BigSmoothKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
- smallLetterDisplay->box.pos = Vec(x+22,y-12);
-
+ smallLetterDisplay->box.pos = Vec(x+22,y-12);
}
-
else {
- addParam(createParam<MediumSnapKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
- smallLetterDisplay->box.pos = Vec(x+12,y-10);
-
-
+ addParam(createParam<MediumSnapKnob>(Vec(x,y),module,ComputerscareIso::KNOB+index));
+ smallLetterDisplay->box.pos = Vec(x+12,y-10);
}
-
- //smallLetterDisplay->baseColor = COLOR_COMPUTERSCARE_TRANSPARENT;
addChild(smallLetterDisplay);
}
diff --git a/src/ComputerscareSVGPanel.cpp b/src/ComputerscareSVGPanel.cpp
@@ -5,7 +5,7 @@ namespace rack {
namespace app {
-void PanelBorder::draw(const widget::DrawContext &ctx) {
+void PanelBorder::draw(const DrawArgs &ctx) {
NVGcolor borderColor = nvgRGBAf(0.5, 0.5, 0.5, 0.5);
nvgBeginPath(ctx.vg);
nvgRect(ctx.vg, 0.5, 0.5, box.size.x - 1.0, box.size.y - 1.0);