computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 61f0c41f773dfaf4cf2ad48969241fa7955e8ec0
parent 79bddf055b98bac0622fe49273336eae6d492f8c
Author: Adam M <aemalone@gmail.com>
Date:   Sat, 28 Mar 2020 23:09:01 -0500

Debug use better jsonz

Diffstat:
Msrc/ComputerscareDebug.cpp | 41+++++++++++++++++++++++++++++++++++++++--
Msrc/ComputerscareOhPeas.cpp | 5+++--
2 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/src/ComputerscareDebug.cpp b/src/ComputerscareDebug.cpp @@ -97,6 +97,40 @@ struct ComputerscareDebug : Module { } void process(const ProcessArgs &args) override; + + json_t *dataToJson() override { + json_t *rootJ = json_object(); + + json_object_set_new(rootJ, "outputRange", json_integer(outputRangeEnum)); + + json_t *sequencesJ = json_array(); + + for (int i = 0; i < 16; i++) { + json_t *sequenceJ = json_real(logLines[i]); + json_array_append_new(sequencesJ, sequenceJ); + } + json_object_set_new(rootJ, "lines", sequencesJ); + return rootJ; + } + + void dataFromJson(json_t *rootJ) override { + float val; + + json_t *outputRangeEnumJ = json_object_get(rootJ, "outputRange"); + if (outputRangeEnumJ) { outputRangeEnum = json_integer_value(outputRangeEnumJ); } + + json_t *sequencesJ = json_object_get(rootJ, "lines"); + + if (sequencesJ) { + for (int i = 0; i < 16; i++) { + json_t *sequenceJ = json_array_get(sequencesJ, i); + if (sequenceJ) + val = json_real_value(sequenceJ); + logLines[i] = val; + } + } + + } // For more advanced Module features, read Rack's engine.hpp header file // - toJson, fromJson: serialization of internal data // - onSampleRateChange: event triggered by a change of sample rate @@ -187,6 +221,9 @@ void ComputerscareDebug::process(const ProcessArgs &args) { strValue = defaultStrValue; } outputs[POLY_OUTPUT].setChannels(16); + /*for(unsigned int i=0; i < NUM_LINES;i++) { + outputs[POLY_OUTPUT].setVoltage(logLines[i], i); + }*/ stepCounter++; if (stepCounter > 1025) { @@ -338,7 +375,7 @@ struct ComputerscareDebugWidget : ModuleWidget { debug = module; } - json_t *toJson() override + /*json_t *toJson() override { json_t *rootJ = ModuleWidget::toJson(); json_object_set_new(rootJ, "outputRange", json_integer(debug->outputRangeEnum)); @@ -351,7 +388,7 @@ struct ComputerscareDebugWidget : ModuleWidget { } json_object_set_new(rootJ, "lines", sequencesJ); return rootJ; - } + }*/ void fromJson(json_t *rootJ) override { float val; diff --git a/src/ComputerscareOhPeas.cpp b/src/ComputerscareOhPeas.cpp @@ -83,8 +83,6 @@ struct ComputerscareOhPeas : Module } - //quant = Quantizer(currentFormula, 12, 0); - } void process(const ProcessArgs &args) override; @@ -233,6 +231,9 @@ struct PeasTF2 : ComputerscareTextField module->currentFormula = text.c_str(); } } + else { + text="2212221"; + } ComputerscareTextField::draw(args); }