computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 69857895f40df5831d17606174ae99899257a985
parent 40df24522e6bb668f198afd4607bb5083be0f67a
Author: Adam M <[email protected]>
Date:   Tue, 30 Jul 2019 21:30:37 -0500

Load legacy patches for cookies, peas, and laundry.  Fix cookies wiggle knobs

Diffstat:
Mplugin.json | 6+++---
Msrc/ComputerscareILoveCookies.cpp | 36++++++++++++++++++++++++++----------
Msrc/ComputerscareLaundrySoup.cpp | 16++++++++++++++++
Msrc/ComputerscareOhPeas.cpp | 19+++++++++++++++++--
4 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/plugin.json b/plugin.json @@ -1,5 +1,6 @@ { "slug": "computerscare", + "version": "1.0.1", "name": "computerscare", "brand": "computerscare", "author": "computerscare", @@ -8,7 +9,7 @@ "pluginUrl": "https://github.com/freddyz/computerscare-vcv-modules", "authorUrl": "https://github.com/freddyz/computerscare-vcv-modules", "sourceUrl": "https://github.com/freddyz/computerscare-vcv-modules", - "version": "1.0.0", + "manualUrl": "https://github.com/freddyz/computerscare-vcv-modules", "modules": [ {"slug":"computerscare-knolypobs", "name":"Knoly Pobs", @@ -46,8 +47,7 @@ "name":"I Love Cookies", "description":"Text-based CV and signal sequencer", "tags":["Sequencer","Utility","Random"] - } - , + }, {"slug":"computerscare-roly-pouter", "name":"Roly Pouter", diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp @@ -156,14 +156,14 @@ struct ComputerscareILoveCookies : Module { } void wiggleKnobs() { - /*for (int i = 0; i < numKnobs; i++) { + for (int i = 0; i < numKnobs; i++) { float prev = params[KNOB_PARAM + i].getValue(); if (random::uniform() < 0.7) { float rv = (10 * random::uniform() + 2 * prev) / 3; - this->smallLetterKnobs[i]->setValue(rv); - params[KNOB_PARAM + i].getValue() = rv; + params[KNOB_PARAM+i].setValue(rv); } - }*/ + } + } void randomizeTextFields() { std::string mainlookup = knoblookup; @@ -475,7 +475,7 @@ struct CookiesCurrentStepDisplay : SmallLetterDisplay //this->setNumDivisionsString(); if (module) { - //this->currentWorkingStepDisplays[i]->value = this->newABS[i].getWorkingStepDisplay(); + //this->currentWorkingStepDisplays[i]->value = this->newABS[i].getWorkingStepDisplay(); value = module->newABS[index].getWorkingStepDisplay(); @@ -577,17 +577,17 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget { //individual reset input addInput(createInput<InPort>(mm2px(Vec(12 + xStart, verticalStart + verticalSpacing * i - 10)), module, ComputerscareILoveCookies::RESET_INPUT + i)); - + //sequence input field textField = new CookiesTF2(i); textField->box.pos = mm2px(Vec(1 + xStart, verticalStart + verticalSpacing * i)); - textField->box.size = mm2px(Vec(63, 7)); + textField->box.size = mm2px(Vec(63, 7)); textField->multiline = false; textField->color = nvgRGB(0xC0, 0xE7, 0xDE); textField->module = module; addChild(textField); cookiesTextFields[i] = textField; - //module->textFields[i] = textField; + //module->textFields[i] = textField; //active/total steps display cookiesSmallDisplay = new CookiesSmallDisplay(i); @@ -609,7 +609,7 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget { addChild(currentWorkingStepDisplay); currentWorkingStepDisplays[i] = currentWorkingStepDisplay; - // module->currentWorkingStepDisplays[i] = currentWorkingStepDisplay; + // module->currentWorkingStepDisplays[i] = currentWorkingStepDisplay; addParam(createParam<ComputerscareInvisibleButton>(mm2px(Vec(21 + xStart, verticalStart - 9.9 + verticalSpacing * i)), module, ComputerscareILoveCookies::INDIVIDUAL_RESET_PARAM + i)); } @@ -642,6 +642,22 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget { cookies->currentFormula[i] = val; } } + else { + json_t *textJLegacy = json_object_get(rootJ, "data"); + if (textJLegacy) { + json_t *seqJLegacy = json_object_get(textJLegacy, "sequences"); + + if (seqJLegacy) { + for (int i = 0; i < numFields; i++) { + json_t *sequenceJ = json_array_get(seqJLegacy, i); + if (sequenceJ) + val = json_string_value(sequenceJ); + cookiesTextFields[i]->text = val; + cookies->currentFormula[i] = val; + } + } + } + } } ComputerscareILoveCookies *cookies; @@ -655,7 +671,7 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget { CookiesSmallDisplay* cookiesSmallDisplays[numFields]; SmallLetterDisplay* smallLetterDisplay; - + CookiesCurrentStepDisplay* currentWorkingStepDisplay; CookiesCurrentStepDisplay* currentWorkingStepDisplays[numFields]; diff --git a/src/ComputerscareLaundrySoup.cpp b/src/ComputerscareLaundrySoup.cpp @@ -423,6 +423,22 @@ struct ComputerscareLaundrySoupWidget : ModuleWidget { laundry->currentFormula[i] = val; } } + else { + json_t *textJLegacy = json_object_get(rootJ, "data"); + if (textJLegacy) { + json_t *seqJLegacy = json_object_get(textJLegacy, "sequences"); + + if (seqJLegacy) { + for (int i = 0; i < numFields; i++) { + json_t *sequenceJ = json_array_get(seqJLegacy, i); + if (sequenceJ) + val = json_string_value(sequenceJ); + laundryTextFields[i]->text = val; + laundry->currentFormula[i] = val; + } + } + } + } } ComputerscareLaundrySoup *laundry; diff --git a/src/ComputerscareOhPeas.cpp b/src/ComputerscareOhPeas.cpp @@ -427,14 +427,29 @@ struct ComputerscareOhPeasWidget : ModuleWidget void fromJson(json_t *rootJ) override { + std::string val; ModuleWidget::fromJson(rootJ); // text + json_t *textJ = json_object_get(rootJ, "sequences"); if (textJ) textFieldTemp->text = json_string_value(textJ); - - //module->setQuant(); + + json_t *textJLegacy = json_object_get(rootJ, "data"); + if (textJLegacy) { + json_t *seqJLegacy = json_object_get(textJLegacy, "sequences"); + + if (seqJLegacy) { + json_t *theSequence = json_array_get(seqJLegacy, 0); + if (theSequence) { + val = json_string_value(theSequence); + printf("yep there is json from Rack 0.6 %s\n", val.c_str()); + textFieldTemp->text = val; + + } + } + } }