From 6c9afbec7a1e300994dde3377dd4858326e15c1f Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 6 Nov 2019 14:53:06 -0500 Subject: [PATCH] Fix template cable IDs. --- src/app/RackWidget.cpp | 15 ++-- template.vcv | 189 ++++++++++++++++++++++------------------- 2 files changed, 109 insertions(+), 95 deletions(-) diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index 5aeda05d..5887ce7e 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -171,7 +171,8 @@ void RackWidget::mergeJson(json_t* rootJ) { // modules json_t* modulesJ = json_object_get(rootJ, "modules"); - assert(modulesJ); + if (!modulesJ) + return; size_t moduleIndex; json_t* moduleJ; json_array_foreach(modulesJ, moduleIndex, moduleJ) { @@ -182,7 +183,8 @@ void RackWidget::mergeJson(json_t* rootJ) { int id = json_integer_value(idJ); // TODO Legacy v0.6? ModuleWidget* moduleWidget = getModule(id); - assert(moduleWidget); + if (!moduleWidget) + continue; // pos math::Vec pos = moduleWidget->box.pos.minus(moduleOffset); @@ -193,7 +195,8 @@ void RackWidget::mergeJson(json_t* rootJ) { // cables json_t* cablesJ = json_object_get(rootJ, "cables"); - assert(cablesJ); + if (!cablesJ) + return; size_t cableIndex; json_t* cableJ; json_array_foreach(cablesJ, cableIndex, cableJ) { @@ -203,7 +206,8 @@ void RackWidget::mergeJson(json_t* rootJ) { continue; int id = json_integer_value(idJ); CableWidget* cw = getCable(id); - assert(cw); + if (!cw) + continue; json_t* cwJ = cw->toJson(); // Merge cable JSON object @@ -215,8 +219,7 @@ void RackWidget::mergeJson(json_t* rootJ) { void RackWidget::fromJson(json_t* rootJ) { // modules json_t* modulesJ = json_object_get(rootJ, "modules"); - if (!modulesJ) - return; + assert(modulesJ); size_t moduleIndex; json_t* moduleJ; json_array_foreach(modulesJ, moduleIndex, moduleJ) { diff --git a/template.vcv b/template.vcv index a955cbb3..9e66ef93 100644 --- a/template.vcv +++ b/template.vcv @@ -1,11 +1,14 @@ { - "version": "1.dev.82b817e", + "version": "2.dev.bfce9cc", "modules": [ { + "id": 1, "plugin": "Core", - "version": "1.0.0", + "version": "2.0.0", "model": "AudioInterface", "params": [], + "leftModuleId": 2, + "rightModuleId": 8, "data": { "audio": { "driver": 1, @@ -15,129 +18,128 @@ "blockSize": 256 } }, - "leftModuleId": 2, - "rightModuleId": 8, - "id": 1, "pos": [ 57, 0 ] }, { + "id": 2, "plugin": "Fundamental", - "version": "1.0.0", + "version": "2.0.0", "model": "VCMixer", "params": [ { - "id": 0, - "value": 1.0 + "value": 1.0, + "id": 0 }, { - "id": 1, - "value": 1.0 + "value": 1.0, + "id": 1 }, { - "id": 2, - "value": 1.0 + "value": 1.0, + "id": 2 }, { - "id": 3, - "value": 1.0 + "value": 1.0, + "id": 3 }, { - "id": 4, - "value": 1.0 + "value": 1.0, + "id": 4 } ], "leftModuleId": 7, "rightModuleId": 1, - "id": 2, "pos": [ 47, 0 ] }, { + "id": 3, "plugin": "Fundamental", - "version": "1.0.0", + "version": "2.0.0", "model": "VCO", "params": [ { - "id": 0, - "value": 1.0 + "value": 1.0, + "id": 0 }, { - "id": 1, - "value": 1.0 + "value": 1.0, + "id": 1 }, { - "id": 2, - "value": 0.0 + "value": 0.0, + "id": 2 }, { - "id": 3, - "value": 0.0 + "value": 0.0, + "id": 3 }, { - "id": 4, - "value": 0.0 + "value": 0.0, + "id": 4 }, { - "id": 5, - "value": 0.5 + "value": 0.5, + "id": 5 }, { - "id": 6, - "value": 0.0 + "value": 0.0, + "id": 6 } ], "leftModuleId": 5, "rightModuleId": 4, - "id": 3, "pos": [ 8, 0 ] }, { + "id": 4, "plugin": "Fundamental", - "version": "1.0.0", + "version": "2.0.0", "model": "VCF", "params": [ { - "id": 0, - "value": 0.0 + "value": 0.0, + "id": 0 }, { - "id": 1, - "value": 0.5 + "value": 0.5, + "id": 1 }, { - "id": 2, - "value": 0.234000027 + "value": 0.234000027, + "id": 2 }, { - "id": 3, - "value": 1.0 + "value": 1.0, + "id": 3 }, { - "id": 4, - "value": 0.0 + "value": 0.0, + "id": 4 } ], "leftModuleId": 3, "rightModuleId": 6, - "id": 4, "pos": [ 18, 0 ] }, { + "id": 5, "plugin": "Core", - "version": "1.0.0", + "version": "2.0.0", "model": "MIDIToCVInterface", "params": [], + "rightModuleId": 3, "data": { "channels": 1, "polyMode": 0, @@ -150,117 +152,118 @@ "channel": -1 } }, - "rightModuleId": 3, - "id": 5, "pos": [ 0, 0 ] }, { + "id": 6, "plugin": "Fundamental", - "version": "1.0.0", + "version": "2.0.0", "model": "ADSR", "params": [ { - "id": 0, - "value": 0.258000046 + "value": 0.258000046, + "id": 0 }, { - "id": 1, - "value": 0.743000448 + "value": 0.743000448, + "id": 1 }, { - "id": 2, - "value": 0.5 + "value": 0.5, + "id": 2 }, { - "id": 3, - "value": 0.576500058 + "value": 0.576500058, + "id": 3 } ], "leftModuleId": 4, "rightModuleId": 7, - "id": 6, "pos": [ 26, 0 ] }, { + "id": 7, "plugin": "Fundamental", - "version": "1.0.0", + "version": "2.0.0", "model": "Scope", "params": [ { - "id": 0, - "value": 0.0 + "value": 0.0, + "id": 0 }, { - "id": 1, - "value": 0.0 + "value": 0.0, + "id": 1 }, { - "id": 2, - "value": 0.0 + "value": 0.0, + "id": 2 }, { - "id": 3, - "value": 0.0 + "value": 0.0, + "id": 3 }, { - "id": 4, - "value": 14.0 + "value": 14.0, + "id": 4 }, { - "id": 5, - "value": 0.0 + "value": 0.0, + "id": 5 }, { - "id": 6, - "value": 0.0 + "value": 0.0, + "id": 6 }, { - "id": 7, - "value": 0.0 + "value": 0.0, + "id": 7 } ], + "leftModuleId": 6, + "rightModuleId": 2, "data": { "lissajous": 0, "external": 0 }, - "leftModuleId": 6, - "rightModuleId": 2, - "id": 7, "pos": [ 34, 0 ] }, { + "id": 8, "plugin": "Core", - "version": "1.0.0", + "version": "2.0.0", "model": "Notes", "params": [], "leftModuleId": 1, - "text": "Demo patch instructions:\n\n1. Choose an audio driver and device in the AUDIO-8 module.\n\n2. Use the QWERTY and ZXCVB rows of your keyboard to generate MIDI notes, which are converted to 1V/oct and GATE signals.\n\n3. Drag knobs up/down. Hold Ctrl (Cmd on Mac) while dragging to fine-tune. Right-click knobs to edit, or double-click to initialize.\n\n4. Drag ports to create and move cables. Stack multiple cables on outputs by holding Ctrl (Cmd on Mac) and dragging from an output.\n\n5. Right-click on an empty rack space to add new modules.", - "id": 8, + "data": { + "text": "Demo patch instructions:\n\n1. Choose an audio driver and device in the AUDIO-8 module.\n\n2. Use the QWERTY and ZXCVB rows of your keyboard to generate MIDI notes, which are converted to 1V/oct and GATE signals.\n\n3. Drag knobs up/down. Hold Ctrl (Cmd on Mac) while dragging to fine-tune. Right-click knobs to edit, or double-click to initialize.\n\n4. Drag ports to create and move cables. Stack multiple cables on outputs by holding Ctrl (Cmd on Mac) and dragging from an output.\n\n5. Right-click on an empty rack space to add new modules." + }, "pos": [ 67, 0 ] } ], - "id": 29, "cables": [ { + "id": 0, "outputModuleId": 5, "outputId": 0, "inputModuleId": 3, "inputId": 0, - "color": "#c91847" + "color": "#c9b70e" }, { + "id": 1, "outputModuleId": 3, "outputId": 2, "inputModuleId": 4, @@ -268,41 +271,47 @@ "color": "#0c8e15" }, { + "id": 2, "outputModuleId": 2, "outputId": 0, "inputModuleId": 1, "inputId": 0, - "color": "#0986ad" + "color": "#c91847" }, { + "id": 3, "outputModuleId": 2, "outputId": 0, "inputModuleId": 1, "inputId": 1, - "color": "#c9b70e" + "color": "#0986ad" }, { + "id": 4, "outputModuleId": 6, "outputId": 0, "inputModuleId": 4, "inputId": 0, - "color": "#c91847" + "color": "#c9b70e" }, { + "id": 5, "outputModuleId": 5, "outputId": 1, "inputModuleId": 6, "inputId": 4, - "color": "#c9b70e" + "color": "#0c8e15" }, { + "id": 6, "outputModuleId": 6, "outputId": 0, "inputModuleId": 2, "inputId": 5, - "color": "#0c8e15" + "color": "#c91847" }, { + "id": 7, "outputModuleId": 4, "outputId": 0, "inputModuleId": 2, @@ -310,6 +319,7 @@ "color": "#0986ad" }, { + "id": 8, "outputModuleId": 2, "outputId": 1, "inputModuleId": 7, @@ -317,11 +327,12 @@ "color": "#c9b70e" }, { + "id": 9, "outputModuleId": 5, "outputId": 6, "inputModuleId": 6, "inputId": 5, - "color": "#c91847" + "color": "#0c8e15" } ] } \ No newline at end of file