commit 20de0fe4b587b184afc26f3ce6caf81a7d62224f
parent 6b1519c38b5c8a48e138ba02defaaa4b8528e46e
Author: Adam M <aemalone@gmail.com>
Date: Tue, 23 Jul 2019 16:42:23 -0500
Fix range selections for debug, puttons
Diffstat:
3 files changed, 111 insertions(+), 38 deletions(-)
diff --git a/res/ComputerscareSolyPequencerPanel.svg b/res/ComputerscareSolyPequencerPanel.svg
@@ -28,7 +28,7 @@
inkscape:pageshadow="2"
inkscape:zoom="7.9999999"
inkscape:cx="50.536891"
- inkscape:cy="133.17232"
+ inkscape:cy="163.17232"
inkscape:document-units="mm"
inkscape:current-layer="g1669"
showgrid="false"
@@ -416,28 +416,31 @@
id="path891"
inkscape:connector-curvature="0" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 2.621624,252.55505 c -0.065409,0.47474 -0.022356,1.33557 0.6400775,1.47216 0.162629,-0.20355 0.1130047,-0.90165 0.5104206,-0.40316 0.1702045,0.28356 0.9320486,0.63113 0.7615895,0.0439 -0.063023,-0.46165 -0.4395936,-0.85648 -0.5454651,-1.3101"
+ style="fill:none;stroke:#000000;stroke-width:0.38060996px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 2.6380907,250.95349 c -0.064993,0.74381 -0.022214,2.09254 0.6360114,2.30655 0.1615959,-0.31892 0.1122869,-1.41269 0.5071782,-0.63167 0.1691233,0.44428 0.9261278,0.98885 0.7567515,0.0688 -0.062623,-0.72331 -0.4368011,-1.34192 -0.542,-2.05264"
id="path933"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 5.3989459,252.06034 c 0.152493,0.49868 -0.2688132,1.16754 0.1615141,1.56479 0.25561,-0.16213 0.4569186,-0.21879 0.3927241,0.0999 0.022162,0.24743 -0.010504,0.49585 0.01886,0.74306"
+ style="fill:none;stroke:#000000;stroke-width:0.38060996px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 5.3977697,250.17838 c 0.1515243,0.78133 -0.4324702,2.72225 -0.00488,3.34466 0.2539862,-0.25403 0.6193806,-1.23577 0.5555939,-0.73645 0.022021,0.38767 -0.010437,0.77689 0.01874,1.16421"
id="path935"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccc" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 7.4268317,253.44551 c -0.6857631,-0.36163 -0.9347316,0.62862 -0.3223544,0.77766 0.3479304,-0.0347 0.1983259,-0.94541 0.5891504,-0.45478 0.081982,0.1476 0.1544488,0.30645 0.1299677,0.46874"
+ style="fill:none;stroke:#000000;stroke-width:0.38060996px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 7.4127734,252.34864 c -0.6814068,-0.56659 -0.9287937,0.98491 -0.3203067,1.21842 0.3457202,-0.0544 0.1970661,-1.48125 0.5854079,-0.71254 0.081461,0.23126 0.1534676,0.48014 0.129142,0.73442"
id="path937"
- inkscape:connector-curvature="0" />
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 8.925704,251.99439 c 0.011876,0.75986 -0.082318,1.51742 -0.1322538,2.27566"
+ d="m 8.925704,251.46522 c 0.011876,0.75986 -0.082318,1.51742 -0.1322538,2.27566"
id="path939"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 8.1321834,252.85187 c 0.5736132,-0.0234 1.1460005,0.03 1.7192965,0.033"
+ d="m 8.1321834,252.3227 c 0.5736132,-0.0234 1.1460005,0.03 1.7192965,0.033"
id="path941"
inkscape:connector-curvature="0" />
<path
@@ -467,75 +470,75 @@
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 5.2666927,255.49029 c -6e-5,0.41771 9.08e-5,0.83541 0,1.25311"
+ d="m 3.8445573,255.09341 c -6e-5,0.41771 9.08e-5,0.83541 0,1.25311"
id="path953"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 4.9734244,255.13919 c 0.1585893,0.0781 0.2775687,-0.16985 0.4255221,-0.14362"
+ d="m 3.551289,254.74231 c 0.1585893,0.0781 0.2775687,-0.16985 0.4255221,-0.14362"
id="path957"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 6.3688046,254.7977 c 0.2229155,0.54551 -0.3395449,1.16102 0.135265,1.6646 0.1039566,0.088 0.246037,0.146 0.3937594,0.1821"
+ d="m 4.9466692,254.40082 c 0.2229155,0.54551 -0.3395449,1.16102 0.135265,1.6646 0.1039566,0.088 0.246037,0.146 0.3937594,0.1821"
id="path959"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 5.9279598,255.55625 c 0.4555396,0 0.9110791,0 1.3666187,0"
+ d="m 4.5058244,255.15937 c 0.4555396,0 0.9110791,0 1.3666187,0"
id="path961"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.30504221px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 8.7052817,255.65519 c -0.7959951,-0.25723 -0.7158936,0.5229 -0.5494473,0.85345 -0.1138271,0.16086 -0.4090092,0.09 -0.5967554,0.07"
+ d="m 7.2831463,255.25831 c -0.7959951,-0.25723 -0.7158936,0.5229 -0.5494473,0.85345 -0.1138271,0.16086 -0.4090092,0.09 -0.5967554,0.07"
id="path963"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.44280794px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 10.757822,255.24076 c -1.1291446,-0.33089 -0.534985,1.70389 0.128701,0.93518 0.07346,-0.31357 0.0115,-0.64403 -0.128701,-0.93518 z"
+ d="m 9.3356866,254.84388 c -1.1291446,-0.33089 -0.534985,1.70389 0.128701,0.93518 0.07346,-0.31357 0.0115,-0.64403 -0.128701,-0.93518 z"
id="path965"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.42866045px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 11.845576,255.02273 c -0.217659,0.28593 -0.212537,2.38973 0.361024,0.54333 0.636876,-0.50558 0.840328,1.00834 0.292072,1.24519"
+ d="m 10.423441,254.62585 c -0.217659,0.28593 -0.212537,2.38973 0.361024,0.54333 0.636876,-0.50558 0.840328,1.00834 0.292072,1.24519"
id="path967"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.45176771px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="m 2.8905938,257.7988 c 0,0.60557 0,1.21115 0,1.81672"
+ style="fill:none;stroke:#585858;stroke-width:0.45176771px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 2.8905938,257.26963 c 0,0.60557 0,1.21115 0,1.81672"
id="path969"
inkscape:connector-curvature="0" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.27024093px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:none;stroke:#585858;stroke-width:0.27024093px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 4.1246763,258.09747 c 0.3897109,-10e-6 0.7794214,-10e-6 1.169132,0"
id="path971"
inkscape:connector-curvature="0" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.252;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
- d="m 7.5447786,257.87132 c -0.9654836,-0.17879 -1.2100077,0.47158 -0.5515295,0.73354 0.4462201,0.16845 1.0804473,0.82094 0.00939,0.63895 -0.946081,-0.31247 0.09619,-0.7317 0.6546603,-0.93264 0.2439913,-0.13505 0.2083943,-0.34833 -0.1125159,-0.43985 z"
+ style="fill:none;stroke:#585858;stroke-width:0.252;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 7.5447786,257.34215 c -0.9654836,-0.17879 -1.2100077,0.47158 -0.5515295,0.73354 0.4462201,0.16845 1.0804473,0.82094 0.00939,0.63895 -0.946081,-0.31247 0.09619,-0.7317 0.6546603,-0.93264 0.2439913,-0.13505 0.2083943,-0.34833 -0.1125159,-0.43985 z"
id="path973"
inkscape:connector-curvature="0" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.29085138px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:none;stroke:#585858;stroke-width:0.29085138px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 10.381016,257.46129 c -0.30176,-0.85354 -1.2367587,1.982 0.234546,0.57278 -0.6846658,-1.41323 0.535507,0.39935 0.473859,0.55274 0.155046,0.3485 -0.24995,0.66457 -0.763448,0.50445"
id="path977"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.24730319px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:none;stroke:#585858;stroke-width:0.24730319px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 11.94493,258.19202 c 0.285628,0 0.571257,0 0.856884,0"
id="path979"
inkscape:connector-curvature="0" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.34039551px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:none;stroke:#585858;stroke-width:0.34039551px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 13.418529,256.40315 c -0.05385,0.58148 0.110282,1.94477 -0.08702,2.51206"
id="path981"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
- style="fill:none;stroke:#000000;stroke-width:0.34039551px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ style="fill:none;stroke:#585858;stroke-width:0.34039551px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 15.071771,257.20914 c -0.65677,-0.19168 -1.043095,0.57137 -0.936417,1.10001 -0.18685,0.73063 1.035432,1.0452 1.012765,0.25482 -0.203001,-0.28931 -0.587313,-0.44638 -0.946448,-0.39759"
id="path983"
inkscape:connector-curvature="0" />
diff --git a/src/ComputerscareBolyPuttons.cpp b/src/ComputerscareBolyPuttons.cpp
@@ -8,7 +8,7 @@ struct ComputerscareBolyPuttons : Module {
int counter = 0;
int outputRangeEnum = 0;
bool momentary = false;
- float outputRanges[4][2];
+ float outputRanges[6][2];
rack::dsp::SchmittTrigger momentaryTriggers[16];
rack::dsp::PulseGenerator pulseGen[16];
diff --git a/src/ComputerscareDebug.cpp b/src/ComputerscareDebug.cpp
@@ -49,7 +49,12 @@ struct ComputerscareDebug : Module {
int clockMode = 1;
int inputMode = 2;
- int stepCounter = 0;
+ int outputRangeEnum = 0;
+
+
+ float outputRanges[6][2];
+
+ int stepCounter;
dsp::SchmittTrigger clockTriggers[NUM_LINES];
dsp::SchmittTrigger clearTrigger;
dsp::SchmittTrigger manualClockTrigger;
@@ -70,6 +75,22 @@ struct ComputerscareDebug : Module {
configParam(CLOCK_CHANNEL_FOCUS, 0.f, 15.f, 0.f, "Clock Channel Selector");
configParam(INPUT_CHANNEL_FOCUS, 0.f, 15.f, 0.f, "Input Channel Selector");
+
+ outputRanges[0][0] = 0.f;
+ outputRanges[0][1] = 10.f;
+ outputRanges[1][0] = -5.f;
+ outputRanges[1][1] = 5.f;
+ outputRanges[2][0] = 0.f;
+ outputRanges[2][1] = 5.f;
+ outputRanges[3][0] = 0.f;
+ outputRanges[3][1] = 1.f;
+ outputRanges[4][0] = -1.f;
+ outputRanges[4][1] = 1.f;
+ outputRanges[5][0] = -10.f;
+ outputRanges[5][1] = 10.f;
+
+ stepCounter=0;
+
//params[MANUAL_TRIGGER].randomizable=false;
//params[MANUAL_CLEAR_TRIGGER].randomizable=false;
@@ -81,8 +102,6 @@ struct ComputerscareDebug : Module {
// - 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::process(const ProcessArgs &args) {
@@ -94,6 +113,10 @@ void ComputerscareDebug::process(const ProcessArgs &args) {
inputChannel = floor(params[INPUT_CHANNEL_FOCUS].getValue());
clockChannel = floor(params[CLOCK_CHANNEL_FOCUS].getValue());
+
+ float min = outputRanges[outputRangeEnum][0];
+ float max = outputRanges[outputRangeEnum][1];
+ float spread = max - min;
if (clockMode == SINGLE_MODE) {
if (clockTriggers[clockChannel].process(inputs[TRG_INPUT].getVoltage(clockChannel) / 2.f) || manualClockTrigger.process(params[MANUAL_TRIGGER].getValue()) ) {
if (inputMode == POLY_MODE) {
@@ -111,8 +134,9 @@ void ComputerscareDebug::process(const ProcessArgs &args) {
logLines[0] = inputs[VAL_INPUT].getVoltage(inputChannel);
}
else if (inputMode == INTERNAL_MODE) {
+ printf("%f, %f\n",min,spread);
for (int i = 0; i < 16; i++) {
- logLines[i] = random::uniform();
+ logLines[i] = min+spread*random::uniform();
}
}
}
@@ -128,7 +152,7 @@ void ComputerscareDebug::process(const ProcessArgs &args) {
}
else if (inputMode == INTERNAL_MODE) {
for (int i = 0; i < 16; i++) {
- logLines[i] = random::uniform();
+ logLines[i] = min+spread*random::uniform();
}
}
}
@@ -150,7 +174,7 @@ void ComputerscareDebug::process(const ProcessArgs &args) {
else if (inputMode == INTERNAL_MODE) {
for (int i = 0; i < 16; i++) {
if (clockTriggers[i].process(inputs[TRG_INPUT].getVoltage(i) / 2.f) || manualClockTrigger.process(params[MANUAL_TRIGGER].getValue()) ) {
- logLines[i] = random::uniform();
+ logLines[i] = min+spread*random::uniform();
}
}
}
@@ -163,13 +187,15 @@ void ComputerscareDebug::process(const ProcessArgs &args) {
}
strValue = defaultStrValue;
}
+ outputs[POLY_OUTPUT].setChannels(16);
stepCounter++;
+
if (stepCounter > 1025) {
stepCounter = 0;
thisVal = "";
for ( unsigned int a = 0; a < NUM_LINES; a = a + 1 )
- {
+ {
thisVal += a > 0 ? "\n" : "";
thisVal += logLines[a] >= 0 ? "+" : "";
thisVal += std::to_string(logLines[a]).substr(0, 10);
@@ -177,7 +203,7 @@ void ComputerscareDebug::process(const ProcessArgs &args) {
}
strValue = thisVal;
}
- outputs[POLY_OUTPUT].setChannels(16);
+
}
struct HidableSmallSnapKnob : SmallSnapKnob {
@@ -311,9 +337,53 @@ struct ComputerscareDebugWidget : ModuleWidget {
stringDisplay->module = module;
addChild(stringDisplay);
+ debug = module;
+ }
+ json_t *toJson() override
+ {
+ json_t *rootJ = ModuleWidget::toJson();
+ json_object_set_new(rootJ, "outputRange", json_integer(debug->outputRangeEnum));
+ return rootJ;
+ }
+ void fromJson(json_t *rootJ) override
+ {
+ ModuleWidget::fromJson(rootJ);
+ // button states
+
+ json_t *outputRangeEnumJ = json_object_get(rootJ, "outputRange");
+ if (outputRangeEnumJ) { debug->outputRangeEnum = json_integer_value(outputRangeEnumJ); }
}
+ void appendContextMenu(Menu *menu) override;
+ ComputerscareDebug *debug;
};
+struct DebugOutputRangeItem : MenuItem {
+ ComputerscareDebug *debug;
+ int outputRangeEnum;
+ void onAction(const event::Action &e) override {
+ debug->outputRangeEnum = outputRangeEnum;
+ printf("outputRangeEnum %i\n",outputRangeEnum);
+ }
+ void step() override {
+ rightText = CHECKMARK(debug->outputRangeEnum == outputRangeEnum);
+ MenuItem::step();
+ }
+};
+void ComputerscareDebugWidget::appendContextMenu(Menu *menu)
+{
+ ComputerscareDebug *debug = dynamic_cast<ComputerscareDebug *>(this->module);
+
+ MenuLabel *spacerLabel = new MenuLabel();
+ menu->addChild(spacerLabel);
+
+ menu->addChild(construct<MenuLabel>());
+ menu->addChild(construct<MenuLabel>(&MenuLabel::text, "Random Generator Range (Internal In)"));
+ menu->addChild(construct<DebugOutputRangeItem>(&MenuItem::text, " 0v ... +10v", &DebugOutputRangeItem::debug, debug, &DebugOutputRangeItem::outputRangeEnum, 0));
+ menu->addChild(construct<DebugOutputRangeItem>(&MenuItem::text, " -5v ... +5v", &DebugOutputRangeItem::debug, debug, &DebugOutputRangeItem::outputRangeEnum, 1));
+ menu->addChild(construct<DebugOutputRangeItem>(&MenuItem::text, " 0v ... +5v", &DebugOutputRangeItem::debug, debug, &DebugOutputRangeItem::outputRangeEnum, 2));
+ menu->addChild(construct<DebugOutputRangeItem>(&MenuItem::text, " 0v ... +1v", &DebugOutputRangeItem::debug, debug, &DebugOutputRangeItem::outputRangeEnum, 3));
+ menu->addChild(construct<DebugOutputRangeItem>(&MenuItem::text, " -1v ... +1v", &DebugOutputRangeItem::debug, debug, &DebugOutputRangeItem::outputRangeEnum, 4));
+ menu->addChild(construct<DebugOutputRangeItem>(&MenuItem::text, "-10v ... +10v", &DebugOutputRangeItem::debug, debug, &DebugOutputRangeItem::outputRangeEnum, 5));
-
+}
Model *modelComputerscareDebug = createModel<ComputerscareDebug, ComputerscareDebugWidget>("computerscare-debug");