From 6ad98e9adc8e6ac46e9f87fa9640772dbdf4dbce Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Wed, 18 Nov 2020 18:48:56 -0500 Subject: [PATCH 01/58] oopsy maxpat fix to apply @target correctly --- patchers/oopsy.maxpat | 73 ++++++++++++++++++++++++++----------------- source/genlib_daisy.h | 10 +++--- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index 1cc6948..93cddc4 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 477.0, 107.0, 674.0, 467.0 ], + "rect" : [ 477.0, 107.0, 749.0, 548.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -45,7 +45,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 430.0, 16.0, 168.0, 33.0 ], + "patching_rect" : [ 20.0, 61.0, 168.0, 33.0 ], "text" : "bang (or save patcher) to trigger the oopsy workflow" } @@ -57,7 +57,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "bang" ], - "patching_rect" : [ 367.0, 24.0, 61.0, 22.0 ], + "patching_rect" : [ 159.5, 109.0, 61.0, 22.0 ], "text" : "savebang" } @@ -69,7 +69,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 23.0, 89.0, 67.0, 60.0 ], + "patching_rect" : [ 20.0, 174.0, 67.0, 60.0 ], "text" : "choose device target to compile for" } @@ -81,7 +81,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 40.5, 264.0, 224.0, 74.0 ], + "patching_rect" : [ 37.5, 378.0, 224.0, 74.0 ], "text" : "the node.js script is a thin wrapper around oopsy.js, which will generate the glue code between gen~ export and the Daisy APIs, compile it, and try to upload it to a device." } @@ -93,7 +93,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 40.5, 199.500003099441528, 223.5, 60.0 ], + "patching_rect" : [ 37.5, 288.000003099441528, 223.5, 60.0 ], "text" : "oopsy.snoop will find all the gen~ objects in the parent patcher, configure them for export, trigger the export, then notify the node.js script" } @@ -105,7 +105,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 457.0, 203.000003099441528, 114.0, 33.0 ], + "patching_rect" : [ 454.0, 288.000003099441528, 114.0, 33.0 ], "text" : "turn Max-style path into OS path" } @@ -117,7 +117,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "bang", "" ], - "patching_rect" : [ 296.5, 89.0, 54.0, 22.0 ], + "patching_rect" : [ 309.5, 174.0, 54.0, 22.0 ], "text" : "sel bang" } @@ -129,7 +129,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 351.0, 89.0, 94.0, 74.0 ], + "patching_rect" : [ 364.0, 174.0, 94.0, 74.0 ], "text" : "audio must be on for the exportcode message to work" } @@ -140,7 +140,7 @@ "maxclass" : "ezdac~", "numinlets" : 2, "numoutlets" : 0, - "patching_rect" : [ 296.5, 137.0, 31.0, 31.0 ] + "patching_rect" : [ 309.5, 231.0, 31.0, 31.0 ] } } @@ -151,7 +151,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "int" ], - "patching_rect" : [ 296.5, 113.0, 22.0, 22.0 ], + "patching_rect" : [ 309.5, 207.0, 22.0, 22.0 ], "text" : "t 1" } @@ -163,7 +163,7 @@ "numinlets" : 2, "numoutlets" : 4, "outlettype" : [ "dictionary", "", "", "" ], - "patching_rect" : [ 340.0, 394.0, 50.5, 22.0 ], + "patching_rect" : [ 480.0, 497.0, 50.5, 22.0 ], "saved_object_attributes" : { "embed" : 0, "parameter_enable" : 0, @@ -180,7 +180,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 487.0, 357.0, 66.0, 22.0 ], + "patching_rect" : [ 627.0, 460.0, 66.0, 22.0 ], "text" : "print stderr" } @@ -191,7 +191,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 412.0, 357.0, 68.0, 22.0 ], + "patching_rect" : [ 552.0, 460.0, 68.0, 22.0 ], "text" : "print stdout" } @@ -203,7 +203,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 340.0, 357.0, 65.0, 22.0 ], + "patching_rect" : [ 480.0, 460.0, 65.0, 22.0 ], "text" : "route error" } @@ -215,7 +215,7 @@ "numinlets" : 6, "numoutlets" : 6, "outlettype" : [ "", "", "", "", "", "" ], - "patching_rect" : [ 340.0, 310.0, 219.0, 22.0 ], + "patching_rect" : [ 480.0, 413.0, 219.0, 22.0 ], "text" : "route terminated stdout stderr stop start" } @@ -228,7 +228,7 @@ "numoutlets" : 1, "outlettype" : [ "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 333.0, 16.0, 30.0, 30.0 ], + "patching_rect" : [ 123.5, 101.0, 30.0, 30.0 ], "presentation" : 1, "presentation_rect" : [ 333.0, 16.0, 30.0, 30.0 ] } @@ -243,10 +243,12 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 274.0, 264.0, 228.0, 26.0 ], + "patching_rect" : [ 271.0, 378.0, 228.0, 26.0 ], "saved_object_attributes" : { "autostart" : 0, "defer" : 0, + "node_bin_path" : "", + "npm_bin_path" : "", "watch" : 0 } , @@ -261,7 +263,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 274.0, 235.0, 111.0, 22.0 ], + "patching_rect" : [ 271.0, 320.0, 111.0, 22.0 ], "text" : "prepend script start" } @@ -273,8 +275,8 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 93.5, 89.0, 72.0, 22.0 ], - "text" : "prepend set" + "patching_rect" : [ 90.5, 174.0, 94.0, 22.0 ], + "text" : "prepend symbol" } } @@ -285,7 +287,7 @@ "numinlets" : 3, "numoutlets" : 3, "outlettype" : [ "", "", "" ], - "patching_rect" : [ 93.5, 59.0, 199.0, 22.0 ], + "patching_rect" : [ 90.5, 144.0, 199.0, 22.0 ], "text" : "route target done" } @@ -297,7 +299,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 40.5, 24.0, 72.0, 22.0 ], + "patching_rect" : [ 223.0, 109.0, 72.0, 22.0 ], "text" : "patcherargs" } @@ -311,7 +313,7 @@ "numoutlets" : 3, "outlettype" : [ "int", "", "" ], "parameter_enable" : 0, - "patching_rect" : [ 93.5, 118.0, 100.0, 22.0 ], + "patching_rect" : [ 90.5, 203.0, 100.0, 22.0 ], "presentation" : 1, "presentation_rect" : [ 93.5, 118.0, 100.0, 22.0 ] } @@ -324,7 +326,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 134.0, 147.000003099441528, 130.0, 22.0 ], + "patching_rect" : [ 90.5, 235.5, 130.0, 22.0 ], "text" : "prepend setprop target" } @@ -469,7 +471,7 @@ ] } , - "patching_rect" : [ 398.0, 203.000003099441528, 54.0, 22.0 ], + "patching_rect" : [ 395.0, 288.000003099441528, 54.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -490,7 +492,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "bang" ], - "patching_rect" : [ 117.5, 16.0, 30.0, 30.0 ] + "patching_rect" : [ 90.5, 101.0, 30.0, 30.0 ] } } @@ -503,9 +505,9 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 274.0, 203.000003099441528, 114.0, 26.0 ], + "patching_rect" : [ 271.0, 288.000003099441528, 114.0, 26.0 ], "saved_object_attributes" : { - "filename" : "oopsy.snoop.js", + "filename" : "oopsy.snoop", "parameter_enable" : 0 } , @@ -517,6 +519,7 @@ "lines" : [ { "patchline" : { "destination" : [ "obj-17", 0 ], + "midpoints" : [ 100.0, 137.0, 100.0, 137.0 ], "source" : [ "obj-1", 0 ] } @@ -538,6 +541,7 @@ , { "patchline" : { "destination" : [ "obj-14", 0 ], + "midpoints" : [ 140.5, 232.0, 100.0, 232.0 ], "source" : [ "obj-15", 1 ] } @@ -545,6 +549,7 @@ , { "patchline" : { "destination" : [ "obj-17", 0 ], + "midpoints" : [ 285.5, 137.0, 100.0, 137.0 ], "source" : [ "obj-16", 1 ] } @@ -592,10 +597,20 @@ "source" : [ "obj-2", 1 ] } + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "midpoints" : [ 319.0, 202.0, 299.0, 202.0, 299.0, 93.0, 232.5, 93.0 ], + "order" : 1, + "source" : [ "obj-25", 0 ] + } + } , { "patchline" : { "destination" : [ "obj-19", 0 ], + "order" : 0, "source" : [ "obj-25", 0 ] } diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 29f1e1d..0e6cb8f 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -386,13 +386,13 @@ struct GenDaisy { mode = mode_default; hardware.Init(); - #ifdef GEN_DAISY_TARGET_FIELD - samplerate = hardware.SampleRate(); // default 48014 - blocksize = hardware.BlockSize(); // default 48 - #else + // #ifdef GEN_DAISY_TARGET_FIELD + // samplerate = hardware.SampleRate(); // default 48014 + // blocksize = hardware.BlockSize(); // default 48 + // #else samplerate = hardware.AudioSampleRate(); // default 48014 blocksize = hardware.AudioBlockSize(); // default 48 - #endif + //#endif app_count = count; console.init(); From 8d31c5d89ba0fc603793c8c84d135014471a1a3d Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Wed, 18 Nov 2020 19:06:22 -0500 Subject: [PATCH 02/58] fix for no-menu on pod --- source/genlib_daisy.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 0e6cb8f..7169b7f 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -517,9 +517,11 @@ struct GenDaisy { } #else //GEN_DAISY_TARGET_HAS_OLED + #ifdef GEN_DAISY_MULTI_APP case MODE_MENU: { // TODO show menu selection via LEDs } break; + #endif #endif //GEN_DAISY_TARGET_HAS_OLED default: { } From 897bed8232c95e39c7d969d01605b31bf234db59 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Wed, 18 Nov 2020 20:33:06 -0500 Subject: [PATCH 03/58] filter stdout in Max to minimal messages --- javascript/oopsy.node4max.js | 43 +++++++++++---- patchers/oopsy.maxpat | 102 ++++++++++++++++++++++++----------- source/oopsy.js | 50 ++++++++++------- 3 files changed, 136 insertions(+), 59 deletions(-) diff --git a/javascript/oopsy.node4max.js b/javascript/oopsy.node4max.js index e36b390..53f9f3b 100644 --- a/javascript/oopsy.node4max.js +++ b/javascript/oopsy.node4max.js @@ -1,19 +1,44 @@ // Node4Max wrapper of the gen2daisy.node.js script -const path = require("path") -// fs = require("fs"), -// os = require("os"), -// assert = require("assert"); -// const {exec, spawn} = require("child_process"); - +const path = require("path"), + os = require("os") const maxAPI = require("max-api"); const run = require(path.join(__dirname, "..", "source", "oopsy.js")); -try { +let filter +if (os.platform() == "win32") { + filter = function(str) { + maxAPI.outlet(str) + } +} else { + filter = function(str) { + let match + if (match = label.match(/^Building/gm)) { + maxAPI.outlet(str) + } else { + maxAPI.outlet("--" + str) + } + } +} - // I'd like to filter the stdout/stderr streams here - // especially for the DFU upload stuff (no point showing errors that are not really errors!) +// duplicate stdout here so we can filter it and display more useful things in Max: +// dup stdout to our handler: +process.stdout.write = (function() { + const stdout_write = process.stdout.write; + return function(str) { + stdout_write.apply(process.stdout, arguments); + if (os.platform() == "win32") { + maxAPI.outlet(str) + } else { + let match + if (match = str.match(/^oopsy (.*)/i)) { + maxAPI.outlet(match[1]) + } + } + } +})(); +try { run(...process.argv.slice(2)) } catch(e) { maxAPI.post(e.message ? e.message : e, maxAPI.POST_LEVELS.ERROR); diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index 93cddc4..bdc43c4 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 477.0, 107.0, 749.0, 548.0 ], + "rect" : [ 477.0, 107.0, 724.0, 573.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -39,6 +39,41 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-22", + "maxclass" : "toggle", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "int" ], + "parameter_enable" : 0, + "patching_rect" : [ 519.0, 442.0, 24.0, 24.0 ] + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 550.0, 442.0, 32.0, 22.0 ], + "text" : "gate" + } + + } +, { + "box" : { + "id" : "obj-11", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 271.0, 420.0, 67.0, 22.0 ], + "text" : "print oopsy" + } + + } +, { "box" : { "id" : "obj-4", "linecount" : 2, @@ -163,7 +198,7 @@ "numinlets" : 2, "numoutlets" : 4, "outlettype" : [ "dictionary", "", "", "" ], - "patching_rect" : [ 480.0, 497.0, 50.5, 22.0 ], + "patching_rect" : [ 480.0, 511.0, 50.5, 22.0 ], "saved_object_attributes" : { "embed" : 0, "parameter_enable" : 0, @@ -173,17 +208,6 @@ "text" : "dict" } - } -, { - "box" : { - "id" : "obj-34", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 627.0, 460.0, 66.0, 22.0 ], - "text" : "print stderr" - } - } , { "box" : { @@ -191,8 +215,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 552.0, 460.0, 68.0, 22.0 ], - "text" : "print stdout" + "patching_rect" : [ 550.0, 474.0, 114.0, 22.0 ], + "text" : "print oopsy-verbose" } } @@ -203,7 +227,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 480.0, 460.0, 65.0, 22.0 ], + "patching_rect" : [ 480.0, 474.0, 65.0, 22.0 ], "text" : "route error" } @@ -212,11 +236,11 @@ "box" : { "id" : "obj-42", "maxclass" : "newobj", - "numinlets" : 6, - "numoutlets" : 6, - "outlettype" : [ "", "", "", "", "", "" ], - "patching_rect" : [ 480.0, 413.0, 219.0, 22.0 ], - "text" : "route terminated stdout stderr stop start" + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 480.0, 413.0, 102.0, 22.0 ], + "text" : "route terminated" } } @@ -530,6 +554,13 @@ "source" : [ "obj-12", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-49", 0 ], + "source" : [ "obj-13", 0 ] + } + } , { "patchline" : { @@ -590,6 +621,13 @@ "source" : [ "obj-19", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-11", 0 ], + "source" : [ "obj-2", 0 ] + } + } , { "patchline" : { @@ -597,6 +635,13 @@ "source" : [ "obj-2", 1 ] } + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-22", 0 ] + } + } , { "patchline" : { @@ -631,22 +676,15 @@ } , { "patchline" : { - "destination" : [ "obj-44", 0 ], - "source" : [ "obj-42", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-49", 0 ], - "source" : [ "obj-42", 2 ] + "destination" : [ "obj-13", 1 ], + "source" : [ "obj-42", 1 ] } } , { "patchline" : { - "destination" : [ "obj-49", 0 ], - "source" : [ "obj-42", 1 ] + "destination" : [ "obj-44", 0 ], + "source" : [ "obj-42", 0 ] } } diff --git a/source/oopsy.js b/source/oopsy.js index 8f4b26f..0cbd904 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -194,39 +194,53 @@ int main(void) { ` fs.writeFileSync(maincpp_path, cppcode, "utf-8"); + console.log("oopsy generated code") + // now try to make: try { + try { + console.log(execSync("make clean", { cwd: build_path }).toString()) + // TODO: make this cross-platform: + if (os.platform() == "win32") { + //console.log(execSync("set PATH=%PATH%;/usr/local/bin && make", { cwd: build_path }).toString()) + + // Gather up make output to run command per line as child process + // TODO: fix the awful output.. + let build_cmd = execSync("make -n", { cwd: build_path }).toString().split(os.EOL) + build_cmd.forEach(line => { + if (line.length > 0) + console.log(execSync(line, { cwd: build_path }).toString()) + }) + + } else { + console.log(execSync("export PATH=$PATH:/usr/local/bin && make", { cwd: build_path }).toString()) + } - console.log(execSync("make clean", { cwd: build_path }).toString()) - // TODO: make this cross-platform: - if (os.platform() == "win32") { - //console.log(execSync("set PATH=%PATH%;/usr/local/bin && make", { cwd: build_path }).toString()) - - // Gather up make output to run command per line as child process - // TODO: fix the awful output.. - let build_cmd = execSync("make -n", { cwd: build_path }).toString().split(os.EOL) - build_cmd.forEach(line => { - if (line.length > 0) - console.log(execSync(line, { cwd: build_path }).toString()) - }) - - } else { - console.log(execSync("export PATH=$PATH:/usr/local/bin && make", { cwd: build_path }).toString()) + console.log("oopsy compiled code") + } catch (e) { + // errors from make here + console.error(e); } // if successful, try to upload to hardware: if (fs.existsSync(bin_path) && action=="upload") { - console.log("uploading", bin_path) + + console.log("oopsy uploading", bin_path) + if (os.platform() == "win32") { console.log(execSync("set PATH=%PATH%;/usr/local/bin && make program-dfu", { cwd: build_path }).toString()) } else { console.log(execSync("export PATH=$PATH:/usr/local/bin && make program-dfu", { cwd: build_path, stdio:'inherit' }).toString()) + //console.log(execSync("export PATH=$PATH:/usr/local/bin && make program-dfu", { cwd: build_path }).toString()) + //console.log(execSync("export PATH=$PATH:/usr/local/bin && make program-dfu", { cwd: build_path, stdio:'inherit' }) } + + console.log("oopsy uploaded") } } catch (e) { // errors from make here - console.error("make failed"); + console.log("upload failed", e); } - console.log("done") + console.log("oopsy done") } function analyze_cpp(cpp) { From 2bcfb13cc204d665bdd78f95d86c02d36ea7f395 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 05:02:16 -0500 Subject: [PATCH 04/58] genlib_daisy.h refactor to simplify --- source/genlib_daisy.h | 337 ++++++++++++++++-------------------------- source/oopsy.js | 4 +- 2 files changed, 133 insertions(+), 208 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 7169b7f..f695d4e 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -46,10 +46,10 @@ typedef daisy::DaisySeed Daisy; #define GEN_DAISY_MIDI_BUFFER_SIZE 64 #define GEN_DAISY_LONG_PRESS_MS 250 #define GEN_DAISY_DISPLAY_PERIOD_MS 20 +#define GEN_DAISY_SCOPE_MAX_ZOOM (9) static const uint32_t GEN_DAISY_SRAM_SIZE = 512 * 1024; static const uint32_t GEN_DAISY_SDRAM_SIZE = 64 * 1024 * 1024; - namespace gendaisylib { char * sram_pool = nullptr; @@ -67,7 +67,6 @@ namespace gendaisylib { } void * allocate(uint32_t size) { - //console.log("alloc %d/%d", size, sram_usable); if (size < sram_usable) { void * p = sram_pool + sram_used; sram_used += size; @@ -85,8 +84,7 @@ namespace gendaisylib { void memset(void *p, int c, long size) { char *p2 = (char *)p; int i; - for (i = 0; i < size; i++, p2++) - *p2 = char(c); + for (i = 0; i < size; i++, p2++) *p2 = char(c); } // void genlib_memcpy(void *dst, const void *src, long size) { @@ -107,13 +105,24 @@ namespace gendaisylib { // void * m = malloc(sz * 1024); // if (!m) break; // free(m); - // console.log("%d: malloced %dk", i, sz); + // log("%d: malloced %dk", i, sz); // i++; // } - // console.log("all OK"); + // log("all OK"); // } }; +unsigned long genlib_ticks() { return dsy_system_getnow(); } + +t_ptr genlib_sysmem_newptr(t_ptr_size size) { + return (t_ptr)gendaisylib::allocate(size); +} + +t_ptr genlib_sysmem_newptrclear(t_ptr_size size) { + t_ptr p = genlib_sysmem_newptr(size); + if (p) gendaisylib::memset(p, 0, size); + return p; +} struct Timer { int32_t period = GEN_DAISY_DISPLAY_PERIOD_MS, t=0; @@ -177,133 +186,6 @@ struct MidiUart { } }; - -#if defined(GEN_DAISY_TARGET_HAS_OLED) -#define GEN_DAISY_SCOPE_MAX_ZOOM (9) -struct Console { - FontDef& font = Font_6x8; - uint_fast8_t scope_zoom = 5; - uint_fast8_t scope_step = 0; - uint16_t console_cols, console_rows, console_line; - char * console_stats; - char * console_memory; - char ** console_lines; - float scope_data[SSD1309_WIDTH*2]; // 128 pixels - char scope_label[11]; - - Console& init() { - console_cols = SSD1309_WIDTH / font.FontWidth + 1; // +1 to accommodate null terminators. - console_rows = SSD1309_HEIGHT / font.FontHeight - 1; // leave one row free for stats - console_memory = (char *)calloc(console_cols, console_rows); - console_stats = (char *)calloc(console_cols, 1); - for (int i=0; i 0) { - scope_zoom = scope_zoom + 1; - if (scope_zoom > GEN_DAISY_SCOPE_MAX_ZOOM) scope_zoom = 1; - } else if (incr < 0) { - scope_zoom = scope_zoom - 1; - if (scope_zoom < 1) scope_zoom = GEN_DAISY_SCOPE_MAX_ZOOM; - } - return *this; - } - - Console& scope_store(float * buf, size_t size, float samplerate) { - size_t samples = scope_samples(); - for (size_t i=0; i pt0 ? pt0 : min0; - max0 = max0 < pt0 ? pt0 : max0; - } - scope_data[scope_step] = (min0); - scope_step++; - scope_data[scope_step] = (max0); - scope_step++; - //console.log("m1 %d %d", int(min1 * 10), int(max1 * 10)); - if (scope_step >= SSD1309_WIDTH*2) scope_step = 0; - } - return *this; - } - - Console& scope_display(daisy::OledDisplay& oled, float samplerate) { - uint8_t h = SSD1309_HEIGHT - font.FontHeight; - oled.Fill(false); - for (uint_fast8_t i=0; i void reset(A& newapp) { @@ -373,28 +293,31 @@ struct GenDaisy { // install new callbacks: mainloopCallback = newapp.staticMainloopCallback; hardware.ChangeAudioCallback(newapp.staticAudioCallback); - //console.log("app loaded"); - - console.log("loaded %s", appdefs[app_selected].name); - console.log("%d/%dK+%d/%dM", gendaisylib::sram_used/1024, GEN_DAISY_SRAM_SIZE/1024, gendaisylib::sdram_used/1048576, GEN_DAISY_SDRAM_SIZE/1048576); + log("loaded %s", appdefs[app_selected].name); + log("%d/%dK+%d/%dM", gendaisylib::sram_used/1024, GEN_DAISY_SRAM_SIZE/1024, gendaisylib::sdram_used/1048576, GEN_DAISY_SDRAM_SIZE/1048576); } int run(AppDef * appdefs, int count) { this->appdefs = appdefs; - + app_count = count; + mode_default = (Mode)(MODE_COUNT-1); mode = mode_default; hardware.Init(); - // #ifdef GEN_DAISY_TARGET_FIELD - // samplerate = hardware.SampleRate(); // default 48014 - // blocksize = hardware.BlockSize(); // default 48 - // #else samplerate = hardware.AudioSampleRate(); // default 48014 blocksize = hardware.AudioBlockSize(); // default 48 - //#endif - app_count = count; - console.init(); + + #ifdef GEN_DAISY_TARGET_HAS_OLED + console_cols = SSD1309_WIDTH / font.FontWidth + 1; // +1 to accommodate null terminators. + console_rows = SSD1309_HEIGHT / font.FontHeight - 1; // leave one row free for stats + console_memory = (char *)calloc(console_cols, console_rows); + console_stats = (char *)calloc(console_cols, 1); + for (int i=0; i= MODE_COUNT) mode = 1; if (mode < 1) mode = MODE_COUNT-1; @@ -442,7 +364,13 @@ struct GenDaisy { #endif #ifdef GEN_DAISY_TARGET_HAS_OLED } else if (mode == MODE_SCOPE) { - console.scope_increment(encoder_incr); + if (encoder_incr > 0) { + scope_zoom = scope_zoom + 1; + if (scope_zoom > GEN_DAISY_SCOPE_MAX_ZOOM) scope_zoom = 1; + } else if (encoder_incr < 0) { + scope_zoom = scope_zoom - 1; + if (scope_zoom < 1) scope_zoom = GEN_DAISY_SCOPE_MAX_ZOOM; + } #endif } encoder_incr = 0; @@ -462,41 +390,17 @@ struct GenDaisy { } } encoder_released = 0; - - // if (encoder_held_ms > GEN_DAISY_LONG_PRESS_MS) { - // mode = MODE_MENU; - // } else if (mode == MODE_MENU) { - // // just released: - // mode = mode_default; - // if (app_selected != app_selecting) { - // app_selected = app_selecting; - // console.log("load %s", appdefs[app_selected].name); - // appdefs[app_selected].load(); - // } - // } - - // switch (mode) { - // case MODE_MENU: { - // app_selecting += encoder_incr; - // if (app_selecting >= app_count) app_selecting -= app_count; - // if (app_selecting < 0) app_selecting += app_count; - - // } break; - // #ifdef GEN_DAISY_TARGET_HAS_OLED - // case MODE_SCOPE: scope.increment(encoder_incr); break; - // #endif - // default: break; - // } - + // DISPLAY #ifdef GEN_DAISY_TARGET_HAS_OLED hardware.display.Fill(false); #endif + switch(mode) { #ifdef GEN_DAISY_TARGET_HAS_OLED #ifdef GEN_DAISY_MULTI_APP case MODE_MENU: { - FontDef& font = console.font; + FontDef& font = font; for (int i=0; i<8; i++) { if (i == app_selecting) { hardware.display.SetCursor(0, font.FontHeight * i); @@ -509,10 +413,24 @@ struct GenDaisy { } } break; #endif //GEN_DAISY_MULTI_APP - case MODE_SCOPE: console.scope_display(hardware.display, samplerate); break; + case MODE_SCOPE: { + uint8_t h = SSD1309_HEIGHT - font.FontHeight; + hardware.display.Fill(false); + for (uint_fast8_t i=0; i' : ' '); + offset += snprintf(console_stats+offset, console_cols-offset, " %cM%c", midi.in_active ? '<' : ' ', midi.out_active ? '>' : ' '); midi.in_active = midi.out_active = 0; #endif - console.status_display(hardware.display); + // stats: + hardware.display.SetCursor(0, font.FontHeight * console_rows); + hardware.display.WriteString(console_stats, font, true); } hardware.display.Update(); #endif //GEN_DAISY_TARGET_HAS_OLED @@ -585,7 +505,24 @@ struct GenDaisy { #ifdef GEN_DAISY_TARGET_HAS_OLED if (mode == MODE_SCOPE) { //scope.store(hardware_ins, size, samplerate); - console.scope_store(hardware_outs[0], size, samplerate); + //scope_store(hardware_outs[0], size, samplerate); + + float * buf = hardware_outs[0]; + size_t samples = scope_samples(); + for (size_t i=0; i pt0 ? pt0 : min0; + max0 = max0 < pt0 ? pt0 : max0; + } + scope_data[scope_step] = (min0); + scope_step++; + scope_data[scope_step] = (max0); + scope_step++; + if (scope_step >= SSD1309_WIDTH*2) scope_step = 0; + } } #endif } @@ -618,20 +555,8 @@ struct StaticApp { } }; -////////////////////////// BINDING DAISY TO GENLIB ////////////////////////// +void genlib_report_error(const char *s) { gendaisy.log(s); } +void genlib_report_message(const char *s) { gendaisy.log(s); } -void genlib_report_error(const char *s) { gendaisy.console.log(s); } -void genlib_report_message(const char *s) { gendaisy.console.log(s); } -unsigned long genlib_ticks() { return dsy_system_getnow(); } - -t_ptr genlib_sysmem_newptr(t_ptr_size size) { - return (t_ptr)gendaisylib::allocate(size); -} - -t_ptr genlib_sysmem_newptrclear(t_ptr_size size) { - t_ptr p = genlib_sysmem_newptr(size); - if (p) gendaisylib::memset(p, 0, size); - return p; -} #endif //GENLIB_DAISY_H diff --git a/source/oopsy.js b/source/oopsy.js index 0cbd904..ef9e87a 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -219,7 +219,7 @@ int main(void) { console.log("oopsy compiled code") } catch (e) { // errors from make here - console.error(e); + console.error("make failed"); } // if successful, try to upload to hardware: if (fs.existsSync(bin_path) && action=="upload") { @@ -238,7 +238,7 @@ int main(void) { } } catch (e) { // errors from make here - console.log("upload failed", e); + console.log("upload failed"); } console.log("oopsy done") } From f41831713d62a1959b4726a20ba2752e42e52183 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 05:03:34 -0500 Subject: [PATCH 05/58] genlib_daisy.h refactor to simplify --- source/genlib_daisy.h | 66 ++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index f695d4e..19f1203 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -244,40 +244,9 @@ struct GenDaisy { char ** console_lines; float scope_data[SSD1309_WIDTH*2]; // 128 pixels char scope_label[11]; - - int scope_samples() { - // valid zoom sizes: 1, 2, 3, 4, 6, 8, 12, 16, 24 - switch(scope_zoom) { - case 1: case 2: case 3: case 4: return scope_zoom; break; - case 5: return 6; break; - case 6: return 8; break; - case 7: return 12; break; - case 8: return 16; break; - default: return 24; break; - } - } - - GenDaisy& console_display() { - for (int i=0; i void reset(A& newapp) { // first, remove callbacks: @@ -527,6 +496,39 @@ struct GenDaisy { #endif } + #ifdef GEN_DAISY_TARGET_HAS_OLED + int scope_samples() { + // valid zoom sizes: 1, 2, 3, 4, 6, 8, 12, 16, 24 + switch(scope_zoom) { + case 1: case 2: case 3: case 4: return scope_zoom; break; + case 5: return 6; break; + case 6: return 8; break; + case 7: return 12; break; + case 8: return 16; break; + default: return 24; break; + } + } + + GenDaisy& console_display() { + for (int i=0; i Date: Thu, 19 Nov 2020 05:04:31 -0500 Subject: [PATCH 06/58] genlib_daisy.h refactor to simplify --- source/genlib_daisy.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 19f1203..4df6a7c 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -538,6 +538,9 @@ void GenDaisy::nullAudioCallback(float **hardware_ins, float **hardware_outs, si gendaisy.nullAudioCallbackRunning = true; } +void genlib_report_error(const char *s) { gendaisy.log(s); } +void genlib_report_message(const char *s) { gendaisy.log(s); } + // Curiously-recurring template to make App definitions simpler: template struct StaticApp { @@ -557,8 +560,4 @@ struct StaticApp { } }; -void genlib_report_error(const char *s) { gendaisy.log(s); } -void genlib_report_message(const char *s) { gendaisy.log(s); } - - #endif //GENLIB_DAISY_H From 5bbfa06dd545726c45cef620dae332f77d4953f2 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 05:33:03 -0500 Subject: [PATCH 07/58] code cleanup --- source/genlib_daisy.h | 809 +++++++++++++++++++++--------------------- source/oopsy.js | 40 +-- 2 files changed, 421 insertions(+), 428 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 4df6a7c..bf352a4 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -9,32 +9,31 @@ #include // memset #include // vprintf - -#if defined(GEN_DAISY_TARGET_PATCH) +#if defined(OOPSY_TARGET_PATCH) #include "daisy_patch.h" -#define GEN_DAISY_TARGET_HAS_OLED 1 -#define GEN_DAISY_IO_COUNT (4) +#define OOPSY_TARGET_HAS_OLED 1 +#define OOPSY_IO_COUNT (4) typedef daisy::DaisyPatch Daisy; -#elif defined(GEN_DAISY_TARGET_FIELD) +#elif defined(OOPSY_TARGET_FIELD) #include "daisy_field.h" -#define GEN_DAISY_TARGET_HAS_OLED 1 -#define GEN_DAISY_IO_COUNT (2) +#define OOPSY_TARGET_HAS_OLED 1 +#define OOPSY_IO_COUNT (2) typedef daisy::DaisyField Daisy; -#elif defined(GEN_DAISY_TARGET_PETAL) +#elif defined(OOPSY_TARGET_PETAL) #include "daisy_petal.h" -#define GEN_DAISY_IO_COUNT (2) +#define OOPSY_IO_COUNT (2) typedef daisy::DaisyPetal Daisy; -#elif defined(GEN_DAISY_TARGET_POD) +#elif defined(OOPSY_TARGET_POD) #include "daisy_pod.h" -#define GEN_DAISY_IO_COUNT (2) +#define OOPSY_IO_COUNT (2) typedef daisy::DaisyPod Daisy; #else #include "daisy_seed.h" -#define GEN_DAISY_IO_COUNT (2) +#define OOPSY_IO_COUNT (2) typedef daisy::DaisySeed Daisy; #endif @@ -42,27 +41,26 @@ typedef daisy::DaisySeed Daisy; ////////////////////////// DAISY EXPORT INTERFACING ////////////////////////// -#define GEN_DAISY_BUFFER_SIZE 48 -#define GEN_DAISY_MIDI_BUFFER_SIZE 64 -#define GEN_DAISY_LONG_PRESS_MS 250 -#define GEN_DAISY_DISPLAY_PERIOD_MS 20 -#define GEN_DAISY_SCOPE_MAX_ZOOM (9) -static const uint32_t GEN_DAISY_SRAM_SIZE = 512 * 1024; -static const uint32_t GEN_DAISY_SDRAM_SIZE = 64 * 1024 * 1024; - -namespace gendaisylib { +#define OOPSY_BUFFER_SIZE 48 +#define OOPSY_MIDI_BUFFER_SIZE 64 +#define OOPSY_LONG_PRESS_MS 250 +#define OOPSY_DISPLAY_PERIOD_MS 20 +#define OOPSY_SCOPE_MAX_ZOOM (9) +static const uint32_t OOPSY_SRAM_SIZE = 512 * 1024; +static const uint32_t OOPSY_SDRAM_SIZE = 64 * 1024 * 1024; - char * sram_pool = nullptr; - char DSY_SDRAM_BSS sdram_pool[GEN_DAISY_SDRAM_SIZE]; +namespace oopsy { uint32_t sram_used = 0, sram_usable = 0; uint32_t sdram_used = 0, sdram_usable = 0; + char * sram_pool = nullptr; + char DSY_SDRAM_BSS sdram_pool[OOPSY_SDRAM_SIZE]; void init() { - if (!sram_pool) sram_pool = (char *)malloc(GEN_DAISY_SRAM_SIZE); - sram_usable = GEN_DAISY_SRAM_SIZE; + if (!sram_pool) sram_pool = (char *)malloc(OOPSY_SRAM_SIZE); + sram_usable = OOPSY_SRAM_SIZE; sram_used = 0; - sdram_usable = GEN_DAISY_SDRAM_SIZE; + sdram_usable = OOPSY_SDRAM_SIZE; sdram_used = 0; } @@ -110,91 +108,32 @@ namespace gendaisylib { // } // log("all OK"); // } -}; - -unsigned long genlib_ticks() { return dsy_system_getnow(); } - -t_ptr genlib_sysmem_newptr(t_ptr_size size) { - return (t_ptr)gendaisylib::allocate(size); -} - -t_ptr genlib_sysmem_newptrclear(t_ptr_size size) { - t_ptr p = genlib_sysmem_newptr(size); - if (p) gendaisylib::memset(p, 0, size); - return p; -} - -struct Timer { - int32_t period = GEN_DAISY_DISPLAY_PERIOD_MS, t=0; - - bool ready(int32_t dt) { - t += dt; - if (t > period) { - t = 0; - return true; - } - return false; - } -}; - - -struct MidiUart { - daisy::UartHandler uart; - uint8_t in_written = 0, out_written = 0; - uint8_t in_active = 0, out_active = 0; - uint8_t out_data[GEN_DAISY_MIDI_BUFFER_SIZE]; - float in_data[GEN_DAISY_BUFFER_SIZE]; - - void init() { - uart.Init(); - uart.StartRx(); - } - - void preperform(size_t size) { - // fill remainder of midi buffer with non-data: - for (size_t i=in_written; i= 0.f) { - // scale (0.0, 1.0) back to (0, 255) for MIDI bytes - out_data[out_written++] = buf[i] * 256.0f; - out_active = 1; - } - } - } + struct Timer { + int32_t period = OOPSY_DISPLAY_PERIOD_MS, t=0; - void mainloop() { - // input: - while(uart.Readable()) { - uint8_t byte = uart.PopRx(); - if (in_written < GEN_DAISY_BUFFER_SIZE) { - // scale (0, 255) to (0.0, 1.0) - // to protect hardware from accidental patching - in_data[in_written] = byte / 256.0f; - in_written++; + bool ready(int32_t dt) { + t += dt; + if (t > period) { + t = 0; + return true; } - in_active = 1; + return false; } - // output: - if (out_written) { - if (0 == uart.PollTx(out_data, out_written)) out_written = 0; - } - } -}; + }; -struct GenDaisy { + struct AppDef { + const char * name; + void (*load)(); + }; typedef enum { MODE_NONE = 0, - #ifdef GEN_DAISY_MULTI_APP + #ifdef OOPSY_MULTI_APP MODE_MENU, #endif - #ifdef GEN_DAISY_TARGET_HAS_OLED + #ifdef OOPSY_TARGET_HAS_OLED MODE_CONSOLE, MODE_SCOPE, #endif @@ -202,362 +141,416 @@ struct GenDaisy { MODE_COUNT } Mode; - struct AppDef { - const char * name; - void (*load)(); - }; + #ifdef OOPSY_TARGET_USES_MIDI_UART + struct { + daisy::UartHandler uart; + uint8_t in_written = 0, out_written = 0; + uint8_t in_active = 0, out_active = 0; + uint8_t out_data[OOPSY_MIDI_BUFFER_SIZE]; + float in_data[OOPSY_BUFFER_SIZE]; + + void init() { + uart.Init(); + uart.StartRx(); + } - Daisy hardware; - AppDef * appdefs = nullptr; + void preperform(size_t size) { + // fill remainder of midi buffer with non-data: + for (size_t i=in_written; i= 0.f) { + // scale (0.0, 1.0) back to (0, 255) for MIDI bytes + out_data[out_written++] = buf[i] * 256.0f; + out_active = 1; + } + } + } - int mode, mode_default; - int app_count = 1, app_selected = 0, app_selecting = 0; - int encoder_held = 0, encoder_held_ms = 0, encoder_released = 0, encoder_incr = 0; - int is_mode_selecting = 0; + void mainloop() { + // input: + while(uart.Readable()) { + uint8_t byte = uart.PopRx(); + if (in_written < OOPSY_BUFFER_SIZE) { + // scale (0, 255) to (0.0, 1.0) + // to protect hardware from accidental patching + in_data[in_written] = byte / 256.0f; + in_written++; + } + in_active = 1; + } + // output: + if (out_written) { + if (0 == uart.PollTx(out_data, out_written)) out_written = 0; + } + } + } midi; + #endif - uint32_t t = 0, dt = 10; - Timer uitimer; + struct GenDaisy { - // microseconds spent in audio callback - uint32_t audioCpuUs = 0; + Daisy hardware; + AppDef * appdefs = nullptr; - float samplerate; // default 48014 - size_t blocksize; // default 48 + int mode, mode_default; + int app_count = 1, app_selected = 0, app_selecting = 0; + int encoder_held = 0, encoder_held_ms = 0, encoder_released = 0, encoder_incr = 0; + int is_mode_selecting = 0; - void (*mainloopCallback)(uint32_t t, uint32_t dt); - void * app = nullptr; - void * gen = nullptr; - bool nullAudioCallbackRunning = false; + uint32_t t = 0, dt = 10; + Timer uitimer; - #ifdef GEN_DAISY_TARGET_USES_MIDI_UART - MidiUart midi; - #endif - - //Console console; - #ifdef GEN_DAISY_TARGET_HAS_OLED - FontDef& font = Font_6x8; - uint_fast8_t scope_zoom = 5; - uint_fast8_t scope_step = 0; - uint16_t console_cols, console_rows, console_line; - char * console_stats; - char * console_memory; - char ** console_lines; - float scope_data[SSD1309_WIDTH*2]; // 128 pixels - char scope_label[11]; - #endif // GEN_DAISY_TARGET_HAS_OLED - - - template - void reset(A& newapp) { - // first, remove callbacks: - mainloopCallback = nullMainloopCallback; - nullAudioCallbackRunning = false; - hardware.ChangeAudioCallback(nullAudioCallback); - while (!nullAudioCallbackRunning) dsy_system_delay(10); - // reset memory - gendaisylib::init(); - // install new app: - app = &newapp; - newapp.init(*this); - // install new callbacks: - mainloopCallback = newapp.staticMainloopCallback; - hardware.ChangeAudioCallback(newapp.staticAudioCallback); - log("loaded %s", appdefs[app_selected].name); - log("%d/%dK+%d/%dM", gendaisylib::sram_used/1024, GEN_DAISY_SRAM_SIZE/1024, gendaisylib::sdram_used/1048576, GEN_DAISY_SDRAM_SIZE/1048576); - } + // microseconds spent in audio callback + uint32_t audioCpuUs = 0; - int run(AppDef * appdefs, int count) { - this->appdefs = appdefs; - app_count = count; - - mode_default = (Mode)(MODE_COUNT-1); - mode = mode_default; + float samplerate; // default 48014 + size_t blocksize; // default 48 - hardware.Init(); - samplerate = hardware.AudioSampleRate(); // default 48014 - blocksize = hardware.AudioBlockSize(); // default 48 + void (*mainloopCallback)(uint32_t t, uint32_t dt); + void * app = nullptr; + void * gen = nullptr; + bool nullAudioCallbackRunning = false; - #ifdef GEN_DAISY_TARGET_HAS_OLED - console_cols = SSD1309_WIDTH / font.FontWidth + 1; // +1 to accommodate null terminators. - console_rows = SSD1309_HEIGHT / font.FontHeight - 1; // leave one row free for stats - console_memory = (char *)calloc(console_cols, console_rows); - console_stats = (char *)calloc(console_cols, 1); - for (int i=0; i + void reset(A& newapp) { + // first, remove callbacks: + mainloopCallback = nullMainloopCallback; + nullAudioCallbackRunning = false; + hardware.ChangeAudioCallback(nullAudioCallback); + while (!nullAudioCallbackRunning) dsy_system_delay(10); + // reset memory + oopsy::init(); + // install new app: + app = &newapp; + newapp.init(*this); + // install new callbacks: + mainloopCallback = newapp.staticMainloopCallback; + hardware.ChangeAudioCallback(newapp.staticAudioCallback); + log("loaded %s", appdefs[app_selected].name); + log("%d/%dK+%d/%dM", oopsy::sram_used/1024, OOPSY_SRAM_SIZE/1024, oopsy::sdram_used/1048576, OOPSY_SDRAM_SIZE/1048576); } - console_line = console_rows-1; - #endif - hardware.StartAdc(); - hardware.StartAudio(nullAudioCallback); - mainloopCallback = nullMainloopCallback; - - #ifdef GEN_DAISY_TARGET_USES_MIDI_UART - midi.init(); - #endif + int run(AppDef * appdefs, int count) { + this->appdefs = appdefs; + app_count = count; + + mode_default = (Mode)(MODE_COUNT-1); + mode = mode_default; - app_selected = 0; - appdefs[app_selected].load(); + hardware.Init(); + samplerate = hardware.AudioSampleRate(); // default 48014 + blocksize = hardware.AudioBlockSize(); // default 48 + + #ifdef OOPSY_TARGET_HAS_OLED + console_cols = SSD1309_WIDTH / font.FontWidth + 1; // +1 to accommodate null terminators. + console_rows = SSD1309_HEIGHT / font.FontHeight - 1; // leave one row free for stats + console_memory = (char *)calloc(console_cols, console_rows); + console_stats = (char *)calloc(console_cols, 1); + for (int i=0; i GEN_DAISY_LONG_PRESS_MS) { - // LONG PRESS - is_mode_selecting = 1; - } - - // Handle encoder increment actions: - if (is_mode_selecting) { - mode += encoder_incr; - if (mode >= MODE_COUNT) mode = 1; - if (mode < 1) mode = MODE_COUNT-1; - #ifdef GEN_DAISY_MULTI_APP - } else if (mode == MODE_MENU) { - app_selecting += encoder_incr; - if (app_selecting >= app_count) app_selecting -= app_count; - if (app_selecting < 0) app_selecting += app_count; - #endif - #ifdef GEN_DAISY_TARGET_HAS_OLED - } else if (mode == MODE_SCOPE) { - if (encoder_incr > 0) { - scope_zoom = scope_zoom + 1; - if (scope_zoom > GEN_DAISY_SCOPE_MAX_ZOOM) scope_zoom = 1; - } else if (encoder_incr < 0) { - scope_zoom = scope_zoom - 1; - if (scope_zoom < 1) scope_zoom = GEN_DAISY_SCOPE_MAX_ZOOM; - } - #endif - } - encoder_incr = 0; - // SHORT PRESS - if (encoder_released) { + app_selected = 0; + appdefs[app_selected].load(); + + #ifdef OOPSY_TARGET_HAS_OLED + console_display(); + #endif + while(1) { + uint32_t t1 = dsy_system_getnow(); + dt = t1-t; + t = t1; + + #ifdef OOPSY_TARGET_USES_MIDI_UART + midi.mainloop(); + #endif + // handle app-level code (e.g. for LED/CV/gate outs) + mainloopCallback(t, dt); + + if (uitimer.ready(dt)) { + // Handle encoder press/longpress actions: + if (encoder_held_ms > OOPSY_LONG_PRESS_MS) { + // LONG PRESS + is_mode_selecting = 1; + } + + // Handle encoder increment actions: if (is_mode_selecting) { - is_mode_selecting = 0; - #ifdef GEN_DAISY_MULTI_APP + mode += encoder_incr; + if (mode >= MODE_COUNT) mode = 1; + if (mode < 1) mode = MODE_COUNT-1; + #ifdef OOPSY_MULTI_APP } else if (mode == MODE_MENU) { - if (app_selected != app_selecting) { - app_selected = app_selecting; - appdefs[app_selected].load(); - mode = mode_default; + app_selecting += encoder_incr; + if (app_selecting >= app_count) app_selecting -= app_count; + if (app_selecting < 0) app_selecting += app_count; + #endif + #ifdef OOPSY_TARGET_HAS_OLED + } else if (mode == MODE_SCOPE) { + if (encoder_incr > 0) { + scope_zoom = scope_zoom + 1; + if (scope_zoom > OOPSY_SCOPE_MAX_ZOOM) scope_zoom = 1; + } else if (encoder_incr < 0) { + scope_zoom = scope_zoom - 1; + if (scope_zoom < 1) scope_zoom = OOPSY_SCOPE_MAX_ZOOM; } #endif } - } - encoder_released = 0; + encoder_incr = 0; + + // SHORT PRESS + if (encoder_released) { + if (is_mode_selecting) { + is_mode_selecting = 0; + #ifdef OOPSY_MULTI_APP + } else if (mode == MODE_MENU) { + if (app_selected != app_selecting) { + app_selected = app_selecting; + appdefs[app_selected].load(); + mode = mode_default; + } + #endif + } + } + encoder_released = 0; - // DISPLAY - #ifdef GEN_DAISY_TARGET_HAS_OLED - hardware.display.Fill(false); - #endif + // DISPLAY + #ifdef OOPSY_TARGET_HAS_OLED + hardware.display.Fill(false); + #endif - switch(mode) { - #ifdef GEN_DAISY_TARGET_HAS_OLED - #ifdef GEN_DAISY_MULTI_APP - case MODE_MENU: { - FontDef& font = font; - for (int i=0; i<8; i++) { - if (i == app_selecting) { - hardware.display.SetCursor(0, font.FontHeight * i); - hardware.display.WriteString((char *)">", font, true); + switch(mode) { + #ifdef OOPSY_TARGET_HAS_OLED + #ifdef OOPSY_MULTI_APP + case MODE_MENU: { + FontDef& font = font; + for (int i=0; i<8; i++) { + if (i == app_selecting) { + hardware.display.SetCursor(0, font.FontHeight * i); + hardware.display.WriteString((char *)">", font, true); + } + if (i < app_count) { + hardware.display.SetCursor(font.FontWidth, font.FontHeight * i); + hardware.display.WriteString((char *)appdefs[i].name, font, true); + } } - if (i < app_count) { - hardware.display.SetCursor(font.FontWidth, font.FontHeight * i); - hardware.display.WriteString((char *)appdefs[i].name, font, true); + } break; + #endif //OOPSY_MULTI_APP + case MODE_SCOPE: { + uint8_t h = SSD1309_HEIGHT - font.FontHeight; + hardware.display.Fill(false); + for (uint_fast8_t i=0; i' : ' '); - midi.in_active = midi.out_active = 0; - #endif - // stats: - hardware.display.SetCursor(0, font.FontHeight * console_rows); - hardware.display.WriteString(console_stats, font, true); - } - hardware.display.Update(); - #endif //GEN_DAISY_TARGET_HAS_OLED - } // uitimer.ready + if (is_mode_selecting) { + #ifdef OOPSY_TARGET_HAS_OLED + hardware.display.DrawRect(0, 0, SSD1309_WIDTH-1, SSD1309_HEIGHT-1, 1); + #endif + } + #ifdef OOPSY_TARGET_HAS_OLED + #ifdef OOPSY_MULTI_APP + if (mode != MODE_MENU) + #endif //OOPSY_MULTI_APP + { + // status bar + int offset = 0; + offset += snprintf(console_stats+offset, console_cols-offset, "%02d%%", int(0.0001f*audioCpuUs*(samplerate)/blocksize)); + #ifdef OOPSY_TARGET_USES_MIDI_UART + offset += snprintf(console_stats+offset, console_cols-offset, " %cM%c", midi.in_active ? '<' : ' ', midi.out_active ? '>' : ' '); + midi.in_active = midi.out_active = 0; + #endif + // stats: + hardware.display.SetCursor(0, font.FontHeight * console_rows); + hardware.display.WriteString(console_stats, font, true); + } + hardware.display.Update(); + #endif //OOPSY_TARGET_HAS_OLED + } // uitimer.ready + } + return 0; } - return 0; - } - void audio_preperform(size_t size) { + void audio_preperform(size_t size) { + #ifdef OOPSY_TARGET_USES_MIDI_UART + midi.preperform(size); + #endif - #ifdef GEN_DAISY_TARGET_USES_MIDI_UART - midi.preperform(size); - #endif + #if (OOPSY_TARGET_FIELD) + hardware.ProcessAnalogControls(); + hardware.UpdateDigitalControls(); + #else + hardware.DebounceControls(); + hardware.UpdateAnalogControls(); + #endif - #if (GEN_DAISY_TARGET_FIELD) - hardware.ProcessAnalogControls(); - hardware.UpdateDigitalControls(); - #else - hardware.DebounceControls(); - hardware.UpdateAnalogControls(); - #endif + #ifdef OOPSY_TARGET_FIELD + encoder_held = hardware.GetSwitch(0)->Pressed(); + encoder_incr += hardware.GetSwitch(1)->FallingEdge(); + encoder_held_ms = hardware.GetSwitch(0)->TimeHeldMs(); + if (hardware.GetSwitch(0)->FallingEdge()) encoder_released = 1; + #else + encoder_held = hardware.encoder.Pressed(); + encoder_incr += hardware.encoder.Increment(); + encoder_held_ms = hardware.encoder.TimeHeldMs(); + if (hardware.encoder.FallingEdge()) encoder_released = 1; + #endif + } - #ifdef GEN_DAISY_TARGET_FIELD - encoder_held = hardware.GetSwitch(0)->Pressed(); - encoder_incr += hardware.GetSwitch(1)->FallingEdge(); - encoder_held_ms = hardware.GetSwitch(0)->TimeHeldMs(); - if (hardware.GetSwitch(0)->FallingEdge()) encoder_released = 1; - #else - encoder_held = hardware.encoder.Pressed(); - encoder_incr += hardware.encoder.Increment(); - encoder_held_ms = hardware.encoder.TimeHeldMs(); - if (hardware.encoder.FallingEdge()) encoder_released = 1; - #endif + void audio_postperform(float **hardware_ins, float **hardware_outs, size_t size) { + #ifdef OOPSY_TARGET_HAS_OLED + if (mode == MODE_SCOPE) { + // TODO: add selector for scope storage source: + float * buf = hardware_outs[0]; + size_t samples = scope_samples(); + for (size_t i=0; i pt0 ? pt0 : min0; + max0 = max0 < pt0 ? pt0 : max0; + } + scope_data[scope_step] = (min0); + scope_step++; + scope_data[scope_step] = (max0); + scope_step++; + if (scope_step >= SSD1309_WIDTH*2) scope_step = 0; + } + } + #endif + } - } + #ifdef OOPSY_TARGET_HAS_OLED + int scope_samples() { + // valid zoom sizes: 1, 2, 3, 4, 6, 8, 12, 16, 24 + switch(scope_zoom) { + case 1: case 2: case 3: case 4: return scope_zoom; break; + case 5: return 6; break; + case 6: return 8; break; + case 7: return 12; break; + case 8: return 16; break; + default: return 24; break; + } + } - void audio_postperform(float **hardware_ins, float **hardware_outs, size_t size) { - #ifdef GEN_DAISY_TARGET_HAS_OLED - if (mode == MODE_SCOPE) { - //scope.store(hardware_ins, size, samplerate); - //scope_store(hardware_outs[0], size, samplerate); - - float * buf = hardware_outs[0]; - size_t samples = scope_samples(); - for (size_t i=0; i pt0 ? pt0 : min0; - max0 = max0 < pt0 ? pt0 : max0; - } - scope_data[scope_step] = (min0); - scope_step++; - scope_data[scope_step] = (max0); - scope_step++; - if (scope_step >= SSD1309_WIDTH*2) scope_step = 0; + GenDaisy& console_display() { + for (int i=0; i + struct App { + + static void staticMainloopCallback(uint32_t t, uint32_t dt) { + T& self = *(T *)daisy.app; + self.mainloopCallback(daisy, t, dt); } - } - GenDaisy& console_display() { - for (int i=0; iaudioCallback(daisy, hardware_ins, hardware_outs, size); + daisy.audio_postperform(hardware_ins, hardware_outs, size); + // convert elapsed time (200Mhz ticks) to CPU percentage: + daisy.audioCpuUs = (dsy_tim_get_tick() - start) / 200; } - return *this; - } - #endif // GEN_DAISY_TARGET_HAS_OLED - - GenDaisy& log(const char * fmt, ...) { - #ifdef GEN_DAISY_TARGET_HAS_OLED - va_list argptr; - va_start(argptr, fmt); - vsnprintf(console_lines[console_line], console_cols, fmt, argptr); - va_end(argptr); - console_line = (console_line + 1) % console_rows; - #endif - return *this; - } + }; - static void nullAudioCallback(float **hardware_ins, float **hardware_outs, size_t size); - - static void nullMainloopCallback(uint32_t t, uint32_t dt) {} -} gendaisy; +}; // oopsy:: -void GenDaisy::nullAudioCallback(float **hardware_ins, float **hardware_outs, size_t size) { - gendaisy.nullAudioCallbackRunning = true; -} +void genlib_report_error(const char *s) { oopsy::daisy.log(s); } +void genlib_report_message(const char *s) { oopsy::daisy.log(s); } -void genlib_report_error(const char *s) { gendaisy.log(s); } -void genlib_report_message(const char *s) { gendaisy.log(s); } +unsigned long genlib_ticks() { return dsy_system_getnow(); } -// Curiously-recurring template to make App definitions simpler: -template -struct StaticApp { - - static void staticMainloopCallback(uint32_t t, uint32_t dt) { - T& self = *(T *)gendaisy.app; - self.mainloopCallback(gendaisy, t, dt); - } +t_ptr genlib_sysmem_newptr(t_ptr_size size) { + return (t_ptr)oopsy::allocate(size); +} + +t_ptr genlib_sysmem_newptrclear(t_ptr_size size) { + t_ptr p = genlib_sysmem_newptr(size); + if (p) oopsy::memset(p, 0, size); + return p; +} - static void staticAudioCallback(float **hardware_ins, float **hardware_outs, size_t size) { - uint32_t start = dsy_tim_get_tick(); // 200MHz - gendaisy.audio_preperform(size); - ((T *)gendaisy.app)->audioCallback(gendaisy, hardware_ins, hardware_outs, size); - gendaisy.audio_postperform(hardware_ins, hardware_outs, size); - // convert elapsed time (200Mhz ticks) to CPU percentage: - gendaisy.audioCpuUs = (dsy_tim_get_tick() - start) / 200; - } -}; #endif //GENLIB_DAISY_H diff --git a/source/oopsy.js b/source/oopsy.js index ef9e87a..cbaf6e5 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -166,13 +166,13 @@ LDFLAGS+=-u _printf_float fs.writeFileSync(path.join(build_path, `${build_name}_${target}.json`), JSON.stringify(gloos,null," "),"utf8"); const cppcode = `${ -target=="patch" ? "#define GEN_DAISY_TARGET_PATCH 1" : -target=="field" ? "#define GEN_DAISY_TARGET_FIELD 1" : -target=="petal" ? "#define GEN_DAISY_TARGET_PETAL 1" : -target=="pod" ? "#define GEN_DAISY_TARGET_POD 1" : +target=="patch" ? "#define OOPSY_TARGET_PATCH 1" : +target=="field" ? "#define OOPSY_TARGET_FIELD 1" : +target=="petal" ? "#define OOPSY_TARGET_PETAL 1" : +target=="pod" ? "#define OOPSY_TARGET_POD 1" : ""} -${gloos.some(g => g.has_midi_in || g.has_midi_out) ? "#define GEN_DAISY_TARGET_USES_MIDI_UART 1" : "// no midi"} -${(gloos.length > 1) ? "#define GEN_DAISY_MULTI_APP 1" : "// single app"} +${gloos.some(g => g.has_midi_in || g.has_midi_out) ? "#define OOPSY_TARGET_USES_MIDI_UART 1" : "// no midi"} +${(gloos.length > 1) ? "#define OOPSY_MULTI_APP 1" : "// single app"} #include "../genlib_daisy.h" #include "../genlib_daisy.cpp" @@ -184,12 +184,12 @@ union { ${gloos.map(gloo => gloo.cpp.union).join("\n\t")} } apps; -GenDaisy::AppDef appdefs[] = { +oopsy::AppDef appdefs[] = { ${gloos.map(gloo => gloo.cpp.appdef).join("\n\t")} }; int main(void) { - return gendaisy.run(appdefs, sizeof(appdefs)/sizeof(GenDaisy::AppDef)); + return oopsy::daisy.run(appdefs, ${gloos.length}); } ` fs.writeFileSync(maincpp_path, cppcode, "utf-8"); @@ -589,17 +589,17 @@ function generate_gloo(gloo) { const name = gloo.name; const struct = ` -struct App_${name} : public StaticApp { +struct App_${name} : public oopsy::App { ${gen.params .filter(name => nodes[name].src) .concat(daisy.cv_outs, daisy.gate_outs) .map(name=>` float ${name};`).join("")} ${gloo.audio_outs.map(name=>` - float ${name}[GEN_DAISY_BUFFER_SIZE];`).join("")} + float ${name}[OOPSY_BUFFER_SIZE];`).join("")} - void init(GenDaisy& gendaisy) { - gendaisy.gen = ${name}::create(gendaisy.samplerate, gendaisy.blocksize); + void init(oopsy::GenDaisy& daisy) { + daisy.gen = ${name}::create(daisy.samplerate, daisy.blocksize); ${gen.params .filter(name => nodes[name].src) .concat(daisy.cv_outs, daisy.gate_outs) @@ -607,18 +607,18 @@ struct App_${name} : public StaticApp { ${name} = 0.f;`).join("")} } - void mainloopCallback(GenDaisy& gendaisy, uint32_t t, uint32_t dt) { + void mainloopCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { // whatever handling is needed here - Daisy& hardware = gendaisy.hardware; + Daisy& hardware = daisy.hardware; ${daisy.cv_outs.concat(daisy.gate_outs) .filter(name => nodes[name].src || nodes[name].from.length) .map((name, i)=>` ${nodes[name].set}`).join("")} } - void audioCallback(GenDaisy& gendaisy, float **hardware_ins, float **hardware_outs, size_t size) { - Daisy& hardware = gendaisy.hardware; - ${name}::State& gen = *(${name}::State *)gendaisy.gen; + void audioCallback(oopsy::GenDaisy& daisy, float **hardware_ins, float **hardware_outs, size_t size) { + Daisy& hardware = daisy.hardware; + ${name}::State& gen = *(${name}::State *)daisy.gen; ${daisy.knobs .concat(daisy.switches, daisy.keys, daisy.cv_ins, daisy.gate_ins) .filter(name => nodes[name].to.length) @@ -633,7 +633,7 @@ struct App_${name} : public StaticApp { ${daisy.audio_outs.map((name, i)=>` float * ${name} = hardware_outs[${i}];`).join("")} ${gloo.has_midi_in ? daisy.midi_ins.map(name=>` - float * ${name} = gendaisy.midi.in_data;`).join("") : ''} + float * ${name} = oopsy::midi.in_data;`).join("") : ''} float * inputs[] = { ${gen.audio_ins.map(name=>nodes[name].src).join(", ")} }; float * outputs[] = { ${gen.audio_outs.map(name=>nodes[name].src).join(", ")} }; gen.perform(inputs, outputs, size); @@ -643,12 +643,12 @@ struct App_${name} : public StaticApp { ${name} = ${nodes[name].src};` : ` ${name} = ${nodes[name].from.map(name=>name+"[size-1]").join(" + ")};`).join("")} ${gloo.has_midi_out ? daisy.midi_outs.map(name=>nodes[name].from.map(name=>` - gendaisy.midi.postperform(${name}, size);`).join("")).join("") : ''} + oopsy::midi.postperform(${name}, size);`).join("")).join("") : ''} } };` gloo.cpp = { union: `App_${name} app_${name};`, - appdef: `{"${name}", []()->void { gendaisy.reset(apps.app_${name}); } },`, + appdef: `{"${name}", []()->void { oopsy::daisy.reset(apps.app_${name}); } },`, struct: struct, } return gloo From 91aa9a14feb562d939fd6302ef2166a6a3a6b7bc Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 07:47:08 -0500 Subject: [PATCH 08/58] first pass at generalizing the hardware JSONs; with setters getters and [out] names mostly generalized --- source/daisy.field.json | 56 ++++++++- source/daisy.patch.json | 28 ++++- source/daisy.petal.json | 25 +++- source/daisy.pod.json | 13 ++- source/genlib_daisy.h | 1 - source/oopsy.js | 252 +++++++++++++++++++++------------------- 6 files changed, 246 insertions(+), 129 deletions(-) diff --git a/source/daisy.field.json b/source/daisy.field.json index e566a0d..cb859b5 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -1,5 +1,55 @@ { - "audio_ins": [ + "defines": { + "OOPSY_TARGET_FIELD": 1 + }, + "labels": { + "outs": { + "cv": "dsy_cv_out1", + "cv1": "dsy_cv_out1", + "cv2": "dsy_cv_out2", + "gate": "dsy_gate_out1", + "gate1": "dsy_gate_out1" + } + }, + "getters": { + "knob1": "hardware.GetKnobValue(hardware.KNOB_1)", + "knob2": "hardware.GetKnobValue(hardware.KNOB_2)", + "knob3": "hardware.GetKnobValue(hardware.KNOB_3)", + "knob4": "hardware.GetKnobValue(hardware.KNOB_4)", + "knob5": "hardware.GetKnobValue(hardware.KNOB_5)", + "knob6": "hardware.GetKnobValue(hardware.KNOB_6)", + "knob7": "hardware.GetKnobValue(hardware.KNOB_7)", + "knob8": "hardware.GetKnobValue(hardware.KNOB_8)", + "key1": "(hardware.KeyboardState(0)?1.f:0.f)", + "key2": "(hardware.KeyboardState(1)?1.f:0.f)", + "key3": "(hardware.KeyboardState(2)?1.f:0.f)", + "key4": "(hardware.KeyboardState(3)?1.f:0.f)", + "key5": "(hardware.KeyboardState(4)?1.f:0.f)", + "key6": "(hardware.KeyboardState(5)?1.f:0.f)", + "key7": "(hardware.KeyboardState(6)?1.f:0.f)", + "key8": "(hardware.KeyboardState(7)?1.f:0.f)", + "key9": "(hardware.KeyboardState(8)?1.f:0.f)", + "key10": "(hardware.KeyboardState(9)?1.f:0.f)", + "key11": "(hardware.KeyboardState(10)?1.f:0.f)", + "key12": "(hardware.KeyboardState(11)?1.f:0.f)", + "key13": "(hardware.KeyboardState(12)?1.f:0.f)", + "key14": "(hardware.KeyboardState(13)?1.f:0.f)", + "key15": "(hardware.KeyboardState(14)?1.f:0.f)", + "key16": "(hardware.KeyboardState(15)?1.f:0.f)", + "switch1": "(hardware.GetSwitch(0)->Pressed()?1.f:0.f)", + "switch2": "(hardware.GetSwitch(1)->Pressed()?1.f:0.f)", + "cv_in1": "hardware.GetCvValue(0)", + "cv_in2": "hardware.GetCvValue(1)", + "cv_in3": "hardware.GetCvValue(2)", + "cv_in4": "hardware.GetCvValue(3)", + "gate_in1": "(hardware.gate_in_.State()?1.f:0.f)" + }, + "setters": { + "dsy_cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", + "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)", + "dsy_gate_out1": "dsy_gpio_write(&hardware.gate_out_, $ > 0.f)" + }, + "audio_ins": [ "dsy_in1", "dsy_in2" ], @@ -20,8 +70,8 @@ "cv_in4" ], "cv_outs": [ - "cv_out1", - "cv_out2" + "dsy_cv_out1", + "dsy_cv_out2" ], "knobs": [ "knob1", diff --git a/source/daisy.patch.json b/source/daisy.patch.json index 4413663..a8858a2 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -1,4 +1,29 @@ { + "defines": { + "OOPSY_TARGET_PATCH": 1 + }, + "labels": { + "outs": { + "cv": "dsy_cv_out1", + "cv1": "dsy_cv_out1", + "cv2": "dsy_cv_out2", + "gate": "dsy_gate_out1", + "gate1": "dsy_gate_out1" + } + }, + "getters": { + "cv_in1": "hardware.GetCtrlValue(hardware.CTRL_1)", + "cv_in2": "hardware.GetCtrlValue(hardware.CTRL_2)", + "cv_in3": "hardware.GetCtrlValue(hardware.CTRL_3)", + "cv_in4": "hardware.GetCtrlValue(hardware.CTRL_4)", + "gate_in1": "(hardware.gate_input[hardware.GATE_IN_1].State()?1.f:0.f)", + "gate_in2": "(hardware.gate_input[hardware.GATE_IN_2].State()?1.f:0.f)" + }, + "setters": { + "cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", + "cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)", + "gate_out1": "dsy_gpio_write(&hardware.gate_output, $ > 0.f)" + }, "audio_ins": [ "dsy_in1", "dsy_in2", @@ -34,8 +59,5 @@ "gate_outs": [ "gate_out1" ], - "encoder": [ - "encoder1" - ], "oled": true } \ No newline at end of file diff --git a/source/daisy.petal.json b/source/daisy.petal.json index b20670c..6229234 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -1,5 +1,25 @@ { - "audio_ins": [ + "defines": { + "OOPSY_TARGET_PETAL": 1 + }, + "getters": { + "knob1": "hardware.GetKnobValue(hardware.KNOB_1)", + "knob2": "hardware.GetKnobValue(hardware.KNOB_2)", + "knob3": "hardware.GetKnobValue(hardware.KNOB_3)", + "knob4": "hardware.GetKnobValue(hardware.KNOB_4)", + "knob5": "hardware.GetKnobValue(hardware.KNOB_5)", + "knob6": "hardware.GetKnobValue(hardware.KNOB_6)", + "switch1": "(hardware.switches[0].Pressed()?1.f:0.f)", + "switch2": "(hardware.switches[1].Pressed()?1.f:0.f)", + "switch3": "(hardware.switches[2].Pressed()?1.f:0.f)", + "switch4": "(hardware.switches[3].Pressed()?1.f:0.f)", + "switch5": "(hardware.switches[4].Pressed()?1.f:0.f)", + "switch6": "(hardware.switches[5].Pressed()?1.f:0.f)", + "switch7": "(hardware.switches[6].Pressed()?1.f:0.f)" + }, + "setters": { + }, + "audio_ins": [ "dsy_in1", "dsy_in2" ], @@ -33,9 +53,6 @@ "expression": [ "exp1" ], - "encoder": [ - "encoder1" - ], "leds": [ "led1", "led2", diff --git a/source/daisy.pod.json b/source/daisy.pod.json index f2ae002..43836b1 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -1,5 +1,16 @@ { - "audio_ins": [ + "defines": { + "OOPSY_TARGET_POD": 1 + }, + "getters": { + "knob1": "hardware.GetKnobValue(hardware.KNOB_1)", + "knob2": "hardware.GetKnobValue(hardware.KNOB_2)", + "switch1": "(hardware.button1.Pressed()?1.f:0.f)", + "switch2": "(hardware.button2.Pressed()?1.f:0.f)" + }, + "setters": { + }, + "audio_ins": [ "dsy_in1", "dsy_in2" ], diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index bf352a4..02bf7b5 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -350,7 +350,6 @@ namespace oopsy { #ifdef OOPSY_TARGET_HAS_OLED #ifdef OOPSY_MULTI_APP case MODE_MENU: { - FontDef& font = font; for (int i=0; i<8; i++) { if (i == app_selecting) { hardware.display.SetCursor(0, font.FontHeight * i); diff --git a/source/oopsy.js b/source/oopsy.js index cbaf6e5..2905198 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -107,15 +107,15 @@ function run() { console.log("maximum 8 apps supported currently") cpps.length = 8; } - let gloos = cpps.map(cpp_path => { + let apps = cpps.map(cpp_path => { assert(fs.existsSync(cpp_path), `couldn't find source C++ file ${cpp_path}`); - let gloo = analyze_cpp(fs.readFileSync(cpp_path, "utf8")); - gloo.hardware = hardware; - gloo.target = target; - gloo.path = cpp_path; - return gloo; + return { + path: cpp_path, + patch: analyze_cpp(fs.readFileSync(cpp_path, "utf8")) + } }) - let build_name = gloos.map(v=>v.name).join("_") + let build_name = apps.map(v=>v.patch.name).join("_") + // configure build path: const build_path = path.join(__dirname, `build_${build_name}_${target}`) @@ -123,6 +123,13 @@ function run() { // ensure build path exists: fs.mkdirSync(build_path, {recursive: true}); + let config = { + build_name: build_name, + build_path: build_path, + target: target, + hardware: hardware, + apps: apps, + } // add watcher if (watch && watchers.length < 1) { @@ -131,7 +138,6 @@ function run() { })) } - const makefile_path = path.join(build_path, `Makefile`) const bin_path = path.join(build_path, "build", build_name+".bin"); const maincpp_path = path.join(build_path, `${build_name}_${target}.cpp`); @@ -156,40 +162,37 @@ LDFLAGS+=-u _printf_float console.log(`\t${makefile_path}`) console.log(`\t${bin_path}`) - gloos.map(gloo => { - gloo.relative_path = path.relative(build_path, gloo.path); - generate_gloo(gloo); - return gloo; + apps.map(app => { + generate_app(app, hardware, target); + return app; }) - // store for debugging: - fs.writeFileSync(path.join(build_path, `${build_name}_${target}.json`), JSON.stringify(gloos,null," "),"utf8"); + let defines = Object.assign({}, hardware.defines); + if (apps.some(g => g.has_midi_in || g.has_midi_out)) defines.OOPSY_TARGET_USES_MIDI_UART = 1 + if (apps.length) defines.OOPSY_MULTI_APP = 1 - const cppcode = `${ -target=="patch" ? "#define OOPSY_TARGET_PATCH 1" : -target=="field" ? "#define OOPSY_TARGET_FIELD 1" : -target=="petal" ? "#define OOPSY_TARGET_PETAL 1" : -target=="pod" ? "#define OOPSY_TARGET_POD 1" : -""} -${gloos.some(g => g.has_midi_in || g.has_midi_out) ? "#define OOPSY_TARGET_USES_MIDI_UART 1" : "// no midi"} -${(gloos.length > 1) ? "#define OOPSY_MULTI_APP 1" : "// single app"} + // store for debugging: + fs.writeFileSync(path.join(build_path, `${build_name}_${target}.json`), JSON.stringify(config,null," "),"utf8"); + + const cppcode = `${Object.keys(defines).map(k => ` +#define ${k} (${defines[k]})`).join("")} #include "../genlib_daisy.h" #include "../genlib_daisy.cpp" -${gloos.map(gloo => `#include "${posixify_path(gloo.relative_path)}"`).join("\n")} -${gloos.map(gloo => gloo.cpp.struct).join("\n")} +${apps.map(app => `#include "${posixify_path(path.relative(build_path, app.path))}"`).join("\n")} +${apps.map(app => app.cpp.struct).join("\n")} // store apps in a union to re-use memory, since only one app is active at once: union { - ${gloos.map(gloo => gloo.cpp.union).join("\n\t")} + ${apps.map(app => app.cpp.union).join("\n\t")} } apps; oopsy::AppDef appdefs[] = { - ${gloos.map(gloo => gloo.cpp.appdef).join("\n\t")} + ${apps.map(app => app.cpp.appdef).join("\n\t")} }; int main(void) { - return oopsy::daisy.run(appdefs, ${gloos.length}); + return oopsy::daisy.run(appdefs, ${apps.length}); } ` fs.writeFileSync(maincpp_path, cppcode, "utf-8"); @@ -224,7 +227,7 @@ int main(void) { // if successful, try to upload to hardware: if (fs.existsSync(bin_path) && action=="upload") { - console.log("oopsy uploading", bin_path) + console.log("oopsy flashing...") if (os.platform() == "win32") { console.log(execSync("set PATH=%PATH%;/usr/local/bin && make program-dfu", { cwd: build_path }).toString()) @@ -234,7 +237,7 @@ int main(void) { //console.log(execSync("export PATH=$PATH:/usr/local/bin && make program-dfu", { cwd: build_path, stdio:'inherit' }) } - console.log("oopsy uploaded") + console.log("oopsy flashed") } } catch (e) { // errors from make here @@ -275,7 +278,7 @@ function analyze_cpp(cpp) { } function generate_daisy(hardware, nodes, target) { - return { + let daisy = { audio_ins: hardware.audio_ins.map((v, i)=>{ let name = `dsy_in${i+1}` nodes[name] = { @@ -316,98 +319,110 @@ function generate_daisy(hardware, nodes, target) { return name; }), + // DEVICE INPUTS: + // gpio_ins: Object.keys(hardware.getters).map(v => { + // let name = `dsy_${v}` + // nodes[name] = { + // to: [], + // get: hardware.getters[v], + // } + // return name; + // }), keys: hardware.keys.map((v, i)=>{ - let name = `dsy_key_in${i+1}` + let name = `dsy_${v}` nodes[name] = { - // buffername: name, - // index: i, to: [], - get: `(hardware.KeyboardState(${i})?1.f:0.f)`, + get: hardware.getters[v], } return name; }), switches: hardware.switches.map((v, i)=>{ - let name = `dsy_sw_in${i+1}` + let name = `dsy_${v}` nodes[name] = { - // buffername: name, - // index: i, to: [], - get: (target=="pod") ? `(hardware.button${i+1}.Pressed()?1.f:0.f)` : (target=="petal") ? `(hardware.switches[${i}].Pressed()?1.f:0.f)` : `(hardware.GetSwitch(${i})->Pressed()?1.f:0.f)`, + get: hardware.getters[v], } return name; }), knobs: hardware.knobs.map((v, i)=>{ - let name = `dsy_knob_in${i+1}` + let name = `dsy_${v}` nodes[name] = { - // buffername: name, - // index: i, to: [], - get: `hardware.GetKnobValue(hardware.KNOB_${i+1})`, + get: hardware.getters[v], } return name; }), cv_ins: hardware.cv_ins.map((v, i)=>{ - let name = `dsy_cv_in${i+1}` + let name = `dsy_${v}` nodes[name] = { - // buffername: name, - // index: i, to: [], - get: (target == "field") ? `hardware.GetCvValue(${i})` : `hardware.GetCtrlValue(hardware.CTRL_${i+1})`, - } - return name; - }), - cv_outs: hardware.cv_outs.map((v, i)=>{ - let name = `dsy_cv_out${i+1}` - nodes[name] = { - // buffername: name, - // index: i, - from: [], - set: `dsy_dac_write(DSY_DAC_CHN${i+1}, ${name} * 4095);` + get: hardware.getters[v], } return name; }), gate_ins: hardware.gate_ins.map((v, i)=>{ - let name = `dsy_gate_in${i+1}` + let name = `dsy_${v}` nodes[name] = { - // buffername: name, - // index: i, to: [], - get: (target == "field") ? `(hardware.gate_in_.State()?1.f:0.f)` : `(hardware.gate_input[hardware.GATE_IN_${i+1}].State()?1.f:0.f)` + get: hardware.getters[v], } return name; }), - gate_outs: hardware.gate_outs.map((v, i)=>{ - let name = `dsy_gate_out${i+1}` + + // DEVICE OUTPUTS: + gpio_outs: Object.keys(hardware.setters).map(v => { + let name = v nodes[name] = { - // buffername: name, - // index: i, from: [], - set: (target == "field") ? `dsy_gpio_write(&hardware.gate_out_, ${name} > 0.f);` : `dsy_gpio_write(&hardware.gate_output, ${name} > 0.f);` + set: interpolate(hardware.setters[v], {name: name}) } return name; - }) + }), + // cv_outs: hardware.cv_outs.map((v, i)=>{ + // let name = `dsy_${v}` + // nodes[name] = { + // // buffername: name, + // // index: i, + // from: [], + // //set: `dsy_dac_write(DSY_DAC_CHN${i+1}, ${name} * 4095);` + // set: interpolate(hardware.setters[v], {name: name}) + // } + // return name; + // }), + // gate_outs: hardware.gate_outs.map((v, i)=>{ + // let name = `dsy_${v}` + // nodes[name] = { + // // buffername: name, + // // index: i, + // from: [], + // //set: (target == "field") ? `dsy_gpio_write(&hardware.gate_out_, ${name} > 0.f);` : `dsy_gpio_write(&hardware.gate_output, ${name} > 0.f);` + // set: interpolate(hardware.setters[v], {name: name}) + // } + // return name; + // }) } -} + + daisy.gpio_ins = daisy.cv_ins.concat(daisy.gate_ins, daisy.switches, daisy.knobs, daisy.keys) + //daisy.gpio_outs = daisy.cv_outs.concat(daisy.gate_outs) -function generate_gloo(gloo) { - const {hardware, target} = gloo; + return daisy +} +function generate_app(app, hardware, target) { const nodes = {} const daisy = generate_daisy(hardware, nodes, target); const gen = {} - gloo.audio_outs = [] - gloo.has_midi_in = false - gloo.has_midi_out = false - - gloo.nodes = nodes; - gloo.daisy = daisy; - gloo.gen = gen; - gloo.nodes = nodes; + app.audio_outs = [] + app.has_midi_in = false + app.has_midi_out = false + app.nodes = nodes; + app.daisy = daisy; + app.gen = gen; + app.nodes = nodes; - - gen.audio_ins = gloo.ins.map((s, i)=>{ + gen.audio_ins = app.patch.ins.map((s, i)=>{ let name = "gen_in"+(i+1) let label = s.replace(/"/g, "").trim(); let src = null; @@ -415,7 +430,7 @@ function generate_gloo(gloo) { if (label == "midi") { if (daisy.midi_ins.length) { src = daisy.midi_ins[0] - gloo.has_midi_in = true; + app.has_midi_in = true; } } else if (daisy.audio_ins.length > 0) { src = daisy.audio_ins[i % daisy.audio_ins.length]; @@ -432,7 +447,7 @@ function generate_gloo(gloo) { return name; }) - gen.audio_outs = gloo.outs.map((s, i)=>{ + gen.audio_outs = app.patch.outs.map((s, i)=>{ let name = "gen_out"+(i+1) let label = s.replace(/"/g, "").trim(); let src = daisy.audio_outs[i]; @@ -446,7 +461,7 @@ function generate_gloo(gloo) { //label: s, to: [], } - gloo.audio_outs.push(src); + app.audio_outs.push(src); } nodes[name] = { // name: name, @@ -456,24 +471,26 @@ function generate_gloo(gloo) { } // figure out if the out buffer maps to anything: - let map - let match + + // TODO: do search-by-prefix: + let map //= hardware.labels.outs[label] + let maplabel + + Object.keys(hardware.labels.outs).sort().forEach(k => { + let match + if (match = new RegExp(`^${k}_?(.+)?`).exec(label)) { + map = hardware.labels.outs[k]; + maplabel = match[1] || label + } + }) + if (label == "midi") { map = daisy.midi_outs[0] - gloo.has_midi_out = true; - } else - // cv/ctrl[n] - if (match = label.match(/^(cv|ctrl)(\d*)$/)) { - map = daisy.cv_outs[(match[2] || 1) - 1] - label = match[3] || label - } else - // gate[n] - if (match = label.match(/^(gate)(\d*)$/)) { - map = daisy.gate_outs[(match[2] || 1) - 1] - label = match[3] || label - } else - // else it is audio data - { + app.has_midi_out = true; + } else if (map) { + label = maplabel + } else { + // else it is audio data nodes[src].src = src; } nodes[name].label = label @@ -485,7 +502,7 @@ function generate_gloo(gloo) { return name; }) - gen.params = gloo.params.map((param, i)=>{ + gen.params = app.patch.params.map((param, i)=>{ const varname = "gen_param_"+param.name; let src; @@ -521,7 +538,7 @@ function generate_gloo(gloo) { return varname; }) - gen.datas = gloo.datas.map((param, i)=>{ + gen.datas = app.patch.datas.map((param, i)=>{ const varname = "gen_data_"+param.name; let node = Object.assign({ varname: varname, @@ -574,35 +591,35 @@ function generate_gloo(gloo) { // normal cv outs etc. in the same way { let available = [] - daisy.cv_outs.forEach((name, i)=>{ + let i=0 + daisy.gpio_outs.forEach(name => { const node = nodes[name]; // does this output have an audio source? if (node.from.length) { available.push(name); } else if (available.length) { - //node.from.push( available[i % available.length] ); - node.src = available[i % available.length]; + node.src = available[i++ % available.length]; } - }); + }) } - const name = gloo.name; + const name = app.patch.name; const struct = ` struct App_${name} : public oopsy::App { ${gen.params .filter(name => nodes[name].src) - .concat(daisy.cv_outs, daisy.gate_outs) + .concat(daisy.gpio_outs) .map(name=>` float ${name};`).join("")} - ${gloo.audio_outs.map(name=>` + ${app.audio_outs.map(name=>` float ${name}[OOPSY_BUFFER_SIZE];`).join("")} void init(oopsy::GenDaisy& daisy) { daisy.gen = ${name}::create(daisy.samplerate, daisy.blocksize); ${gen.params .filter(name => nodes[name].src) - .concat(daisy.cv_outs, daisy.gate_outs) + .concat(daisy.gpio_outs) .map(name=>` ${name} = 0.f;`).join("")} } @@ -610,17 +627,16 @@ struct App_${name} : public oopsy::App { void mainloopCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { // whatever handling is needed here Daisy& hardware = daisy.hardware; - ${daisy.cv_outs.concat(daisy.gate_outs) + ${daisy.gpio_outs .filter(name => nodes[name].src || nodes[name].from.length) .map((name, i)=>` - ${nodes[name].set}`).join("")} + ${nodes[name].set};`).join("")} } void audioCallback(oopsy::GenDaisy& daisy, float **hardware_ins, float **hardware_outs, size_t size) { Daisy& hardware = daisy.hardware; ${name}::State& gen = *(${name}::State *)daisy.gen; - ${daisy.knobs - .concat(daisy.switches, daisy.keys, daisy.cv_ins, daisy.gate_ins) + ${daisy.gpio_ins .filter(name => nodes[name].to.length) .map(name=>` float ${name} = ${nodes[name].get};`).join("")} @@ -632,24 +648,26 @@ struct App_${name} : public oopsy::App { float * ${name} = hardware_ins[${i}];`).join("")} ${daisy.audio_outs.map((name, i)=>` float * ${name} = hardware_outs[${i}];`).join("")} - ${gloo.has_midi_in ? daisy.midi_ins.map(name=>` + ${app.has_midi_in ? daisy.midi_ins.map(name=>` float * ${name} = oopsy::midi.in_data;`).join("") : ''} + // ${gen.audio_ins.map(name=>nodes[name].label).join(", ")}: float * inputs[] = { ${gen.audio_ins.map(name=>nodes[name].src).join(", ")} }; + // ${gen.audio_outs.map(name=>nodes[name].label).join(", ")}: float * outputs[] = { ${gen.audio_outs.map(name=>nodes[name].src).join(", ")} }; gen.perform(inputs, outputs, size); - ${daisy.cv_outs.concat(daisy.gate_outs) + ${daisy.gpio_outs .filter(name => nodes[name].src || nodes[name].from.length > 0) .map(name => nodes[name].src ? ` ${name} = ${nodes[name].src};` : ` ${name} = ${nodes[name].from.map(name=>name+"[size-1]").join(" + ")};`).join("")} - ${gloo.has_midi_out ? daisy.midi_outs.map(name=>nodes[name].from.map(name=>` + ${app.has_midi_out ? daisy.midi_outs.map(name=>nodes[name].from.map(name=>` oopsy::midi.postperform(${name}, size);`).join("")).join("") : ''} } };` - gloo.cpp = { + app.cpp = { union: `App_${name} app_${name};`, appdef: `{"${name}", []()->void { oopsy::daisy.reset(apps.app_${name}); } },`, struct: struct, } - return gloo + return app } From 2aca48943037811f283977bd569e6393b905c00a Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 11:44:14 -0500 Subject: [PATCH 09/58] further abstraction of target features into the JSON files --- source/daisy.field.json | 118 +++++++++++++++++++++++++--------- source/daisy.patch.json | 6 +- source/oopsy.js | 139 ++++++++++------------------------------ 3 files changed, 123 insertions(+), 140 deletions(-) diff --git a/source/daisy.field.json b/source/daisy.field.json index cb859b5..ae3e58b 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -3,6 +3,62 @@ "OOPSY_TARGET_FIELD": 1 }, "labels": { + "params": { + "cv": "dsy_cv_in1", + "cv1": "dsy_cv_in1", + "cv2": "dsy_cv_in2", + "cv3": "dsy_cv_in3", + "cv4": "dsy_cv_in4", + "gate": "dsy_gate_in1", + "gate1": "dsy_gate_in1", + "knob": "dsy_knob", + "knob1": "dsy_knob1", + "knob2": "dsy_knob2", + "knob3": "dsy_knob3", + "knob4": "dsy_knob4", + "knob5": "dsy_knob5", + "knob6": "dsy_knob6", + "knob7": "dsy_knob7", + "knob8": "dsy_knob8", + "key": "dsy_key", + "key1": "dsy_key1", + "key2": "dsy_key2", + "key3": "dsy_key3", + "key4": "dsy_key4", + "key5": "dsy_key5", + "key6": "dsy_key6", + "key7": "dsy_key7", + "key8": "dsy_key8", + "key9": "dsy_key9", + "key10": "dsy_key10", + "key11": "dsy_key11", + "key12": "dsy_key12", + "key13": "dsy_key13", + "key14": "dsy_key14", + "key15": "dsy_key15", + "key16": "dsy_key16", + "keyA1": "dsy_key9", + "keyA2": "dsy_key10", + "keyA3": "dsy_key11", + "keyA4": "dsy_key12", + "keyA5": "dsy_key13", + "keyA6": "dsy_key14", + "keyA7": "dsy_key15", + "keyA8": "dsy_key16", + "keyB1": "dsy_key1", + "keyB2": "dsy_key2", + "keyB3": "dsy_key3", + "keyB4": "dsy_key4", + "keyB5": "dsy_key5", + "keyB6": "dsy_key6", + "keyB7": "dsy_key7", + "keyB8": "dsy_key8", + "switch": "dsy_switch1", + "switch1": "dsy_switch1", + "switch2": "dsy_switch2", + "sw1": "dsy_switch1", + "sw2": "dsy_switch2" + }, "outs": { "cv": "dsy_cv_out1", "cv1": "dsy_cv_out1", @@ -12,37 +68,37 @@ } }, "getters": { - "knob1": "hardware.GetKnobValue(hardware.KNOB_1)", - "knob2": "hardware.GetKnobValue(hardware.KNOB_2)", - "knob3": "hardware.GetKnobValue(hardware.KNOB_3)", - "knob4": "hardware.GetKnobValue(hardware.KNOB_4)", - "knob5": "hardware.GetKnobValue(hardware.KNOB_5)", - "knob6": "hardware.GetKnobValue(hardware.KNOB_6)", - "knob7": "hardware.GetKnobValue(hardware.KNOB_7)", - "knob8": "hardware.GetKnobValue(hardware.KNOB_8)", - "key1": "(hardware.KeyboardState(0)?1.f:0.f)", - "key2": "(hardware.KeyboardState(1)?1.f:0.f)", - "key3": "(hardware.KeyboardState(2)?1.f:0.f)", - "key4": "(hardware.KeyboardState(3)?1.f:0.f)", - "key5": "(hardware.KeyboardState(4)?1.f:0.f)", - "key6": "(hardware.KeyboardState(5)?1.f:0.f)", - "key7": "(hardware.KeyboardState(6)?1.f:0.f)", - "key8": "(hardware.KeyboardState(7)?1.f:0.f)", - "key9": "(hardware.KeyboardState(8)?1.f:0.f)", - "key10": "(hardware.KeyboardState(9)?1.f:0.f)", - "key11": "(hardware.KeyboardState(10)?1.f:0.f)", - "key12": "(hardware.KeyboardState(11)?1.f:0.f)", - "key13": "(hardware.KeyboardState(12)?1.f:0.f)", - "key14": "(hardware.KeyboardState(13)?1.f:0.f)", - "key15": "(hardware.KeyboardState(14)?1.f:0.f)", - "key16": "(hardware.KeyboardState(15)?1.f:0.f)", - "switch1": "(hardware.GetSwitch(0)->Pressed()?1.f:0.f)", - "switch2": "(hardware.GetSwitch(1)->Pressed()?1.f:0.f)", - "cv_in1": "hardware.GetCvValue(0)", - "cv_in2": "hardware.GetCvValue(1)", - "cv_in3": "hardware.GetCvValue(2)", - "cv_in4": "hardware.GetCvValue(3)", - "gate_in1": "(hardware.gate_in_.State()?1.f:0.f)" + "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_1)", + "dsy_knob2": "hardware.GetKnobValue(hardware.KNOB_2)", + "dsy_knob3": "hardware.GetKnobValue(hardware.KNOB_3)", + "dsy_knob4": "hardware.GetKnobValue(hardware.KNOB_4)", + "dsy_knob5": "hardware.GetKnobValue(hardware.KNOB_5)", + "dsy_knob6": "hardware.GetKnobValue(hardware.KNOB_6)", + "dsy_knob7": "hardware.GetKnobValue(hardware.KNOB_7)", + "dsy_knob8": "hardware.GetKnobValue(hardware.KNOB_8)", + "dsy_key1": "(hardware.KeyboardState(0)?1.f:0.f)", + "dsy_key2": "(hardware.KeyboardState(1)?1.f:0.f)", + "dsy_key3": "(hardware.KeyboardState(2)?1.f:0.f)", + "dsy_key4": "(hardware.KeyboardState(3)?1.f:0.f)", + "dsy_key5": "(hardware.KeyboardState(4)?1.f:0.f)", + "dsy_key6": "(hardware.KeyboardState(5)?1.f:0.f)", + "dsy_key7": "(hardware.KeyboardState(6)?1.f:0.f)", + "dsy_key8": "(hardware.KeyboardState(7)?1.f:0.f)", + "dsy_key9": "(hardware.KeyboardState(8)?1.f:0.f)", + "dsy_key10": "(hardware.KeyboardState(9)?1.f:0.f)", + "dsy_key11": "(hardware.KeyboardState(10)?1.f:0.f)", + "dsy_key12": "(hardware.KeyboardState(11)?1.f:0.f)", + "dsy_key13": "(hardware.KeyboardState(12)?1.f:0.f)", + "dsy_key14": "(hardware.KeyboardState(13)?1.f:0.f)", + "dsy_key15": "(hardware.KeyboardState(14)?1.f:0.f)", + "dsy_key16": "(hardware.KeyboardState(15)?1.f:0.f)", + "dsy_switch1": "(hardware.GetSwitch(0)->Pressed()?1.f:0.f)", + "dsy_switch2": "(hardware.GetSwitch(1)->Pressed()?1.f:0.f)", + "dsy_cv_in1": "hardware.GetCvValue(0)", + "dsy_cv_in2": "hardware.GetCvValue(1)", + "dsy_cv_in3": "hardware.GetCvValue(2)", + "dsy_cv_in4": "hardware.GetCvValue(3)", + "dsy_gate_in1": "(hardware.gate_in_.State()?1.f:0.f)" }, "setters": { "dsy_cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", diff --git a/source/daisy.patch.json b/source/daisy.patch.json index a8858a2..ce78308 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -20,9 +20,9 @@ "gate_in2": "(hardware.gate_input[hardware.GATE_IN_2].State()?1.f:0.f)" }, "setters": { - "cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", - "cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)", - "gate_out1": "dsy_gpio_write(&hardware.gate_output, $ > 0.f)" + "dsy_cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", + "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)", + "dsy_gate_out1": "dsy_gpio_write(&hardware.gate_output, $ > 0.f)" }, "audio_ins": [ "dsy_in1", diff --git a/source/oopsy.js b/source/oopsy.js index 2905198..a023412 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -19,6 +19,19 @@ function interpolate(str, data) { return str.replace(/\$<([^>]+)>/gm, (s, key) => data[key]) } +// prints a number as a C-style float: +function toCfloat(n) { + let s = (+n).toString(); + // add point if needed: + if (s.includes("e")) { + return s; + } else if (s.includes(".")) { + return s + "f"; + } else { + return s + ".f"; + } +} + const help = ` <[cmds]> <[target]> <[cpps]> @@ -320,48 +333,8 @@ function generate_daisy(hardware, nodes, target) { }), // DEVICE INPUTS: - // gpio_ins: Object.keys(hardware.getters).map(v => { - // let name = `dsy_${v}` - // nodes[name] = { - // to: [], - // get: hardware.getters[v], - // } - // return name; - // }), - keys: hardware.keys.map((v, i)=>{ - let name = `dsy_${v}` - nodes[name] = { - to: [], - get: hardware.getters[v], - } - return name; - }), - switches: hardware.switches.map((v, i)=>{ - let name = `dsy_${v}` - nodes[name] = { - to: [], - get: hardware.getters[v], - } - return name; - }), - knobs: hardware.knobs.map((v, i)=>{ - let name = `dsy_${v}` - nodes[name] = { - to: [], - get: hardware.getters[v], - } - return name; - }), - cv_ins: hardware.cv_ins.map((v, i)=>{ - let name = `dsy_${v}` - nodes[name] = { - to: [], - get: hardware.getters[v], - } - return name; - }), - gate_ins: hardware.gate_ins.map((v, i)=>{ - let name = `dsy_${v}` + gpio_ins: Object.keys(hardware.getters).map(v => { + let name = v nodes[name] = { to: [], get: hardware.getters[v], @@ -378,33 +351,7 @@ function generate_daisy(hardware, nodes, target) { } return name; }), - // cv_outs: hardware.cv_outs.map((v, i)=>{ - // let name = `dsy_${v}` - // nodes[name] = { - // // buffername: name, - // // index: i, - // from: [], - // //set: `dsy_dac_write(DSY_DAC_CHN${i+1}, ${name} * 4095);` - // set: interpolate(hardware.setters[v], {name: name}) - // } - // return name; - // }), - // gate_outs: hardware.gate_outs.map((v, i)=>{ - // let name = `dsy_${v}` - // nodes[name] = { - // // buffername: name, - // // index: i, - // from: [], - // //set: (target == "field") ? `dsy_gpio_write(&hardware.gate_out_, ${name} > 0.f);` : `dsy_gpio_write(&hardware.gate_output, ${name} > 0.f);` - // set: interpolate(hardware.setters[v], {name: name}) - // } - // return name; - // }) } - - daisy.gpio_ins = daisy.cv_ins.concat(daisy.gate_ins, daisy.switches, daisy.knobs, daisy.keys) - //daisy.gpio_outs = daisy.cv_outs.concat(daisy.gate_outs) - return daisy } @@ -472,10 +419,9 @@ function generate_app(app, hardware, target) { // figure out if the out buffer maps to anything: - // TODO: do search-by-prefix: - let map //= hardware.labels.outs[label] + // search for a matching [out] name / prefix: + let map let maplabel - Object.keys(hardware.labels.outs).sort().forEach(k => { let match if (match = new RegExp(`^${k}_?(.+)?`).exec(label)) { @@ -483,7 +429,6 @@ function generate_app(app, hardware, target) { maplabel = match[1] || label } }) - if (label == "midi") { map = daisy.midi_outs[0] app.has_midi_out = true; @@ -504,34 +449,24 @@ function generate_app(app, hardware, target) { gen.params = app.patch.params.map((param, i)=>{ const varname = "gen_param_"+param.name; + let src, label; - let src; - let label; - let match; - if (match = param.name.match(/^(cv|ctrl)(\d*)_?(.+)?/)) { - src = daisy.cv_ins[(match[2] || 1) - 1] - label = match[3] || param.name - } - else if (match = param.name.match(/^(gate)(\d*)_?(.+)?/)) { - src = daisy.gate_ins[(match[2] || 1) - 1] - label = match[3] || param.name - } - else if (match = param.name.match(/^(knob)(\d*)_?(.+)?/)) { - src = daisy.knobs[(match[2] || 1) - 1] - label = match[3] || param.name - } - else if (match = param.name.match(/^(key)(\d*)_?(.+)?/)) { - src = daisy.keys[(match[2] || 1) - 1] - label = match[3] || param.name - } + // search for a matching [out] name / prefix: + Object.keys(hardware.labels.params).sort().forEach(k => { + let match + if (match = new RegExp(`^${k}_?(.+)?`).exec(param.name)) { + src = hardware.labels.params[k]; + label = match[1] || param.name + } + }) let node = Object.assign({ varname: varname, - label: label, + label: label || param.name, src: src, }, param); - nodes[varname] = node; + if (src) { nodes[src].to.push(varname) } @@ -547,28 +482,20 @@ function generate_app(app, hardware, target) { nodes[varname] = node; return varname; }) + // fill all my holes // map unused cvs/knobs to unmapped params let upi=0; // unused param index let param = gen.params[upi]; - daisy.knobs.forEach((name, i)=>{ - const node = nodes[name]; - if (node.to.length == 0) { - // find next param without a src: - while (param && !!nodes[param].src) param = gen.params[++upi]; - if (param) { - nodes[param].src = name; - node.to.push(param); - } - } - }) - daisy.cv_ins.forEach((name, i)=>{ + Object.keys(hardware.getters).forEach(name => { const node = nodes[name]; if (node.to.length == 0) { + //console.log(name, "not mapped") // find next param without a src: while (param && !!nodes[param].src) param = gen.params[++upi]; if (param) { + //console.log("map to", param) nodes[param].src = name; node.to.push(param); } @@ -642,7 +569,7 @@ struct App_${name} : public oopsy::App { float ${name} = ${nodes[name].get};`).join("")} ${gen.params.filter(name => nodes[name].src).map(name=>` // ${nodes[name].label} - ${name} = ${nodes[name].src}*${nodes[name].max-nodes[name].min} + ${nodes[name].min}; + ${name} = ${nodes[name].src}*${toCfloat(nodes[name].max-nodes[name].min)} + ${toCfloat(nodes[name].min)}; gen.set_${nodes[name].name}(${name});`).join("")} ${daisy.audio_ins.map((name, i)=>` float * ${name} = hardware_ins[${i}];`).join("")} From ade5c8640fd10965b20616b93109548736d7a64a Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 11:44:26 -0500 Subject: [PATCH 10/58] further abstraction of target features into the JSON files --- source/daisy.field.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/source/daisy.field.json b/source/daisy.field.json index ae3e58b..4c60093 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -139,12 +139,6 @@ "knob7", "knob8" ], - "gate_ins": [ - "gate_in1" - ], - "gate_outs": [ - "gate_out1" - ], "leds": [ "led1", "led2", From e6b78b3474f9e69a4d493c8da2eca98c3a722f8c Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 11:57:39 -0500 Subject: [PATCH 11/58] further abstraction of target features into the JSON files incl. patch field pod petal --- source/daisy.field.json | 72 +------------------------------- source/daisy.patch.json | 38 +++++++---------- source/daisy.petal.json | 92 ++++++++++++++++++++--------------------- source/daisy.pod.json | 44 +++++++++----------- source/oopsy.js | 2 +- 5 files changed, 82 insertions(+), 166 deletions(-) diff --git a/source/daisy.field.json b/source/daisy.field.json index 4c60093..417f78b 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -11,7 +11,7 @@ "cv4": "dsy_cv_in4", "gate": "dsy_gate_in1", "gate1": "dsy_gate_in1", - "knob": "dsy_knob", + "knob": "dsy_knob1", "knob1": "dsy_knob1", "knob2": "dsy_knob2", "knob3": "dsy_knob3", @@ -20,7 +20,7 @@ "knob6": "dsy_knob6", "knob7": "dsy_knob7", "knob8": "dsy_knob8", - "key": "dsy_key", + "key": "dsy_key1", "key1": "dsy_key1", "key2": "dsy_key2", "key3": "dsy_key3", @@ -119,73 +119,5 @@ "midi_outs": [ "dsy_midi_out1" ], - "cv_ins": [ - "cv_in1", - "cv_in2", - "cv_in3", - "cv_in4" - ], - "cv_outs": [ - "dsy_cv_out1", - "dsy_cv_out2" - ], - "knobs": [ - "knob1", - "knob2", - "knob3", - "knob4", - "knob5", - "knob6", - "knob7", - "knob8" - ], - "leds": [ - "led1", - "led2", - "led3", - "led4", - "led5", - "led6", - "led7", - "led8", - "ledA1", - "ledA2", - "ledA3", - "ledA4", - "ledA5", - "ledA6", - "ledA7", - "ledA8", - "ledB1", - "ledB2", - "ledB3", - "ledB4", - "ledB5", - "ledB6", - "ledB7", - "ledB8" - ], - "switches": [ - "switch1", - "switch2" - ], - "keys": [ - "key1", - "key2", - "key3", - "key4", - "key5", - "key6", - "key7", - "key8", - "key9", - "key10", - "key11", - "key12", - "key13", - "key14", - "key15", - "key16" - ], "oled": true } \ No newline at end of file diff --git a/source/daisy.patch.json b/source/daisy.patch.json index ce78308..dc07bb1 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -3,6 +3,15 @@ "OOPSY_TARGET_PATCH": 1 }, "labels": { + "params": { + "cv": "dsy_cv_in1", + "cv1": "dsy_cv_in1", + "cv2": "dsy_cv_in2", + "cv3": "dsy_cv_in3", + "cv4": "dsy_cv_in4", + "gate": "dsy_gate_in1", + "gate1": "dsy_gate_in1" + }, "outs": { "cv": "dsy_cv_out1", "cv1": "dsy_cv_out1", @@ -12,12 +21,12 @@ } }, "getters": { - "cv_in1": "hardware.GetCtrlValue(hardware.CTRL_1)", - "cv_in2": "hardware.GetCtrlValue(hardware.CTRL_2)", - "cv_in3": "hardware.GetCtrlValue(hardware.CTRL_3)", - "cv_in4": "hardware.GetCtrlValue(hardware.CTRL_4)", - "gate_in1": "(hardware.gate_input[hardware.GATE_IN_1].State()?1.f:0.f)", - "gate_in2": "(hardware.gate_input[hardware.GATE_IN_2].State()?1.f:0.f)" + "dsy_cv_in1": "hardware.GetCtrlValue(hardware.CTRL_1)", + "dsy_cv_in2": "hardware.GetCtrlValue(hardware.CTRL_2)", + "dsy_cv_in3": "hardware.GetCtrlValue(hardware.CTRL_3)", + "dsy_cv_in4": "hardware.GetCtrlValue(hardware.CTRL_4)", + "dsy_gate_in1": "(hardware.gate_input[hardware.GATE_IN_1].State()?1.f:0.f)", + "dsy_gate_in2": "(hardware.gate_input[hardware.GATE_IN_2].State()?1.f:0.f)" }, "setters": { "dsy_cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", @@ -42,22 +51,5 @@ "midi_outs": [ "dsy_midi_out1" ], - "cv_ins": [ - "cv_in1", - "cv_in2", - "cv_in3", - "cv_in4" - ], - "cv_outs": [ - "cv_out1", - "cv_out2" - ], - "gate_ins": [ - "gate_in1", - "gate_in2" - ], - "gate_outs": [ - "gate_out1" - ], "oled": true } \ No newline at end of file diff --git a/source/daisy.petal.json b/source/daisy.petal.json index 6229234..68f0091 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -2,22 +2,52 @@ "defines": { "OOPSY_TARGET_PETAL": 1 }, + "labels": { + "params": { + "knob": "dsy_knob1", + "knob1": "dsy_knob1", + "knob2": "dsy_knob2", + "knob3": "dsy_knob3", + "knob4": "dsy_knob4", + "knob5": "dsy_knob5", + "knob6": "dsy_knob6", + "switch": "dsy_switch1", + "switch1": "dsy_switch1", + "switch2": "dsy_switch2", + "switch3": "dsy_switch3", + "switch4": "dsy_switch4", + "switch5": "dsy_switch5", + "switch6": "dsy_switch6", + "switch7": "dsy_switch7", + "sw1": "dsy_switch1", + "sw2": "dsy_switch2", + "sw3": "dsy_switch3", + "sw4": "dsy_switch4", + "sw5": "dsy_switch5", + "sw6": "dsy_switch6", + "sw7": "dsy_switch7" + }, + "outs": { + + } + }, "getters": { - "knob1": "hardware.GetKnobValue(hardware.KNOB_1)", - "knob2": "hardware.GetKnobValue(hardware.KNOB_2)", - "knob3": "hardware.GetKnobValue(hardware.KNOB_3)", - "knob4": "hardware.GetKnobValue(hardware.KNOB_4)", - "knob5": "hardware.GetKnobValue(hardware.KNOB_5)", - "knob6": "hardware.GetKnobValue(hardware.KNOB_6)", - "switch1": "(hardware.switches[0].Pressed()?1.f:0.f)", - "switch2": "(hardware.switches[1].Pressed()?1.f:0.f)", - "switch3": "(hardware.switches[2].Pressed()?1.f:0.f)", - "switch4": "(hardware.switches[3].Pressed()?1.f:0.f)", - "switch5": "(hardware.switches[4].Pressed()?1.f:0.f)", - "switch6": "(hardware.switches[5].Pressed()?1.f:0.f)", - "switch7": "(hardware.switches[6].Pressed()?1.f:0.f)" + "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_1)", + "dsy_knob2": "hardware.GetKnobValue(hardware.KNOB_2)", + "dsy_knob3": "hardware.GetKnobValue(hardware.KNOB_3)", + "dsy_knob4": "hardware.GetKnobValue(hardware.KNOB_4)", + "dsy_knob5": "hardware.GetKnobValue(hardware.KNOB_5)", + "dsy_knob6": "hardware.GetKnobValue(hardware.KNOB_6)", + "dsy_switch1": "(hardware.switches[0].Pressed()?1.f:0.f)", + "dsy_switch2": "(hardware.switches[1].Pressed()?1.f:0.f)", + "dsy_switch3": "(hardware.switches[2].Pressed()?1.f:0.f)", + "dsy_switch4": "(hardware.switches[3].Pressed()?1.f:0.f)", + "dsy_switch5": "(hardware.switches[4].Pressed()?1.f:0.f)", + "dsy_switch6": "(hardware.switches[5].Pressed()?1.f:0.f)", + "dsy_switch7": "(hardware.switches[6].Pressed()?1.f:0.f)" }, "setters": { + }, "audio_ins": [ "dsy_in1", @@ -28,39 +58,5 @@ "dsy_out2" ], "midi_ins": [], - "midi_outs": [], - "cv_ins": [], - "cv_outs": [], - "gate_ins": [], - "gate_outs": [], - "knobs": [ - "knob1", - "knob2", - "knob3", - "knob4", - "knob5", - "knob6" - ], - "switches": [ - "switch1", - "switch2", - "switch3", - "switch4", - "switch5", - "switch6", - "switch7" - ], - "expression": [ - "exp1" - ], - "leds": [ - "led1", - "led2", - "led3", - "led4", - "led5", - "led6", - "led7", - "led8" - ] + "midi_outs": [] } \ No newline at end of file diff --git a/source/daisy.pod.json b/source/daisy.pod.json index 43836b1..db5de70 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -2,11 +2,26 @@ "defines": { "OOPSY_TARGET_POD": 1 }, + "labels": { + "params": { + "knob": "dsy_knob1", + "knob1": "dsy_knob1", + "knob2": "dsy_knob2", + "switch": "dsy_switch1", + "switch1": "dsy_switch1", + "switch2": "dsy_switch2", + "sw1": "dsy_switch1", + "sw2": "dsy_switch2" + }, + "outs": { + + } + }, "getters": { - "knob1": "hardware.GetKnobValue(hardware.KNOB_1)", - "knob2": "hardware.GetKnobValue(hardware.KNOB_2)", - "switch1": "(hardware.button1.Pressed()?1.f:0.f)", - "switch2": "(hardware.button2.Pressed()?1.f:0.f)" + "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_1)", + "dsy_knob2": "hardware.GetKnobValue(hardware.KNOB_2)", + "dsy_switch1": "(hardware.button1.Pressed()?1.f:0.f)", + "dsy_switch2": "(hardware.button2.Pressed()?1.f:0.f)" }, "setters": { }, @@ -21,24 +36,5 @@ "midi_ins": [ "dsy_midi_in1" ], - "midi_outs": [], - "switches": [ - "switch1", - "switch2" - ], - "cv_ins": [], - "cv_outs": [], - "gate_ins": [], - "gate_outs": [], - "knobs": [ - "knob1", - "knob2" - ], - "encoder": [ - "encoder1" - ], - "leds": [ - "led1", - "led2" - ] + "midi_outs": [] } \ No newline at end of file diff --git a/source/oopsy.js b/source/oopsy.js index a023412..cb12e27 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -459,7 +459,7 @@ function generate_app(app, hardware, target) { label = match[1] || param.name } }) - + let node = Object.assign({ varname: varname, label: label || param.name, From c4a60bb74a56163793a0dd23eb6baefa9cd2a293 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 12:57:20 -0500 Subject: [PATCH 12/58] move more #defines to JSON files --- source/genlib_daisy.h | 33 +++++++++++++++------------------ source/oopsy.js | 8 +++++--- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 02bf7b5..fe39836 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -10,31 +10,29 @@ #include // vprintf #if defined(OOPSY_TARGET_PATCH) -#include "daisy_patch.h" -#define OOPSY_TARGET_HAS_OLED 1 -#define OOPSY_IO_COUNT (4) -typedef daisy::DaisyPatch Daisy; + #include "daisy_patch.h" + #define OOPSY_IO_COUNT (4) + typedef daisy::DaisyPatch Daisy; #elif defined(OOPSY_TARGET_FIELD) -#include "daisy_field.h" -#define OOPSY_TARGET_HAS_OLED 1 -#define OOPSY_IO_COUNT (2) -typedef daisy::DaisyField Daisy; + #include "daisy_field.h" + #define OOPSY_IO_COUNT (2) + typedef daisy::DaisyField Daisy; #elif defined(OOPSY_TARGET_PETAL) -#include "daisy_petal.h" -#define OOPSY_IO_COUNT (2) -typedef daisy::DaisyPetal Daisy; + #include "daisy_petal.h" + #define OOPSY_IO_COUNT (2) + typedef daisy::DaisyPetal Daisy; #elif defined(OOPSY_TARGET_POD) -#include "daisy_pod.h" -#define OOPSY_IO_COUNT (2) -typedef daisy::DaisyPod Daisy; + #include "daisy_pod.h" + #define OOPSY_IO_COUNT (2) + typedef daisy::DaisyPod Daisy; #else -#include "daisy_seed.h" -#define OOPSY_IO_COUNT (2) -typedef daisy::DaisySeed Daisy; + #include "daisy_seed.h" + #define OOPSY_IO_COUNT (2) + typedef daisy::DaisySeed Daisy; #endif @@ -215,7 +213,6 @@ namespace oopsy { void * gen = nullptr; bool nullAudioCallbackRunning = false; - //Console console; #ifdef OOPSY_TARGET_HAS_OLED FontDef& font = Font_6x8; uint_fast8_t scope_zoom = 5; diff --git a/source/oopsy.js b/source/oopsy.js index cb12e27..58574d3 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -181,9 +181,11 @@ LDFLAGS+=-u _printf_float }) let defines = Object.assign({}, hardware.defines); - if (apps.some(g => g.has_midi_in || g.has_midi_out)) defines.OOPSY_TARGET_USES_MIDI_UART = 1 - if (apps.length) defines.OOPSY_MULTI_APP = 1 - + if (apps.some(g => (g.has_midi_in && hardware.midi_ins.length) || (g.has_midi_out && hardware.midi_outs.length))) { + defines.OOPSY_TARGET_USES_MIDI_UART = 1 + } + if (apps.length > 1) defines.OOPSY_MULTI_APP = 1 + if (hardware.oled) defines.OOPSY_TARGET_HAS_OLED = 1 // store for debugging: fs.writeFileSync(path.join(build_path, `${build_name}_${target}.json`), JSON.stringify(config,null," "),"utf8"); From 1547fef02cde71e4ee89cb87a90666bd02017df3 Mon Sep 17 00:00:00 2001 From: stephenhensley Date: Thu, 19 Nov 2020 11:06:43 -0800 Subject: [PATCH 13/58] updated libdaisy ref. --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index d6214ef..9a5e2fb 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit d6214ef2bd9ebfd9f40dbe3645c9beb8baaba001 +Subproject commit 9a5e2fbe06d7c4da5b60efb955f77ef9356a7ab2 From 6bc475185ce6fca3e21742f9392331fb9cb4ae25 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 16:48:42 -0500 Subject: [PATCH 14/58] working on petal app selection --- source/genlib_daisy.h | 74 +++++++++++++++++++++++++++++++++---------- source/oopsy.js | 42 +++++++++++++++++------- 2 files changed, 89 insertions(+), 27 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index fe39836..85f03f0 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -108,7 +108,8 @@ namespace oopsy { // } struct Timer { - int32_t period = OOPSY_DISPLAY_PERIOD_MS, t=0; + int32_t period = OOPSY_DISPLAY_PERIOD_MS, + t = OOPSY_DISPLAY_PERIOD_MS; bool ready(int32_t dt) { t += dt; @@ -284,19 +285,57 @@ namespace oopsy { uint32_t t1 = dsy_system_getnow(); dt = t1-t; t = t1; - - #ifdef OOPSY_TARGET_USES_MIDI_UART - midi.mainloop(); - #endif - // handle app-level code (e.g. for LED/CV/gate outs) - mainloopCallback(t, dt); if (uitimer.ready(dt)) { - // Handle encoder press/longpress actions: + + #ifdef OOPSY_TARGET_USES_MIDI_UART + midi.mainloop(); + #endif + + // CLEAR DISPLAY + #ifdef OOPSY_TARGET_HAS_OLED + hardware.display.Fill(false); + #endif + #ifdef OOPSY_TARGET_PETAL + hardware.ClearLeds(); + #endif + + // handle app-level code (e.g. for LED/CV/gate outs) + mainloopCallback(t, dt); + + #ifdef OOPSY_TARGET_PETAL + for(int i = 0; i < 8; i++) { + float selected = (i == app_selected) * 1.f; + float selecting = (i == app_selecting) * 1.f; + float selectable = (i < app_count) * 0.5f; + float menu = (mode == MODE_MENU) * 1.f; + float released = encoder_released * 1.f; + hardware.SetRingLed((daisy::DaisyPetal::RingLed)i, + selected + menu * selecting + released, + menu * selecting + released, + menu * (selecting + selectable) + released + ); + } + #endif //OOPSY_TARGET_PETAL + if (encoder_held_ms > OOPSY_LONG_PRESS_MS) { // LONG PRESS + #if defined(OOPSY_TARGET_PETAL) + #if defined(OOPSY_MULTI_APP) + mode = MODE_MENU; + is_mode_selecting = 0; + #endif // OOPSY_MULTI_APP + #else // !OOPSY_TARGET_PETAL is_mode_selecting = 1; - } + #endif + } else { + #if defined(OOPSY_TARGET_PETAL) + #if defined(OOPSY_MULTI_APP) + mode = MODE_NONE; + is_mode_selecting = 0; + #endif // OOPSY_MULTI_APP + #endif // !OOPSY_TARGET_PETAL + } // Handle encoder increment actions: if (is_mode_selecting) { @@ -308,7 +347,7 @@ namespace oopsy { app_selecting += encoder_incr; if (app_selecting >= app_count) app_selecting -= app_count; if (app_selecting < 0) app_selecting += app_count; - #endif + #endif // OOPSY_MULTI_APP #ifdef OOPSY_TARGET_HAS_OLED } else if (mode == MODE_SCOPE) { if (encoder_incr > 0) { @@ -318,7 +357,7 @@ namespace oopsy { scope_zoom = scope_zoom - 1; if (scope_zoom < 1) scope_zoom = OOPSY_SCOPE_MAX_ZOOM; } - #endif + #endif //OOPSY_TARGET_HAS_OLED } encoder_incr = 0; @@ -338,10 +377,6 @@ namespace oopsy { } encoder_released = 0; - // DISPLAY - #ifdef OOPSY_TARGET_HAS_OLED - hardware.display.Fill(false); - #endif switch(mode) { #ifdef OOPSY_TARGET_HAS_OLED @@ -380,10 +415,11 @@ namespace oopsy { break; } - #else //OOPSY_TARGET_HAS_OLED + #else // !OOPSY_TARGET_HAS_OLED #ifdef OOPSY_MULTI_APP case MODE_MENU: { // TODO show menu selection via LEDs + } break; #endif #endif //OOPSY_TARGET_HAS_OLED @@ -414,6 +450,12 @@ namespace oopsy { } hardware.display.Update(); #endif //OOPSY_TARGET_HAS_OLED + + #ifdef OOPSY_TARGET_PETAL + hardware.UpdateLeds(); + #endif //OOPSY_TARGET_PETAL + + } // uitimer.ready } return 0; diff --git a/source/oopsy.js b/source/oopsy.js index 58574d3..abe148b 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -84,22 +84,40 @@ function run() { case "petal": case "patch": {target = arg;} break; case "watch": watch=true; break; + default: { - let p = path.parse(arg); - switch(p.ext) { - case ".json": {target_path = arg; target = ""}; break; - case ".cpp": cpps.push(arg); break; - // case ".gendsp": - // case ".maxpat": - // case ".maxhelp": {pat_path = arg}; break; - default: { - console.warn("unexpected input", arg); + + if (fs.existsSync(arg)) { + if (fs.lstatSync(arg).isDirectory()) { + // add a whole folder full of cpps: + cpps = cpps.concat(fs.readdirSync(arg) + .filter(s => path.parse(s).ext == ".cpp") + .map(s => path.join(arg, s)) + ) + } else { + let p = path.parse(arg); + switch(p.ext) { + case ".json": {target_path = arg; target = ""}; break; + case ".cpp": cpps.push(arg); break; + // case ".gendsp": + // case ".maxpat": + // case ".maxhelp": {pat_path = arg}; break; + default: { + console.warn("unexpected input", arg); + } + } } } } } }); + // remove duplicates: + cpps = cpps.reduce(function (acc, s) { + if (acc.indexOf(s) === -1) acc.push(s) + return acc + }, []); + // configure target: if (!target && !target_path) target = "patch"; if (!target_path) { @@ -167,9 +185,11 @@ include $(SYSTEM_FILES_DIR)/Makefile # Include the gen_dsp files CFLAGS+=-I"${posixify_path(path.relative(build_path, path.join(__dirname, "gen_dsp")))}" CFLAGS+=-Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -# Enable printing of floats (for OLED display) -LDFLAGS+=-u _printf_float `, "utf-8"); + + // didn't seem to be working: + //# Enable printing of floats (for OLED display) + //LDFLAGS+=-u _printf_float console.log(`Will ${action} from ${cpps.join(", ")} by writing to:`) console.log(`\t${maincpp_path}`) console.log(`\t${makefile_path}`) From 98f144978389b88d8bce96bd730f9e270c4c0869 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 19 Nov 2020 17:22:02 -0500 Subject: [PATCH 15/58] petal app selecting menu --- install.sh | 2 +- source/genlib_daisy.h | 38 ++++++++++++++++---------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/install.sh b/install.sh index 745c458..8505711 100755 --- a/install.sh +++ b/install.sh @@ -15,5 +15,5 @@ echo "rebuilding libdaisy" cd source cd libdaisy make clean | grep "warningr:\|error:" -make | grep "warning:r\|error:" +make -j4 | grep "warning:r\|error:" echo "done building libdaisy" diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 85f03f0..ed4096d 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -281,6 +281,8 @@ namespace oopsy { #ifdef OOPSY_TARGET_HAS_OLED console_display(); #endif + + static bool blink; while(1) { uint32_t t1 = dsy_system_getnow(); dt = t1-t; @@ -304,37 +306,30 @@ namespace oopsy { mainloopCallback(t, dt); #ifdef OOPSY_TARGET_PETAL + // petal has no mode selection + is_mode_selecting = 0; + #if defined(OOPSY_MULTI_APP) + // multi-app petal is always in menu mode: + mode = MODE_MENU; + #endif + // blink = !blink; + // hardware.SetFootswitchLed((daisy::DaisyPetal::FootswitchLed)0, blink); + for(int i = 0; i < 8; i++) { - float selected = (i == app_selected) * 1.f; - float selecting = (i == app_selecting) * 1.f; - float selectable = (i < app_count) * 0.5f; - float menu = (mode == MODE_MENU) * 1.f; - float released = encoder_released * 1.f; + float white = (i == app_selecting || encoder_released); hardware.SetRingLed((daisy::DaisyPetal::RingLed)i, - selected + menu * selecting + released, - menu * selecting + released, - menu * (selecting + selectable) + released + (i == app_selected || white) * 1.f, + white * 1.f, + (i < app_count) * 0.3f + white * 1.f ); } #endif //OOPSY_TARGET_PETAL if (encoder_held_ms > OOPSY_LONG_PRESS_MS) { // LONG PRESS - #if defined(OOPSY_TARGET_PETAL) - #if defined(OOPSY_MULTI_APP) - mode = MODE_MENU; - is_mode_selecting = 0; - #endif // OOPSY_MULTI_APP - #else // !OOPSY_TARGET_PETAL + #ifndef OOPSY_TARGET_PETAL is_mode_selecting = 1; #endif - } else { - #if defined(OOPSY_TARGET_PETAL) - #if defined(OOPSY_MULTI_APP) - mode = MODE_NONE; - is_mode_selecting = 0; - #endif // OOPSY_MULTI_APP - #endif // !OOPSY_TARGET_PETAL } // Handle encoder increment actions: @@ -377,7 +372,6 @@ namespace oopsy { } encoder_released = 0; - switch(mode) { #ifdef OOPSY_TARGET_HAS_OLED #ifdef OOPSY_MULTI_APP From 9a13d9f74f96eeb1953c5d0c15eb60c4288a6f0c Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Wed, 2 Dec 2020 20:14:39 -0500 Subject: [PATCH 16/58] move property setters into JSON objects --- examples/daisy_patch.maxpat | 56 +-- examples/midi_io.maxpat | 53 +-- examples/{lrmsmslr.maxpat => midside.maxpat} | 142 +++--- examples/reverb.maxpat | 60 ++- examples/simple.maxpat | 84 ++-- javascript/oopsy.snoop.js | 4 +- patchers/oopsy.maxpat | 462 ++++++++++++++++--- snippets/oopsy_builder.maxpat | 97 ++++ snippets/oopsy_builder_field.maxpat | 98 ++++ snippets/oopsy_builder_patch.maxpat | 98 ++++ snippets/oopsy_builder_petal.maxpat | 98 ++++ snippets/oopsy_builder_pod.maxpat | 98 ++++ source/daisy.field.json | 6 + source/daisy.patch.json | 4 +- source/daisy.petal.json | 8 +- source/daisy.pod.json | 7 +- source/gen_dsp/genlib_exportfunctions.h | 2 +- source/gen_dsp/genlib_ops.h | 3 + source/genlib_daisy.h | 11 +- source/oopsy.js | 43 +- 20 files changed, 1181 insertions(+), 253 deletions(-) rename examples/{lrmsmslr.maxpat => midside.maxpat} (74%) create mode 100644 snippets/oopsy_builder.maxpat create mode 100644 snippets/oopsy_builder_field.maxpat create mode 100644 snippets/oopsy_builder_patch.maxpat create mode 100644 snippets/oopsy_builder_petal.maxpat create mode 100644 snippets/oopsy_builder_pod.maxpat diff --git a/examples/daisy_patch.maxpat b/examples/daisy_patch.maxpat index f6793aa..558bbc1 100644 --- a/examples/daisy_patch.maxpat +++ b/examples/daisy_patch.maxpat @@ -40,13 +40,21 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-2", - "linecount" : 4, - "maxclass" : "comment", + "args" : [ "@target", "patch" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 375.0, 118.0, 153.0, 60.0 ], - "text" : "Send a bang to [oopsy], or just save the patcher, to trigger code generation and upload." + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 191.5, 106.0, 128.0, 128.0 ], + "viewvisibility" : 1 } } @@ -247,29 +255,6 @@ "varname" : "otherpatch" } - } -, { - "box" : { - "id" : "obj-12", - "maxclass" : "button", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "bang" ], - "parameter_enable" : 0, - "patching_rect" : [ 375.0, 186.0, 33.0, 33.0 ] - } - - } -, { - "box" : { - "id" : "obj-6", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 375.0, 225.0, 119.0, 22.0 ], - "text" : "oopsy @target patch" - } - } , { "box" : { @@ -394,14 +379,17 @@ } ], - "lines" : [ { - "patchline" : { - "destination" : [ "obj-6", 0 ], - "source" : [ "obj-12", 0 ] - } + "lines" : [ ], + "parameters" : { + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { } - ], +, + "inherited_shortname" : 1 + } +, "dependency_cache" : [ { "name" : "oopsy.maxpat", "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", diff --git a/examples/midi_io.maxpat b/examples/midi_io.maxpat index 7454750..0ebd7ee 100644 --- a/examples/midi_io.maxpat +++ b/examples/midi_io.maxpat @@ -39,6 +39,25 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-13", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 25.0, 88.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } +, { "box" : { "id" : "obj-6", "lastchannelcount" : 0, @@ -73,29 +92,6 @@ "patching_rect" : [ 29.333333333333343, 532.0, 45.0, 45.0 ] } - } -, { - "box" : { - "id" : "obj-18", - "maxclass" : "button", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "bang" ], - "parameter_enable" : 0, - "patching_rect" : [ 590.0, 446.0, 74.0, 74.0 ] - } - - } -, { - "box" : { - "id" : "obj-14", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 590.0, 537.0, 41.0, 22.0 ], - "text" : "oopsy" - } - } , { "box" : { @@ -3558,7 +3554,7 @@ "exportname" : "midi_io" } , - "text" : "gen~ @title midi_io", + "text" : "gen~", "textcolor" : [ 0.996078431372549, 0.996078431372549, 0.996078431372549, 1.0 ], "varname" : "midi_io" } @@ -3613,13 +3609,6 @@ "source" : [ "obj-17", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-14", 0 ], - "source" : [ "obj-18", 0 ] - } - } , { "patchline" : { @@ -3697,6 +3686,8 @@ } ], "parameters" : { + "obj-13::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-13::obj-36" : [ "live.menu[1]", "live.menu", 0 ], "obj-6" : [ "live.gain~", "live.gain~", 0 ], "parameterbanks" : { diff --git a/examples/lrmsmslr.maxpat b/examples/midside.maxpat similarity index 74% rename from examples/lrmsmslr.maxpat rename to examples/midside.maxpat index 9c8e96d..c91d084 100644 --- a/examples/lrmsmslr.maxpat +++ b/examples/midside.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 59.0, 78.0, 396.0, 613.0 ], + "rect" : [ 59.0, 78.0, 586.0, 640.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -40,25 +40,20 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-6", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 49.0, 219.0, 68.0, 22.0 ], - "text" : "exportcode" - } - - } -, { - "box" : { - "id" : "obj-7", - "linecount" : 3, - "maxclass" : "comment", + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 162.0, 272.0, 150.0, 47.0 ], - "text" : "Inspired by the Worng Electronics device of the same name." + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 298.0, 26.0, 128.0, 128.0 ], + "viewvisibility" : 1 } } @@ -106,7 +101,7 @@ } , "classnamespace" : "dsp.gen", - "rect" : [ 397.0, 78.0, 634.0, 454.0 ], + "rect" : [ 761.0, 119.0, 634.0, 454.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -135,13 +130,25 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-14", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 334.0, 183.0, 150.0, 47.0 ], + "text" : "A really basic patch for mid-side stereo conversion" + } + + } +, { "box" : { "id" : "obj-11", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 247.5, 241.0, 45.0, 22.0 ], - "text" : "out 4" + "patching_rect" : [ 221.0, 249.0, 47.0, 22.0 ], + "text" : "out 4 R" } } @@ -151,8 +158,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 200.0, 241.0, 45.0, 22.0 ], - "text" : "out 3" + "patching_rect" : [ 168.0, 249.0, 45.0, 22.0 ], + "text" : "out 3 L" } } @@ -163,7 +170,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 247.5, 175.0, 39.5, 22.0 ], + "patching_rect" : [ 221.0, 183.0, 39.5, 22.0 ], "text" : "-" } @@ -175,7 +182,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 200.0, 175.0, 32.0, 22.0 ], + "patching_rect" : [ 168.0, 183.0, 32.0, 22.0 ], "text" : "/ 2" } @@ -186,8 +193,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 110.5, 241.0, 45.0, 22.0 ], - "text" : "out 2" + "patching_rect" : [ 84.0, 249.0, 47.0, 22.0 ], + "text" : "out 2 S" } } @@ -197,8 +204,8 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 63.0, 241.0, 45.0, 22.0 ], - "text" : "out 1" + "patching_rect" : [ 31.0, 249.0, 49.0, 22.0 ], + "text" : "out 1 M" } } @@ -209,7 +216,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 110.5, 175.0, 39.5, 22.0 ], + "patching_rect" : [ 84.0, 183.0, 39.5, 22.0 ], "text" : "-" } @@ -221,7 +228,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 63.0, 175.0, 32.0, 22.0 ], + "patching_rect" : [ 31.0, 183.0, 32.0, 22.0 ], "text" : "/ 2" } @@ -233,8 +240,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 258.0, 117.0, 38.0, 22.0 ], - "text" : "in 4" + "patching_rect" : [ 241.5, 125.0, 39.0, 22.0 ], + "text" : "in 4 S" } } @@ -245,8 +252,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 200.0, 117.0, 38.0, 22.0 ], - "text" : "in 3" + "patching_rect" : [ 168.0, 125.0, 41.0, 22.0 ], + "text" : "in 3 M" } } @@ -257,8 +264,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 121.0, 117.0, 38.0, 22.0 ], - "text" : "in 2" + "patching_rect" : [ 104.5, 125.0, 40.0, 22.0 ], + "text" : "in 2 R" } } @@ -269,8 +276,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 63.0, 117.0, 38.0, 22.0 ], - "text" : "in 1" + "patching_rect" : [ 31.0, 125.0, 38.0, 22.0 ], + "text" : "in 1 L" } } @@ -370,15 +377,14 @@ ] } , - "patching_rect" : [ 24.0, 272.0, 118.0, 22.0 ], + "patching_rect" : [ 24.0, 272.0, 50.5, 22.0 ], "saved_object_attributes" : { "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/examples/", - "exportname" : "lrmsmslr", - "exportnotifier" : "1203_ged_export" + "exportname" : "midside" } , - "text" : "gen~ @title lrmsmslr", - "varname" : "lrmsmslr" + "text" : "gen~", + "varname" : "midside" } } @@ -387,11 +393,12 @@ "fontname" : "Arial Bold Italic", "fontsize" : 24.0, "id" : "obj-3", + "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 24.0, 26.0, 261.0, 33.0 ], - "text" : "Mid-Side converter" + "patching_rect" : [ 24.0, 26.0, 261.0, 60.0 ], + "text" : "Mid-Side Stereo Conversion" } } @@ -426,25 +433,52 @@ "source" : [ "obj-4", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-1", 0 ], - "source" : [ "obj-6", 0 ] - } - } ], "parameters" : { "obj-4" : [ "live.gain~", "live.gain~", 0 ], + "obj-9::obj-32" : [ "live.text[4]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], "parameterbanks" : { + } +, + "parameter_overrides" : { + "obj-9::obj-32" : { + "parameter_longname" : "live.text[4]" + } +, + "obj-9::obj-36" : { + "parameter_longname" : "live.menu[1]" + } + } , "inherited_shortname" : 1 } , - "dependency_cache" : [ ], + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], "autosave" : 0 } diff --git a/examples/reverb.maxpat b/examples/reverb.maxpat index 3fd5ebf..78ffe5d 100644 --- a/examples/reverb.maxpat +++ b/examples/reverb.maxpat @@ -40,13 +40,20 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-6", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 63.0, 224.0, 68.0, 22.0 ], - "text" : "exportcode" + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 191.5, 106.0, 128.0, 128.0 ], + "viewvisibility" : 1 } } @@ -2965,14 +2972,13 @@ ] } , - "patching_rect" : [ 24.0, 272.0, 107.0, 22.0 ], + "patching_rect" : [ 24.0, 272.0, 36.0, 22.0 ], "saved_object_attributes" : { "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/examples/", - "exportname" : "reverb", - "exportnotifier" : "1208_ged_export" + "exportname" : "reverb" } , - "text" : "gen~ @title reverb", + "text" : "gen~", "varname" : "reverb" } @@ -3021,17 +3027,12 @@ "source" : [ "obj-4", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-1", 0 ], - "source" : [ "obj-6", 0 ] - } - } ], "parameters" : { "obj-4" : [ "live.gain~", "live.gain~", 0 ], + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], "parameterbanks" : { } @@ -3039,7 +3040,28 @@ "inherited_shortname" : 1 } , - "dependency_cache" : [ ], + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], "autosave" : 0 } diff --git a/examples/simple.maxpat b/examples/simple.maxpat index 169869e..cede418 100644 --- a/examples/simple.maxpat +++ b/examples/simple.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 1837.0, 80.0, 640.0, 480.0 ], + "rect" : [ 1006.0, 80.0, 640.0, 480.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -40,24 +40,20 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-5", - "maxclass" : "comment", + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 125.0, 152.0, 186.0, 20.0 ], - "text" : "Audio must be enabled for export" - } - - } -, { - "box" : { - "id" : "obj-3", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 125.0, 193.0, 68.0, 22.0 ], - "text" : "exportcode" + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 108.5, 111.0, 128.0, 128.0 ], + "viewvisibility" : 1 } } @@ -79,7 +75,7 @@ } , "classnamespace" : "dsp.gen", - "rect" : [ 2843.0, 312.0, 600.0, 450.0 ], + "rect" : [ 1046.0, 312.0, 600.0, 450.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -108,6 +104,18 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 164.0, 51.0, 74.0, 22.0 ], + "text" : "data leds 24" + } + + } +, { "box" : { "id" : "obj-13", "maxclass" : "newobj", @@ -341,27 +349,51 @@ ] } , - "patching_rect" : [ 125.0, 233.0, 108.0, 22.0 ], + "patching_rect" : [ 24.0, 261.0, 39.0, 22.0 ], "saved_object_attributes" : { "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/examples/", "exportname" : "simple" } , - "text" : "gen~ @title simple", + "text" : "gen~", "varname" : "simple" } } ], - "lines" : [ { - "patchline" : { - "destination" : [ "obj-1", 0 ], - "source" : [ "obj-3", 0 ] - } + "lines" : [ ], + "parameters" : { + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } ], - "dependency_cache" : [ ], "autosave" : 0 } diff --git a/javascript/oopsy.snoop.js b/javascript/oopsy.snoop.js index ff4cec8..aee5728 100644 --- a/javascript/oopsy.snoop.js +++ b/javascript/oopsy.snoop.js @@ -20,7 +20,7 @@ function configure(doExport) { } var export_path = extractFilepath(pat.filepath); - + var default_name = pat.name || "gen"; // send message out to convert this path // response will update the variable `path`: @@ -34,7 +34,7 @@ function configure(doExport) { var gen = pat.firstobject; while (gen) { if (gen.maxclass.toString() == "gen~") { - var name = "gen"; + var name = default_name; if (gen.getattr("exportname")) { name = gen.getattr("exportname").toString(); } else if (gen.getattr("title")) { diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index bdc43c4..e8605fe 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -10,9 +10,9 @@ } , "classnamespace" : "box", - "rect" : [ 477.0, 107.0, 724.0, 573.0 ], + "rect" : [ 707.0, 381.0, 528.0, 610.0 ], "bglocked" : 0, - "openinpresentation" : 0, + "openinpresentation" : 1, "default_fontsize" : 12.0, "default_fontface" : 0, "default_fontname" : "Arial", @@ -40,36 +40,300 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-22", - "maxclass" : "toggle", + "id" : "obj-10", + "maxclass" : "comment", "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "int" ], - "parameter_enable" : 0, - "patching_rect" : [ 519.0, 442.0, 24.0, 24.0 ] + "numoutlets" : 0, + "patching_rect" : [ 183.0, 309.0, 150.0, 20.0 ], + "presentation" : 1, + "presentation_rect" : [ 183.0, 309.0, 150.0, 20.0 ] } } , { "box" : { - "id" : "obj-13", + "id" : "obj-35", "maxclass" : "newobj", - "numinlets" : 2, + "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 550.0, 442.0, 32.0, 22.0 ], - "text" : "gate" + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 0.0, 0.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-23", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 1, + "outlettype" : [ "int" ], + "patching_rect" : [ 50.0, 173.75, 40.0, 22.0 ], + "text" : "itoa" + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "int", "" ], + "patching_rect" : [ 50.0, 136.5, 35.0, 22.0 ], + "text" : "t 13 l" + } + + } +, { + "box" : { + "id" : "obj-9", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 100.0, 71.0, 22.0 ], + "text" : "fromsymbol" + } + + } +, { + "box" : { + "id" : "obj-50", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 211.0, 96.0, 22.0 ], + "text" : "prepend append" + } + + } +, { + "box" : { + "comment" : "", + "id" : "obj-33", + "index" : 1, + "maxclass" : "inlet", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 40.0, 30.0, 30.0 ] + } + + } +, { + "box" : { + "comment" : "", + "id" : "obj-34", + "index" : 1, + "maxclass" : "outlet", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 50.0, 293.0, 30.0, 30.0 ] + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-23", 0 ], + "source" : [ "obj-22", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-50", 0 ], + "source" : [ "obj-22", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-50", 0 ], + "source" : [ "obj-23", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-9", 0 ], + "source" : [ "obj-33", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-34", 0 ], + "source" : [ "obj-50", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-22", 0 ], + "source" : [ "obj-9", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 271.0, 450.0, 53.0, 22.0 ], + "saved_object_attributes" : { + "description" : "", + "digest" : "", + "globalpatchername" : "", + "tags" : "" + } +, + "text" : "p format" } } , { "box" : { - "id" : "obj-11", + "id" : "obj-51", "maxclass" : "newobj", "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 271.0, 420.0, 67.0, 22.0 ], - "text" : "print oopsy" + "numoutlets" : 1, + "outlettype" : [ "clear" ], + "patching_rect" : [ 327.5, 450.0, 41.0, 22.0 ], + "text" : "t clear" + } + + } +, { + "box" : { + "id" : "obj-47", + "maxclass" : "textedit", + "numinlets" : 1, + "numoutlets" : 4, + "outlettype" : [ "", "int", "", "" ], + "parameter_enable" : 0, + "patching_rect" : [ 271.0, 485.0, 136.0, 75.0 ], + "presentation" : 1, + "presentation_rect" : [ 0.0, 32.0, 128.0, 92.0 ], + "readonly" : 1, + "separator" : "newline" + } + + } +, { + "box" : { + "id" : "obj-36", + "maxclass" : "live.menu", + "numinlets" : 1, + "numoutlets" : 3, + "outlettype" : [ "", "", "float" ], + "parameter_enable" : 1, + "patching_rect" : [ 90.0, 178.0, 100.0, 15.0 ], + "presentation" : 1, + "presentation_rect" : [ 31.0, 0.0, 45.0, 15.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_enum" : [ "patch", "field", "petal", "pod" ], + "parameter_longname" : "live.menu[1]", + "parameter_mmax" : 3, + "parameter_shortname" : "live.menu", + "parameter_type" : 2 + } + + } +, + "varname" : "live.menu" + } + + } +, { + "box" : { + "automation" : "Off", + "automationon" : "On", + "id" : "obj-32", + "maxclass" : "live.text", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "parameter_enable" : 1, + "patching_rect" : [ 500.0, 445.191985999999986, 62.0, 16.0 ], + "presentation" : 1, + "presentation_rect" : [ 76.0, 0.0, 52.0, 15.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_enum" : [ "Off", "On" ], + "parameter_initial" : [ 0 ], + "parameter_linknames" : 1, + "parameter_longname" : "live.text[2]", + "parameter_mmax" : 1, + "parameter_shortname" : "FILTER", + "parameter_type" : 2 + } + + } +, + "text" : "DISCREET", + "texton" : "VERBOSE", + "varname" : "live.text[2]" + } + + } +, { + "box" : { + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "bang", "" ], + "patching_rect" : [ 131.0, 210.25, 29.5, 22.0 ], + "text" : "t b l" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 550.0, 474.0, 32.0, 22.0 ], + "text" : "gate" } } @@ -80,7 +344,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 20.0, 61.0, 168.0, 33.0 ], + "patching_rect" : [ 192.0, 22.0, 168.0, 33.0 ], "text" : "bang (or save patcher) to trigger the oopsy workflow" } @@ -92,7 +356,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "bang" ], - "patching_rect" : [ 159.5, 109.0, 61.0, 22.0 ], + "patching_rect" : [ 123.5, 38.0, 61.0, 22.0 ], "text" : "savebang" } @@ -104,7 +368,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 20.0, 174.0, 67.0, 60.0 ], + "patching_rect" : [ 14.0, 178.0, 67.0, 60.0 ], "text" : "choose device target to compile for" } @@ -152,7 +416,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "bang", "" ], - "patching_rect" : [ 309.5, 174.0, 54.0, 22.0 ], + "patching_rect" : [ 327.5, 149.0, 54.0, 22.0 ], "text" : "sel bang" } @@ -164,7 +428,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 364.0, 174.0, 94.0, 74.0 ], + "patching_rect" : [ 387.0, 149.0, 94.0, 74.0 ], "text" : "audio must be on for the exportcode message to work" } @@ -175,7 +439,7 @@ "maxclass" : "ezdac~", "numinlets" : 2, "numoutlets" : 0, - "patching_rect" : [ 309.5, 231.0, 31.0, 31.0 ] + "patching_rect" : [ 342.5, 206.0, 31.0, 31.0 ] } } @@ -186,7 +450,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "int" ], - "patching_rect" : [ 309.5, 207.0, 22.0, 22.0 ], + "patching_rect" : [ 342.5, 182.0, 22.0, 22.0 ], "text" : "t 1" } @@ -198,7 +462,7 @@ "numinlets" : 2, "numoutlets" : 4, "outlettype" : [ "dictionary", "", "", "" ], - "patching_rect" : [ 480.0, 511.0, 50.5, 22.0 ], + "patching_rect" : [ 480.0, 506.0, 50.5, 22.0 ], "saved_object_attributes" : { "embed" : 0, "parameter_enable" : 0, @@ -215,7 +479,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 550.0, 474.0, 114.0, 22.0 ], + "patching_rect" : [ 550.0, 506.0, 114.0, 22.0 ], "text" : "print oopsy-verbose" } @@ -252,9 +516,9 @@ "numoutlets" : 1, "outlettype" : [ "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 123.5, 101.0, 30.0, 30.0 ], + "patching_rect" : [ 123.5, 76.0, 30.0, 30.0 ], "presentation" : 1, - "presentation_rect" : [ 333.0, 16.0, 30.0, 30.0 ] + "presentation_rect" : [ 0.0, 0.0, 30.0, 30.0 ] } } @@ -271,8 +535,6 @@ "saved_object_attributes" : { "autostart" : 0, "defer" : 0, - "node_bin_path" : "", - "npm_bin_path" : "", "watch" : 0 } , @@ -299,7 +561,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 90.5, 174.0, 94.0, 22.0 ], + "patching_rect" : [ 90.5, 149.0, 94.0, 22.0 ], "text" : "prepend symbol" } @@ -311,7 +573,7 @@ "numinlets" : 3, "numoutlets" : 3, "outlettype" : [ "", "", "" ], - "patching_rect" : [ 90.5, 144.0, 199.0, 22.0 ], + "patching_rect" : [ 90.5, 119.0, 199.0, 22.0 ], "text" : "route target done" } @@ -323,25 +585,10 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 223.0, 109.0, 72.0, 22.0 ], + "patching_rect" : [ 217.5, 84.0, 72.0, 22.0 ], "text" : "patcherargs" } - } -, { - "box" : { - "id" : "obj-15", - "items" : [ "patch", ",", "field", ",", "petal", ",", "pod" ], - "maxclass" : "umenu", - "numinlets" : 1, - "numoutlets" : 3, - "outlettype" : [ "int", "", "" ], - "parameter_enable" : 0, - "patching_rect" : [ 90.5, 203.0, 100.0, 22.0 ], - "presentation" : 1, - "presentation_rect" : [ 93.5, 118.0, 100.0, 22.0 ] - } - } , { "box" : { @@ -350,7 +597,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 90.5, 235.5, 130.0, 22.0 ], + "patching_rect" : [ 141.5, 242.5, 130.0, 22.0 ], "text" : "prepend setprop target" } @@ -511,12 +758,12 @@ "box" : { "comment" : "", "id" : "obj-1", - "index" : 1, + "index" : 0, "maxclass" : "inlet", "numinlets" : 0, "numoutlets" : 1, - "outlettype" : [ "bang" ], - "patching_rect" : [ 90.5, 101.0, 30.0, 30.0 ] + "outlettype" : [ "" ], + "patching_rect" : [ 90.5, 76.0, 30.0, 30.0 ] } } @@ -543,7 +790,7 @@ "lines" : [ { "patchline" : { "destination" : [ "obj-17", 0 ], - "midpoints" : [ 100.0, 137.0, 100.0, 137.0 ], + "midpoints" : [ 100.0, 112.0, 100.0, 112.0 ], "source" : [ "obj-1", 0 ] } @@ -565,22 +812,15 @@ , { "patchline" : { "destination" : [ "obj-5", 0 ], + "midpoints" : [ 151.0, 275.750001549720764, 280.5, 275.750001549720764 ], "source" : [ "obj-14", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-14", 0 ], - "midpoints" : [ 140.5, 232.0, 100.0, 232.0 ], - "source" : [ "obj-15", 1 ] - } - } , { "patchline" : { "destination" : [ "obj-17", 0 ], - "midpoints" : [ 285.5, 137.0, 100.0, 137.0 ], + "midpoints" : [ 280.0, 112.0, 100.0, 112.0 ], "source" : [ "obj-16", 1 ] } @@ -610,7 +850,7 @@ } , { "patchline" : { - "destination" : [ "obj-15", 0 ], + "destination" : [ "obj-36", 0 ], "source" : [ "obj-18", 0 ] } @@ -624,30 +864,32 @@ } , { "patchline" : { - "destination" : [ "obj-11", 0 ], + "destination" : [ "obj-13", 1 ], + "order" : 0, "source" : [ "obj-2", 0 ] } } , { "patchline" : { - "destination" : [ "obj-42", 0 ], - "source" : [ "obj-2", 1 ] + "destination" : [ "obj-35", 0 ], + "order" : 1, + "source" : [ "obj-2", 0 ] } } , { "patchline" : { - "destination" : [ "obj-13", 0 ], - "source" : [ "obj-22", 0 ] + "destination" : [ "obj-42", 0 ], + "source" : [ "obj-2", 1 ] } } , { "patchline" : { "destination" : [ "obj-16", 0 ], - "midpoints" : [ 319.0, 202.0, 299.0, 202.0, 299.0, 93.0, 232.5, 93.0 ], - "order" : 1, + "midpoints" : [ 337.0, 175.0, 299.0, 175.0, 299.0, 74.0, 227.0, 74.0 ], + "order" : 2, "source" : [ "obj-25", 0 ] } @@ -662,10 +904,39 @@ } , { "patchline" : { - "destination" : [ "obj-17", 0 ], + "destination" : [ "obj-51", 0 ], + "order" : 1, + "source" : [ "obj-25", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-7", 0 ], "source" : [ "obj-3", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-32", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-47", 0 ], + "source" : [ "obj-35", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-6", 0 ], + "source" : [ "obj-36", 1 ] + } + } , { "patchline" : { @@ -708,15 +979,64 @@ "source" : [ "obj-5", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-47", 0 ], + "source" : [ "obj-51", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-14", 0 ], + "source" : [ "obj-6", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-7", 0 ], + "midpoints" : [ 140.5, 237.25, 86.25, 237.25, 86.25, 69.0, 133.0, 69.0 ], + "source" : [ "obj-6", 0 ] + } + } , { "patchline" : { "destination" : [ "obj-17", 0 ], + "midpoints" : [ 133.0, 112.0, 100.0, 112.0 ], "source" : [ "obj-7", 0 ] } } - ] + ], + "parameters" : { + "obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 } } diff --git a/snippets/oopsy_builder.maxpat b/snippets/oopsy_builder.maxpat new file mode 100644 index 0000000..409b066 --- /dev/null +++ b/snippets/oopsy_builder.maxpat @@ -0,0 +1,97 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 84.0, 103.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } + ], + "lines" : [ ], + "parameters" : { + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} diff --git a/snippets/oopsy_builder_field.maxpat b/snippets/oopsy_builder_field.maxpat new file mode 100644 index 0000000..cfff87c --- /dev/null +++ b/snippets/oopsy_builder_field.maxpat @@ -0,0 +1,98 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 84.0, 103.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "args" : [ "@target", "field" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } + ], + "lines" : [ ], + "parameters" : { + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} diff --git a/snippets/oopsy_builder_patch.maxpat b/snippets/oopsy_builder_patch.maxpat new file mode 100644 index 0000000..954eb5f --- /dev/null +++ b/snippets/oopsy_builder_patch.maxpat @@ -0,0 +1,98 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 84.0, 103.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "args" : [ "@target", "patch" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } + ], + "lines" : [ ], + "parameters" : { + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} diff --git a/snippets/oopsy_builder_petal.maxpat b/snippets/oopsy_builder_petal.maxpat new file mode 100644 index 0000000..32b44fa --- /dev/null +++ b/snippets/oopsy_builder_petal.maxpat @@ -0,0 +1,98 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 84.0, 103.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "args" : [ "@target", "petal" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } + ], + "lines" : [ ], + "parameters" : { + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} diff --git a/snippets/oopsy_builder_pod.maxpat b/snippets/oopsy_builder_pod.maxpat new file mode 100644 index 0000000..98f653c --- /dev/null +++ b/snippets/oopsy_builder_pod.maxpat @@ -0,0 +1,98 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 84.0, 103.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "args" : [ "@target", "pod" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } + ], + "lines" : [ ], + "parameters" : { + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} diff --git a/source/daisy.field.json b/source/daisy.field.json index 417f78b..236b3e5 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -65,6 +65,9 @@ "cv2": "dsy_cv_out2", "gate": "dsy_gate_out1", "gate1": "dsy_gate_out1" + }, + "datas": { + "leds": "dsy_leds" } }, "getters": { @@ -105,6 +108,9 @@ "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)", "dsy_gate_out1": "dsy_gpio_write(&hardware.gate_out_, $ > 0.f)" }, + "mainhandlers": { + "dsy_leds": "daisy.setFieldLedsFromData($)" + }, "audio_ins": [ "dsy_in1", "dsy_in2" diff --git a/source/daisy.patch.json b/source/daisy.patch.json index dc07bb1..4d12fee 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -18,7 +18,8 @@ "cv2": "dsy_cv_out2", "gate": "dsy_gate_out1", "gate1": "dsy_gate_out1" - } + }, + "datas": {} }, "getters": { "dsy_cv_in1": "hardware.GetCtrlValue(hardware.CTRL_1)", @@ -33,6 +34,7 @@ "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)", "dsy_gate_out1": "dsy_gpio_write(&hardware.gate_output, $ > 0.f)" }, + "mainhandlers": {}, "audio_ins": [ "dsy_in1", "dsy_in2", diff --git a/source/daisy.petal.json b/source/daisy.petal.json index 68f0091..b988487 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -29,7 +29,8 @@ }, "outs": { - } + }, + "datas": {} }, "getters": { "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_1)", @@ -46,9 +47,8 @@ "dsy_switch6": "(hardware.switches[5].Pressed()?1.f:0.f)", "dsy_switch7": "(hardware.switches[6].Pressed()?1.f:0.f)" }, - "setters": { - - }, + "setters": {}, + "mainhandlers": {}, "audio_ins": [ "dsy_in1", "dsy_in2" diff --git a/source/daisy.pod.json b/source/daisy.pod.json index db5de70..3bb0acb 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -15,7 +15,8 @@ }, "outs": { - } + }, + "datas": {} }, "getters": { "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_1)", @@ -23,8 +24,8 @@ "dsy_switch1": "(hardware.button1.Pressed()?1.f:0.f)", "dsy_switch2": "(hardware.button2.Pressed()?1.f:0.f)" }, - "setters": { - }, + "setters": {}, + "mainhandlers": {}, "audio_ins": [ "dsy_in1", "dsy_in2" diff --git a/source/gen_dsp/genlib_exportfunctions.h b/source/gen_dsp/genlib_exportfunctions.h index 9ef7b66..5647e8c 100644 --- a/source/gen_dsp/genlib_exportfunctions.h +++ b/source/gen_dsp/genlib_exportfunctions.h @@ -34,7 +34,7 @@ void genlib_sysmem_copyptr(const void *src, void *dst, t_ptr_size bytes); void genlib_report_error(const char *s); void genlib_report_message(const char *s); void genlib_set_zero64(t_sample *mem, long size); - +unsigned long genlib_ticks(); void genlib_init(); void genlib_info(); diff --git a/source/gen_dsp/genlib_ops.h b/source/gen_dsp/genlib_ops.h index 79fb796..0b67db7 100644 --- a/source/gen_dsp/genlib_ops.h +++ b/source/gen_dsp/genlib_ops.h @@ -24,6 +24,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #ifndef GENLIB_OPS_H #define GENLIB_OPS_H 1 +#include "genlib_exportfunctions.h" + #ifndef MSP_ON_CLANG # include #endif @@ -95,6 +97,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #define GENLIB_QUANT(f1,f2) t_sample(floor((f1)*(f2)+0.5)/(f2)) + inline t_sample genlib_isnan(t_sample v) { return GENLIB_IS_NAN(v); } inline t_sample fixnan(t_sample v) { return GENLIB_FIX_NAN(v); } inline t_sample fixdenorm(t_sample v) { return GENLIB_FIX_DENORM(v); } diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index ed4096d..f8d75b9 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -3,6 +3,7 @@ #include "daisy.h" #include "genlib.h" +#include "genlib_ops.h" #include "genlib_exportfunctions.h" #include #include @@ -36,7 +37,6 @@ #endif - ////////////////////////// DAISY EXPORT INTERFACING ////////////////////////// #define OOPSY_BUFFER_SIZE 48 @@ -538,6 +538,15 @@ namespace oopsy { return *this; } + #if (OOPSY_TARGET_FIELD) + void setFieldLedsFromData(Data& data) { + for(long i = 0; i < daisy::DaisyField::LED_LAST && i < data.dim; i++) { + hardware.led_driver_.SetLed(i, data.mData[i]); + } + hardware.led_driver_.SwapBuffersAndTransmit(); + }; + #endif + static void nullAudioCallback(float **hardware_ins, float **hardware_outs, size_t size); static void nullMainloopCallback(uint32_t t, uint32_t dt) {} diff --git a/source/oopsy.js b/source/oopsy.js index abe148b..4eb66f4 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -365,11 +365,21 @@ function generate_daisy(hardware, nodes, target) { }), // DEVICE OUTPUTS: - gpio_outs: Object.keys(hardware.setters).map(v => { - let name = v + gpio_outs: Object.keys(hardware.setters).map(name => { nodes[name] = { + name: name, + setter: hardware.setters[name], from: [], - set: interpolate(hardware.setters[v], {name: name}) + } + return name; + }), + + // DEVICE OUTPUTS: + mainhandlers: Object.keys(hardware.mainhandlers).map(name => { + nodes[name] = { + name: name, + setter: hardware.mainhandlers[name], + data: null, } return name; }), @@ -381,6 +391,7 @@ function generate_app(app, hardware, target) { const nodes = {} const daisy = generate_daisy(hardware, nodes, target); const gen = {} + const name = app.patch.name; app.audio_outs = [] app.has_midi_in = false @@ -497,14 +508,30 @@ function generate_app(app, hardware, target) { gen.datas = app.patch.datas.map((param, i)=>{ const varname = "gen_data_"+param.name; + let src, label; + // search for a matching [out] name / prefix: + Object.keys(hardware.labels.datas).sort().forEach(k => { + let match + if (match = new RegExp(`^${k}_?(.+)?`).exec(param.name)) { + src = hardware.labels.datas[k]; + label = match[1] || param.name + } + }) + let node = Object.assign({ varname: varname, label: param.name, }, param); nodes[varname] = node; + + if (src) { + nodes[src].data = "gen." + param.cname; + //nodes[src].to.push(varname) + //nodes[src].from.push(src); + } + return varname; }) - // fill all my holes // map unused cvs/knobs to unmapped params @@ -552,7 +579,6 @@ function generate_app(app, hardware, target) { }) } - const name = app.patch.name; const struct = ` struct App_${name} : public oopsy::App { @@ -576,10 +602,15 @@ struct App_${name} : public oopsy::App { void mainloopCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { // whatever handling is needed here Daisy& hardware = daisy.hardware; + ${name}::State& gen = *(${name}::State *)daisy.gen; ${daisy.gpio_outs .filter(name => nodes[name].src || nodes[name].from.length) .map((name, i)=>` - ${nodes[name].set};`).join("")} + ${interpolate(nodes[name].setter, nodes[name])};`).join("")} + ${daisy.mainhandlers + .filter(name => nodes[name].data) + .map(name =>` + ${interpolate(nodes[name].setter, nodes[name])};`).join("")} } void audioCallback(oopsy::GenDaisy& daisy, float **hardware_ins, float **hardware_outs, size_t size) { From cb5aa082b59e7c7fa91374c44f67edca7a05e325 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Wed, 2 Dec 2020 20:22:45 -0500 Subject: [PATCH 17/58] basic daisy field example --- examples/daisy_field.maxpat | 746 ++++++++++++++++++++++++++++++++++++ 1 file changed, 746 insertions(+) create mode 100644 examples/daisy_field.maxpat diff --git a/examples/daisy_field.maxpat b/examples/daisy_field.maxpat new file mode 100644 index 0000000..c2430cf --- /dev/null +++ b/examples/daisy_field.maxpat @@ -0,0 +1,746 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 386.0, 113.0, 479.0, 644.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "float", "bang" ], + "patching_rect" : [ 220.0, 360.0, 139.0, 22.0 ], + "text" : "buffer~ leds @samps 24" + } + + } +, { + "box" : { + "args" : [ "@target", "field" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 191.5, 106.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "id" : "obj-6", + "lastchannelcount" : 0, + "maxclass" : "live.gain~", + "numinlets" : 2, + "numoutlets" : 5, + "outlettype" : [ "signal", "signal", "", "float", "list" ], + "parameter_enable" : 1, + "patching_rect" : [ 29.333333333333343, 384.0, 48.0, 136.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_longname" : "live.gain~", + "parameter_mmax" : 6.0, + "parameter_mmin" : -70.0, + "parameter_shortname" : "live.gain~", + "parameter_type" : 0, + "parameter_unitstyle" : 4 + } + + } +, + "varname" : "live.gain~" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "ezdac~", + "numinlets" : 2, + "numoutlets" : 0, + "patching_rect" : [ 29.333333333333343, 532.0, 45.0, 45.0 ] + } + + } +, { + "box" : { + "fontname" : "Arial Bold Italic", + "fontsize" : 24.0, + "id" : "obj-49", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 25.0, 27.0, 141.0, 33.0 ], + "text" : "Daisy Field" + } + + } +, { + "box" : { + "color" : [ 0.254901960784314, 0.533333333333333, 0.258823529411765, 1.0 ], + "fontsize" : 24.0, + "id" : "obj-16", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 6, + "outlettype" : [ "signal", "signal", "signal", "signal", "signal", "signal" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 67.0, 198.0, 1141.0, 427.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-40", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 876.0, 216.0, 182.0, 33.0 ], + "text" : "Quick demo of using [data leds] to update the LED buttons" + } + + } +, { + "box" : { + "id" : "obj-37", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 876.0, 152.0, 28.0, 22.0 ], + "text" : "abs" + } + + } +, { + "box" : { + "id" : "obj-36", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 876.0, 117.0, 37.0, 22.0 ], + "text" : "noise" + } + + } +, { + "box" : { + "id" : "obj-26", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 0, + "patching_rect" : [ 876.0, 184.0, 178.0, 22.0 ], + "text" : "poke leds 0 @boundmode wrap" + } + + } +, { + "box" : { + "id" : "obj-25", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 955.5, 117.0, 72.0, 22.0 ], + "text" : "phasor 1/24" + } + + } +, { + "box" : { + "id" : "obj-24", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 955.5, 152.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-23", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 966.0, 45.0, 74.0, 22.0 ], + "text" : "data leds 24" + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 127.0, 275.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 83.0, 275.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 175.0, 275.0, 99.0, 22.0 ], + "text" : "param knob1 0.1" + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 572.0, 124.0, 186.0, 22.0 ], + "text" : "param gate 0 @min 0 @max 100" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 489.0, 87.0, 181.0, 22.0 ], + "text" : "param cv4 0 @min 0 @max 400" + } + + } +, { + "box" : { + "id" : "obj-18", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 436.0, 56.0, 181.0, 22.0 ], + "text" : "param cv1 0 @min 0 @max 100" + } + + } +, { + "box" : { + "id" : "obj-17", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 712.0, 206.0, 26.0, 22.0 ], + "text" : "> 0" + } + + } +, { + "box" : { + "id" : "obj-16", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 712.0, 250.0, 62.0, 22.0 ], + "text" : "out 6 gate" + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 582.0, 206.0, 46.0, 22.0 ], + "text" : "cycle 1" + } + + } +, { + "box" : { + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 517.0, 206.0, 37.0, 22.0 ], + "text" : "noise" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 582.0, 250.0, 77.0, 22.0 ], + "text" : "out 5 cv2_lfo" + } + + } +, { + "box" : { + "id" : "obj-12", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 517.0, 250.0, 51.0, 22.0 ], + "text" : "out 4 cv" + } + + } +, { + "box" : { + "id" : "obj-11", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 181.0, 206.0, 194.0, 22.0 ], + "text" : "param key16 0 @min 0 @max 100" + } + + } +, { + "box" : { + "id" : "obj-10", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 438.0, 250.0, 61.0, 22.0 ], + "text" : "out 3 midi" + } + + } +, { + "box" : { + "id" : "obj-9", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 438.0, 184.0, 53.0, 22.0 ], + "text" : "in 3 midi" + } + + } +, { + "box" : { + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 127.0, 142.0, 222.0, 22.0 ], + "text" : "param knob8 400 @min 200 @max 800" + } + + } +, { + "box" : { + "id" : "obj-7", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 83.0, 52.0, 222.0, 22.0 ], + "text" : "param knob2 300 @min 200 @max 400" + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 127.0, 366.0, 35.0, 22.0 ], + "text" : "out 2" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 127.0, 184.0, 36.0, 22.0 ], + "text" : "cycle" + } + + } +, { + "box" : { + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 83.0, 366.0, 35.0, 22.0 ], + "text" : "out 1" + } + + } +, { + "box" : { + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 83.0, 184.0, 36.0, 22.0 ], + "text" : "cycle" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 83.0, 94.0, 222.0, 22.0 ], + "text" : "param knob2 300 @min 200 @max 400" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-12", 0 ], + "source" : [ "obj-14", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "order" : 1, + "source" : [ "obj-15", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-17", 0 ], + "order" : 0, + "source" : [ "obj-15", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-17", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-18", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-19", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-21", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-20", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-21", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-22", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-24", 1 ], + "source" : [ "obj-23", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-26", 1 ], + "source" : [ "obj-24", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-24", 0 ], + "source" : [ "obj-25", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-37", 0 ], + "source" : [ "obj-36", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-26", 0 ], + "source" : [ "obj-37", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-22", 0 ], + "source" : [ "obj-4", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-21", 1 ], + "order" : 1, + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-22", 1 ], + "order" : 0, + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-8", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-10", 0 ], + "source" : [ "obj-9", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 29.333333333333343, 313.0, 71.5, 35.0 ], + "saved_object_attributes" : { + "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/examples/", + "exportname" : "field" + } +, + "text" : "gen~", + "textcolor" : [ 0.996078431372549, 0.996078431372549, 0.996078431372549, 1.0 ], + "varname" : "field" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-6", 0 ], + "source" : [ "obj-16", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-19", 1 ], + "order" : 0, + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-19", 0 ], + "order" : 1, + "source" : [ "obj-6", 0 ] + } + + } + ], + "parameters" : { + "obj-6" : [ "live.gain~", "live.gain~", 0 ], + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} From a1111486c510a98f9e89f531282c19bb374be337 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 09:35:40 -0500 Subject: [PATCH 18/58] fix for field LED ordering --- examples/daisy_field.maxpat | 18 +++--------------- source/genlib_daisy.h | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/examples/daisy_field.maxpat b/examples/daisy_field.maxpat index c2430cf..4ce129f 100644 --- a/examples/daisy_field.maxpat +++ b/examples/daisy_field.maxpat @@ -39,18 +39,6 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { - "box" : { - "id" : "obj-1", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "float", "bang" ], - "patching_rect" : [ 220.0, 360.0, 139.0, 22.0 ], - "text" : "buffer~ leds @samps 24" - } - - } -, { "box" : { "args" : [ "@target", "field" ], "bgmode" : 0, @@ -170,12 +158,12 @@ "boxes" : [ { "box" : { "id" : "obj-40", - "linecount" : 2, + "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 876.0, 216.0, 182.0, 33.0 ], - "text" : "Quick demo of using [data leds] to update the LED buttons" + "patching_rect" : [ 876.0, 216.0, 194.0, 60.0 ], + "text" : "Quick demo of using [data leds] to update the LED buttons\n\nValues should be between 0 and 1" } } diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index f8d75b9..38f5f89 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -170,6 +170,19 @@ namespace oopsy { } } + // void fromData(Data& data) { + // // this might need a reset: + // static long data_read = 0; + // while (out_written < OOPSY_MIDI_BUFFER_SIZE) { + // double b = data.mData[data_read]; + // if (b < 0.) break; + + // out_data[out_written++] = b * 256.0; + // out_active = 1; + // data_read++; if (data_read >= data.dim) data_read = 0; + // } + // } + void mainloop() { // input: while(uart.Readable()) { @@ -541,7 +554,11 @@ namespace oopsy { #if (OOPSY_TARGET_FIELD) void setFieldLedsFromData(Data& data) { for(long i = 0; i < daisy::DaisyField::LED_LAST && i < data.dim; i++) { - hardware.led_driver_.SetLed(i, data.mData[i]); + // LED indices run A1..8, B8..1, Knob1..8 + // switch here to re-order the B8-1 to B1-8 + long idx=i; + if (idx > 7 && idx < 16) idx = 23-i; + hardware.led_driver_.SetLed(idx, data.mData[i]); } hardware.led_driver_.SwapBuffersAndTransmit(); }; From a021a0c38f4cb5d1011963c62699d18e8c0a5f48 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 09:44:16 -0500 Subject: [PATCH 19/58] fix for field LED ordering --- source/genlib_daisy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 38f5f89..1b47ef4 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -42,7 +42,7 @@ #define OOPSY_BUFFER_SIZE 48 #define OOPSY_MIDI_BUFFER_SIZE 64 #define OOPSY_LONG_PRESS_MS 250 -#define OOPSY_DISPLAY_PERIOD_MS 20 +#define OOPSY_DISPLAY_PERIOD_MS 10 #define OOPSY_SCOPE_MAX_ZOOM (9) static const uint32_t OOPSY_SRAM_SIZE = 512 * 1024; static const uint32_t OOPSY_SDRAM_SIZE = 64 * 1024 * 1024; From 5ba109416ca82c73d4d2cb8fbdb983efe6e46132 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 10:20:12 -0500 Subject: [PATCH 20/58] restored maxhelp --- .gitignore | 4 +- help/oopsy.maxhelp | 374 ++++++++++++++++++++++++++++++++++++++++ source/daisy.field.json | 67 ++++--- source/daisy.patch.json | 20 ++- source/daisy.petal.json | 26 ++- source/daisy.pod.json | 12 +- 6 files changed, 455 insertions(+), 48 deletions(-) create mode 100644 help/oopsy.maxhelp diff --git a/.gitignore b/.gitignore index 17012a9..a37bde5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ build/ source/build* notes/ examples/*.cpp -examples/*.h \ No newline at end of file +examples/*.h +help/*.cpp +help/*.h \ No newline at end of file diff --git a/help/oopsy.maxhelp b/help/oopsy.maxhelp new file mode 100644 index 0000000..f99577f --- /dev/null +++ b/help/oopsy.maxhelp @@ -0,0 +1,374 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 429.0, 121.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-11", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 315.0, 271.0, 261.0, 60.0 ], + "text" : "If the max patch has more than one gen~ object, all will be combined into a \"multi-app\" binary for the Daisy. Use the device encoder or switches to select the apps. " + } + + } +, { + "box" : { + "id" : "obj-10", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 315.0, 229.0, 259.0, 33.0 ], + "text" : "If the device is plugged in via USB and ready to flash, oopsy will also try to flash it." + } + + } +, { + "box" : { + "bubble" : 1, + "id" : "obj-7", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 300.0, 155.0, 275.0, 64.0 ], + "text" : "Drop in an 'oopsy_builder' bpatcher in any Max patch with gen~ objects. Select the target from the drop down and bang (or save the patch) to compile!" + } + + } +, { + "box" : { + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 163.0, 155.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "signal" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 84.0, 103.0, 600.0, 450.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-10", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 78.0, 192.0, 37.0, 22.0 ], + "text" : "noise" + } + + } +, { + "box" : { + "id" : "obj-9", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 62.0, 227.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 165.0, 192.0, 36.0, 22.0 ], + "text" : "cycle" + } + + } +, { + "box" : { + "id" : "obj-7", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 62.0, 149.0, 62.0, 22.0 ], + "text" : "param ctrl" + } + + } +, { + "box" : { + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 165.0, 149.0, 188.0, 22.0 ], + "text" : "param ctrl2 @min 200 @max 800" + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 142.0, 337.0, 35.0, 22.0 ], + "text" : "out 2" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 33.0, 73.0, 28.0, 22.0 ], + "text" : "in 1" + } + + } +, { + "box" : { + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 142.0, 73.0, 28.0, 22.0 ], + "text" : "in 2" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 33.0, 337.0, 35.0, 22.0 ], + "text" : "out 1" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-9", 1 ], + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-8", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-9", 0 ], + "source" : [ "obj-7", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-8", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-9", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 49.0, 213.0, 36.0, 22.0 ], + "saved_object_attributes" : { + "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/help/", + "exportname" : "oopsymaxhelp" + } +, + "text" : "gen~", + "varname" : "oopsymaxhelp" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 13.0, 48.0, 123.0, 20.0 ], + "text" : "Daisy from gen~" + } + + } +, { + "box" : { + "fontname" : "Arial Bold Italic", + "fontsize" : 24.0, + "id" : "obj-2", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 13.0, 13.0, 123.0, 33.0 ], + "text" : "Oopsy" + } + + } + ], + "lines" : [ ], + "parameters" : { + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} diff --git a/source/daisy.field.json b/source/daisy.field.json index 236b3e5..ff6f14a 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -4,14 +4,6 @@ }, "labels": { "params": { - "cv": "dsy_cv_in1", - "cv1": "dsy_cv_in1", - "cv2": "dsy_cv_in2", - "cv3": "dsy_cv_in3", - "cv4": "dsy_cv_in4", - "gate": "dsy_gate_in1", - "gate1": "dsy_gate_in1", - "knob": "dsy_knob1", "knob1": "dsy_knob1", "knob2": "dsy_knob2", "knob3": "dsy_knob3", @@ -20,23 +12,6 @@ "knob6": "dsy_knob6", "knob7": "dsy_knob7", "knob8": "dsy_knob8", - "key": "dsy_key1", - "key1": "dsy_key1", - "key2": "dsy_key2", - "key3": "dsy_key3", - "key4": "dsy_key4", - "key5": "dsy_key5", - "key6": "dsy_key6", - "key7": "dsy_key7", - "key8": "dsy_key8", - "key9": "dsy_key9", - "key10": "dsy_key10", - "key11": "dsy_key11", - "key12": "dsy_key12", - "key13": "dsy_key13", - "key14": "dsy_key14", - "key15": "dsy_key15", - "key16": "dsy_key16", "keyA1": "dsy_key9", "keyA2": "dsy_key10", "keyA3": "dsy_key11", @@ -53,11 +28,47 @@ "keyB6": "dsy_key6", "keyB7": "dsy_key7", "keyB8": "dsy_key8", - "switch": "dsy_switch1", + "sw1": "dsy_switch1", + "sw2": "dsy_switch2", + "cv1": "dsy_cv_in1", + "cv2": "dsy_cv_in2", + "cv3": "dsy_cv_in3", + "cv4": "dsy_cv_in4", + "gate1": "dsy_gate_in1", + + "key1": "dsy_key1", + "key2": "dsy_key2", + "key3": "dsy_key3", + "key4": "dsy_key4", + "key5": "dsy_key5", + "key6": "dsy_key6", + "key7": "dsy_key7", + "key8": "dsy_key8", + "key9": "dsy_key9", + "key10": "dsy_key10", + "key11": "dsy_key11", + "key12": "dsy_key12", + "key13": "dsy_key13", + "key14": "dsy_key14", + "key15": "dsy_key15", + "key16": "dsy_key16", + "ctrl1": "dsy_knob1", + "ctrl2": "dsy_knob2", + "ctrl3": "dsy_knob3", + "ctrl4": "dsy_knob4", + "ctrl5": "dsy_knob5", + "ctrl6": "dsy_knob6", + "ctrl7": "dsy_knob7", + "ctrl8": "dsy_knob8", "switch1": "dsy_switch1", "switch2": "dsy_switch2", - "sw1": "dsy_switch1", - "sw2": "dsy_switch2" + + "knob": "dsy_knob1", + "key": "dsy_key1", + "ctrl": "dsy_knob1", + "cv": "dsy_cv_in1", + "gate": "dsy_gate_in1", + "switch": "dsy_switch1" }, "outs": { "cv": "dsy_cv_out1", diff --git a/source/daisy.patch.json b/source/daisy.patch.json index 4d12fee..d8db35a 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -4,20 +4,28 @@ }, "labels": { "params": { - "cv": "dsy_cv_in1", "cv1": "dsy_cv_in1", "cv2": "dsy_cv_in2", "cv3": "dsy_cv_in3", "cv4": "dsy_cv_in4", - "gate": "dsy_gate_in1", - "gate1": "dsy_gate_in1" + "gate1": "dsy_gate_in1", + + "cv": "dsy_cv_in1", + "ctrl": "dsy_cv_in1", + "ctrl1": "dsy_cv_in1", + "ctrl2": "dsy_cv_in2", + "ctrl3": "dsy_cv_in3", + "ctrl4": "dsy_cv_in4", + "gate": "dsy_gate_in1" }, "outs": { - "cv": "dsy_cv_out1", "cv1": "dsy_cv_out1", "cv2": "dsy_cv_out2", - "gate": "dsy_gate_out1", - "gate1": "dsy_gate_out1" + "gate1": "dsy_gate_out1", + + "cv": "dsy_cv_out1", + "gate": "dsy_gate_out1" + }, "datas": {} }, diff --git a/source/daisy.petal.json b/source/daisy.petal.json index b988487..ba12dd5 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -4,14 +4,26 @@ }, "labels": { "params": { - "knob": "dsy_knob1", "knob1": "dsy_knob1", "knob2": "dsy_knob2", "knob3": "dsy_knob3", "knob4": "dsy_knob4", "knob5": "dsy_knob5", "knob6": "dsy_knob6", - "switch": "dsy_switch1", + "sw1": "dsy_switch1", + "sw2": "dsy_switch2", + "sw3": "dsy_switch3", + "sw4": "dsy_switch4", + "sw5": "dsy_switch5", + "sw6": "dsy_switch6", + "sw7": "dsy_switch7", + + "ctrl1": "dsy_knob1", + "ctrl2": "dsy_knob2", + "ctrl3": "dsy_knob3", + "ctrl4": "dsy_knob4", + "ctrl5": "dsy_knob5", + "ctrl6": "dsy_knob6", "switch1": "dsy_switch1", "switch2": "dsy_switch2", "switch3": "dsy_switch3", @@ -19,13 +31,9 @@ "switch5": "dsy_switch5", "switch6": "dsy_switch6", "switch7": "dsy_switch7", - "sw1": "dsy_switch1", - "sw2": "dsy_switch2", - "sw3": "dsy_switch3", - "sw4": "dsy_switch4", - "sw5": "dsy_switch5", - "sw6": "dsy_switch6", - "sw7": "dsy_switch7" + "knob": "dsy_knob1", + "ctrl": "dsy_knob1", + "switch": "dsy_switch1" }, "outs": { diff --git a/source/daisy.pod.json b/source/daisy.pod.json index 3bb0acb..f198a23 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -4,14 +4,18 @@ }, "labels": { "params": { - "knob": "dsy_knob1", "knob1": "dsy_knob1", "knob2": "dsy_knob2", - "switch": "dsy_switch1", + "sw1": "dsy_switch1", + "sw2": "dsy_switch2", + + "ctrl1": "dsy_knob1", + "ctrl2": "dsy_knob2", "switch1": "dsy_switch1", "switch2": "dsy_switch2", - "sw1": "dsy_switch1", - "sw2": "dsy_switch2" + "knob": "dsy_knob1", + "ctrl": "dsy_knob1", + "switch": "dsy_switch1" }, "outs": { From 9d6699ebf1c4d399f93a04a512e7912ea6b47385 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 12:00:52 -0500 Subject: [PATCH 21/58] ensure makefile is optimized to -O3, as this makes a massive performance difference --- examples/reverb.maxpat | 6 +++--- patchers/oopsy.maxpat | 24 ++++++++++++++---------- source/genlib_daisy.h | 2 +- source/oopsy.js | 6 +++++- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/examples/reverb.maxpat b/examples/reverb.maxpat index 78ffe5d..b92806e 100644 --- a/examples/reverb.maxpat +++ b/examples/reverb.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 59.0, 78.0, 431.0, 612.0 ], + "rect" : [ 1213.0, 82.0, 431.0, 612.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -113,7 +113,7 @@ } , "classnamespace" : "dsp.gen", - "rect" : [ 397.0, 78.0, 586.0, 703.0 ], + "rect" : [ 739.0, 102.0, 586.0, 703.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -1989,7 +1989,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 228.5, 441.666655999999989, 98.0, 22.0 ], + "patching_rect" : [ 372.5, 451.666655999999989, 98.0, 22.0 ], "text" : "param decay 0.5" } diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index e8605fe..4858c2f 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 707.0, 381.0, 528.0, 610.0 ], + "rect" : [ 707.0, 381.0, 714.0, 635.0 ], "bglocked" : 0, "openinpresentation" : 1, "default_fontsize" : 12.0, @@ -535,6 +535,8 @@ "saved_object_attributes" : { "autostart" : 0, "defer" : 0, + "node_bin_path" : "", + "npm_bin_path" : "", "watch" : 0 } , @@ -889,7 +891,7 @@ "patchline" : { "destination" : [ "obj-16", 0 ], "midpoints" : [ 337.0, 175.0, 299.0, 175.0, 299.0, 74.0, 227.0, 74.0 ], - "order" : 2, + "order" : 1, "source" : [ "obj-25", 0 ] } @@ -901,14 +903,6 @@ "source" : [ "obj-25", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-51", 0 ], - "order" : 1, - "source" : [ "obj-25", 0 ] - } - } , { "patchline" : { @@ -941,6 +935,16 @@ , { "patchline" : { "destination" : [ "obj-2", 0 ], + "order" : 1, + "source" : [ "obj-40", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-51", 0 ], + "midpoints" : [ 280.5, 359.5, 337.0, 359.5 ], + "order" : 0, "source" : [ "obj-40", 0 ] } diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 1b47ef4..6bca9bb 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -519,7 +519,7 @@ namespace oopsy { } #ifdef OOPSY_TARGET_HAS_OLED - int scope_samples() { + inline int scope_samples() { // valid zoom sizes: 1, 2, 3, 4, 6, 8, 12, 16, 24 switch(scope_zoom) { case 1: case 2: case 3: case 4: return scope_zoom; break; diff --git a/source/oopsy.js b/source/oopsy.js index 4eb66f4..a7d0eb0 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -179,12 +179,16 @@ TARGET = ${build_name} CPP_SOURCES = ${posixify_path(path.relative(build_path, maincpp_path).replace(" ", "\\ "))} # Library Locations LIBDAISY_DIR = ${(posixify_path(path.relative(build_path, path.join(__dirname, "libdaisy"))).replace(" ", "\\ "))} +# Optimize (i.e. CFLAGS += -O3): +OPT = -O3 # Core location, and generic Makefile. SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core include $(SYSTEM_FILES_DIR)/Makefile # Include the gen_dsp files CFLAGS+=-I"${posixify_path(path.relative(build_path, path.join(__dirname, "gen_dsp")))}" -CFLAGS+=-Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable +# Silence irritating warnings: +CFLAGS+=-O3 -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable +CPPFLAGS+=-O3 -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable `, "utf-8"); // didn't seem to be working: From 47bf94ea2b780d8b04a0f2ba4b85e9912a115c03 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 12:46:03 -0500 Subject: [PATCH 22/58] first pass at versio support --- source/daisy.patch.json | 1 + source/daisy.versio.json | 62 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 source/daisy.versio.json diff --git a/source/daisy.patch.json b/source/daisy.patch.json index d8db35a..73a805d 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -9,6 +9,7 @@ "cv3": "dsy_cv_in3", "cv4": "dsy_cv_in4", "gate1": "dsy_gate_in1", + "gate2": "dsy_gate_in2", "cv": "dsy_cv_in1", "ctrl": "dsy_cv_in1", diff --git a/source/daisy.versio.json b/source/daisy.versio.json new file mode 100644 index 0000000..76b2ec7 --- /dev/null +++ b/source/daisy.versio.json @@ -0,0 +1,62 @@ +{ + "defines": { + "OOPSY_TARGET_VERSIO": 1 + }, + "labels": { + "params": { + "knob1": "dsy_knob1", + "knob2": "dsy_knob2", + "knob3": "dsy_knob3", + "knob4": "dsy_knob4", + "knob5": "dsy_knob5", + "knob6": "dsy_knob6", + "knob7": "dsy_knob7", + "sw1": "dsy_switch1", + "gate1": "dsy_gate_in1", + + "ctrl1": "dsy_knob1", + "ctrl2": "dsy_knob2", + "ctrl3": "dsy_knob3", + "ctrl4": "dsy_knob4", + "ctrl5": "dsy_knob5", + "ctrl6": "dsy_knob6", + "switch1": "dsy_switch1", + + "knob": "dsy_knob1", + "ctrl": "dsy_knob1", + "switch": "dsy_switch1", + "gate": "dsy_gate_in1" + }, + "outs": { + + }, + "datas": {} + }, + "getters": { + "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_0)", + "dsy_knob2": "hardware.GetKnobValue(hardware.KNOB_1)", + "dsy_knob3": "hardware.GetKnobValue(hardware.KNOB_2)", + "dsy_knob4": "hardware.GetKnobValue(hardware.KNOB_3)", + "dsy_knob5": "hardware.GetKnobValue(hardware.KNOB_4)", + "dsy_knob6": "hardware.GetKnobValue(hardware.KNOB_5)", + "dsy_knob7": "hardware.GetKnobValue(hardware.KNOB_6)", + "dsy_switch1": "(hardware.SwitchPressed()?1.f:0.f)", + "dsy_gate_in1": "(hardware.Gate()?1.f:0.f)" + }, + "setters": {}, + "mainhandlers": {}, + "audio_ins": [ + "dsy_in1", + "dsy_in2", + "dsy_in3", + "dsy_in4" + ], + "audio_outs": [ + "dsy_out1", + "dsy_out2", + "dsy_out3", + "dsy_out4" + ], + "midi_ins": [], + "midi_outs": [] +} \ No newline at end of file From 8cd3d7a0a8f5c89edfb6ae98dcb4d990ce9548fe Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 13:37:46 -0500 Subject: [PATCH 23/58] versio app selecting ui --- source/daisy.field.json | 3 +- source/daisy.patch.json | 3 +- source/daisy.petal.json | 5 ++- source/daisy.pod.json | 3 +- source/daisy.versio.json | 37 ++++++++++++---- source/genlib_daisy.h | 93 ++++++++++++++++++++++++++-------------- source/oopsy.js | 12 +++--- 7 files changed, 104 insertions(+), 52 deletions(-) diff --git a/source/daisy.field.json b/source/daisy.field.json index ff6f14a..2cbf8a8 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -1,5 +1,6 @@ { - "defines": { + "max_apps":8, + "defines": { "OOPSY_TARGET_FIELD": 1 }, "labels": { diff --git a/source/daisy.patch.json b/source/daisy.patch.json index 73a805d..3c18016 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -1,5 +1,6 @@ { - "defines": { + "max_apps":8, + "defines": { "OOPSY_TARGET_PATCH": 1 }, "labels": { diff --git a/source/daisy.petal.json b/source/daisy.petal.json index ba12dd5..b3d11a6 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -1,5 +1,6 @@ { - "defines": { + "max_apps":8, + "defines": { "OOPSY_TARGET_PETAL": 1 }, "labels": { @@ -17,7 +18,7 @@ "sw5": "dsy_switch5", "sw6": "dsy_switch6", "sw7": "dsy_switch7", - + "ctrl1": "dsy_knob1", "ctrl2": "dsy_knob2", "ctrl3": "dsy_knob3", diff --git a/source/daisy.pod.json b/source/daisy.pod.json index f198a23..adc7192 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -1,5 +1,6 @@ { - "defines": { + "max_apps":1, + "defines": { "OOPSY_TARGET_POD": 1 }, "labels": { diff --git a/source/daisy.versio.json b/source/daisy.versio.json index 76b2ec7..39ab53b 100644 --- a/source/daisy.versio.json +++ b/source/daisy.versio.json @@ -1,5 +1,6 @@ { - "defines": { + "max_apps":4, + "defines": { "OOPSY_TARGET_VERSIO": 1 }, "labels": { @@ -11,21 +12,41 @@ "knob5": "dsy_knob5", "knob6": "dsy_knob6", "knob7": "dsy_knob7", + "button1": "dsy_button1", "sw1": "dsy_switch1", + "sw2": "dsy_switch2", "gate1": "dsy_gate_in1", + "cv1": "dsy_knob1", + "cv2": "dsy_knob2", + "cv3": "dsy_knob3", + "cv4": "dsy_knob4", + "cv5": "dsy_knob5", + "cv6": "dsy_knob6", + "cv7": "dsy_knob7", "ctrl1": "dsy_knob1", "ctrl2": "dsy_knob2", "ctrl3": "dsy_knob3", "ctrl4": "dsy_knob4", "ctrl5": "dsy_knob5", "ctrl6": "dsy_knob6", + "ctrl7": "dsy_knob7", "switch1": "dsy_switch1", + "switch2": "dsy_switch2", "knob": "dsy_knob1", + "button": "dsy_button1", "ctrl": "dsy_knob1", + "cv": "dsy_knob1", "switch": "dsy_switch1", - "gate": "dsy_gate_in1" + "gate": "dsy_gate_in1", + + + "tap": "dsy_button1", + "fsu": "dsy_button1", + "abc": "dsy_switch1", + "xyz": "dsy_switch2" + }, "outs": { @@ -40,22 +61,20 @@ "dsy_knob5": "hardware.GetKnobValue(hardware.KNOB_4)", "dsy_knob6": "hardware.GetKnobValue(hardware.KNOB_5)", "dsy_knob7": "hardware.GetKnobValue(hardware.KNOB_6)", - "dsy_switch1": "(hardware.SwitchPressed()?1.f:0.f)", + "dsy_switch1": "(hardware.sw_[0].Read())", + "dsy_switch1": "(hardware.sw_[1].Read())", + "dsy_button1": "(hardware.SwitchPressed()?1.f:0.f)", "dsy_gate_in1": "(hardware.Gate()?1.f:0.f)" }, "setters": {}, "mainhandlers": {}, "audio_ins": [ "dsy_in1", - "dsy_in2", - "dsy_in3", - "dsy_in4" + "dsy_in2" ], "audio_outs": [ "dsy_out1", - "dsy_out2", - "dsy_out3", - "dsy_out4" + "dsy_out2" ], "midi_ins": [], "midi_outs": [] diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 6bca9bb..d0e98ac 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -20,8 +20,8 @@ #define OOPSY_IO_COUNT (2) typedef daisy::DaisyField Daisy; -#elif defined(OOPSY_TARGET_PETAL) - #include "daisy_petal.h" +#elif defined(OOPSY_TARGET_menu_button_incr) + #include "daisy_menu_button_incr.h" #define OOPSY_IO_COUNT (2) typedef daisy::DaisyPetal Daisy; @@ -30,6 +30,11 @@ #define OOPSY_IO_COUNT (2) typedef daisy::DaisyPod Daisy; +#elif defined(OOPSY_TARGET_VERSIO) + #include "daisy_versio.h" + #define OOPSY_IO_COUNT (2) + typedef daisy::DaisyVersio Daisy; + #else #include "daisy_seed.h" #define OOPSY_IO_COUNT (2) @@ -210,7 +215,7 @@ namespace oopsy { int mode, mode_default; int app_count = 1, app_selected = 0, app_selecting = 0; - int encoder_held = 0, encoder_held_ms = 0, encoder_released = 0, encoder_incr = 0; + int menu_button_held = 0, menu_button_held_ms = 0, menu_button_released = 0, menu_button_incr = 0; int is_mode_selecting = 0; uint32_t t = 0, dt = 10; @@ -319,17 +324,15 @@ namespace oopsy { mainloopCallback(t, dt); #ifdef OOPSY_TARGET_PETAL - // petal has no mode selection + // has no mode selection is_mode_selecting = 0; #if defined(OOPSY_MULTI_APP) // multi-app petal is always in menu mode: mode = MODE_MENU; #endif - // blink = !blink; - // hardware.SetFootswitchLed((daisy::DaisyPetal::FootswitchLed)0, blink); - + for(int i = 0; i < 8; i++) { - float white = (i == app_selecting || encoder_released); + float white = (i == app_selecting || menu_button_released); hardware.SetRingLed((daisy::DaisyPetal::RingLed)i, (i == app_selected || white) * 1.f, white * 1.f, @@ -338,7 +341,25 @@ namespace oopsy { } #endif //OOPSY_TARGET_PETAL - if (encoder_held_ms > OOPSY_LONG_PRESS_MS) { + #ifdef OOPSY_TARGET_VERSIO + // has no mode selection + is_mode_selecting = 0; + #if defined(OOPSY_MULTI_APP) + // multi-app petal is always in menu mode: + mode = MODE_MENU; + #endif + + for(int i = 0; i < 4; i++) { + float white = (i == app_selecting || menu_button_released); + hardware.SetLed(i, + (i == app_selected || white) * 1.f, + white * 1.f, + (i < app_count) * 0.3f + white * 1.f + ); + } + #endif //OOPSY_TARGET_VERSIO + + if (menu_button_held_ms > OOPSY_LONG_PRESS_MS) { // LONG PRESS #ifndef OOPSY_TARGET_PETAL is_mode_selecting = 1; @@ -347,30 +368,34 @@ namespace oopsy { // Handle encoder increment actions: if (is_mode_selecting) { - mode += encoder_incr; + mode += menu_button_incr; if (mode >= MODE_COUNT) mode = 1; if (mode < 1) mode = MODE_COUNT-1; #ifdef OOPSY_MULTI_APP } else if (mode == MODE_MENU) { - app_selecting += encoder_incr; + #ifdef OOPSY_TARGET_VERSIO + app_selecting = menu_button_incr; + #else + app_selecting += menu_button_incr; + #endif if (app_selecting >= app_count) app_selecting -= app_count; if (app_selecting < 0) app_selecting += app_count; #endif // OOPSY_MULTI_APP #ifdef OOPSY_TARGET_HAS_OLED } else if (mode == MODE_SCOPE) { - if (encoder_incr > 0) { + if (menu_button_incr > 0) { scope_zoom = scope_zoom + 1; if (scope_zoom > OOPSY_SCOPE_MAX_ZOOM) scope_zoom = 1; - } else if (encoder_incr < 0) { + } else if (menu_button_incr < 0) { scope_zoom = scope_zoom - 1; if (scope_zoom < 1) scope_zoom = OOPSY_SCOPE_MAX_ZOOM; } #endif //OOPSY_TARGET_HAS_OLED } - encoder_incr = 0; + menu_button_incr = 0; // SHORT PRESS - if (encoder_released) { + if (menu_button_released) { if (is_mode_selecting) { is_mode_selecting = 0; #ifdef OOPSY_MULTI_APP @@ -383,7 +408,7 @@ namespace oopsy { #endif } } - encoder_released = 0; + menu_button_released = 0; switch(mode) { #ifdef OOPSY_TARGET_HAS_OLED @@ -458,9 +483,9 @@ namespace oopsy { hardware.display.Update(); #endif //OOPSY_TARGET_HAS_OLED - #ifdef OOPSY_TARGET_PETAL + #if (OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) hardware.UpdateLeds(); - #endif //OOPSY_TARGET_PETAL + #endif //(OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) } // uitimer.ready @@ -473,24 +498,30 @@ namespace oopsy { midi.preperform(size); #endif - #if (OOPSY_TARGET_FIELD) - hardware.ProcessAnalogControls(); - hardware.UpdateDigitalControls(); + #if (OOPSY_TARGET_FIELD || OOPSY_TARGET_VERSIO) + hardware.ProcessAnalogControls(); + #if OOPSY_TARGET_FIELD + hardware.UpdateDigitalControls(); + #endif #else - hardware.DebounceControls(); - hardware.UpdateAnalogControls(); + hardware.DebounceControls(); + hardware.UpdateAnalogControls(); #endif #ifdef OOPSY_TARGET_FIELD - encoder_held = hardware.GetSwitch(0)->Pressed(); - encoder_incr += hardware.GetSwitch(1)->FallingEdge(); - encoder_held_ms = hardware.GetSwitch(0)->TimeHeldMs(); - if (hardware.GetSwitch(0)->FallingEdge()) encoder_released = 1; + menu_button_held = hardware.GetSwitch(0)->Pressed(); + menu_button_incr += hardware.GetSwitch(1)->FallingEdge(); + menu_button_held_ms = hardware.GetSwitch(0)->TimeHeldMs(); + if (hardware.GetSwitch(0)->FallingEdge()) menu_button_released = 1; + #elif OOPSY_TARGET_VERSIO + menu_button_held = hardware.tap_.Pressed(); + menu_button_incr += hardware.GetKnobValue(6) * app_count; + menu_button_held_ms = hardware.tap_.TimeHeldMs(); #else - encoder_held = hardware.encoder.Pressed(); - encoder_incr += hardware.encoder.Increment(); - encoder_held_ms = hardware.encoder.TimeHeldMs(); - if (hardware.encoder.FallingEdge()) encoder_released = 1; + menu_button_held = hardware.encoder.Pressed(); + menu_button_incr += hardware.encoder.Increment(); + menu_button_held_ms = hardware.encoder.TimeHeldMs(); + if (hardware.encoder.FallingEdge()) menu_button_released = 1; #endif } diff --git a/source/oopsy.js b/source/oopsy.js index a7d0eb0..79fe3af 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -82,7 +82,8 @@ function run() { case "pod": case "field": case "petal": - case "patch": {target = arg;} break; + case "patch": + case "versio": {target = arg;} break; case "watch": watch=true; break; default: { @@ -128,15 +129,12 @@ function run() { console.log(`Target ${target} configured in path ${target_path}`) assert(fs.existsSync(target_path), `couldn't find target configuration file ${target_path}`); const hardware = JSON.parse(fs.readFileSync(target_path, "utf8")); - if (!hardware.keys) hardware.keys = [] - if (!hardware.knobs) hardware.knobs = [] - if (!hardware.switches) hardware.switches = [] // verify and analyze cpps: assert(cpps.length > 0, "an argument specifying the path to at least one gen~ exported cpp file is required"); - if (cpps.length > 8) { - console.log("maximum 8 apps supported currently") - cpps.length = 8; + if (hardware.max_apps && cpps.length > hardware.max_apps) { + console.log(`this target does not support more than ${hardwre.max_apps} apps`) + cpps.length = hardware.max_apps } let apps = cpps.map(cpp_path => { assert(fs.existsSync(cpp_path), `couldn't find source C++ file ${cpp_path}`); From 6ff51bd680a70d69769d448bfb171b36f5728b3b Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 13:47:35 -0500 Subject: [PATCH 24/58] fix for overzealous find & replace, and bump libdaisy version --- source/genlib_daisy.h | 4 ++-- source/libdaisy | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index d0e98ac..ffc7239 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -20,8 +20,8 @@ #define OOPSY_IO_COUNT (2) typedef daisy::DaisyField Daisy; -#elif defined(OOPSY_TARGET_menu_button_incr) - #include "daisy_menu_button_incr.h" +#elif defined(OOPSY_TARGET_PETAL) + #include "daisy_petal.h" #define OOPSY_IO_COUNT (2) typedef daisy::DaisyPetal Daisy; diff --git a/source/libdaisy b/source/libdaisy index 9a5e2fb..09be57b 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit 9a5e2fbe06d7c4da5b60efb955f77ef9356a7ab2 +Subproject commit 09be57b1bd70321f309be332a44b8bf230799e62 From 4a904ec32022c43a6b83fba9ff45fbb39e1d57ca Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 17:06:40 -0500 Subject: [PATCH 25/58] OLED scope modes -- stereo overlay/LR/top-bottom/lissajous and UI --- source/genlib_daisy.h | 148 +++++++++++++++++++++++++++++++++--------- 1 file changed, 118 insertions(+), 30 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index ffc7239..99b3958 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -215,7 +215,7 @@ namespace oopsy { int mode, mode_default; int app_count = 1, app_selected = 0, app_selecting = 0; - int menu_button_held = 0, menu_button_held_ms = 0, menu_button_released = 0, menu_button_incr = 0; + int menu_button_held = 0, menu_button_released = 0, menu_button_held_ms = 0, menu_button_incr = 0; int is_mode_selecting = 0; uint32_t t = 0, dt = 10; @@ -233,14 +233,31 @@ namespace oopsy { bool nullAudioCallbackRunning = false; #ifdef OOPSY_TARGET_HAS_OLED + + enum { + SCOPESTYLE_OVERLAY = 0, + SCOPESTYLE_TOPBOTTOM, + SCOPESTYLE_LEFTRIGHT, + SCOPESTYLE_LISSAJOUS, + SCOPESTYLE_COUNT + } ScopeStyles; + + enum { + SCOPEOPTION_STYLE = 0, + SCOPEOPTION_SOURCE, + SCOPEOPTION_ZOOM, + SCOPEOPTION_COUNT + } ScopeOptions; + FontDef& font = Font_6x8; uint_fast8_t scope_zoom = 5; - uint_fast8_t scope_step = 0; + uint_fast8_t scope_step = 0; + uint_fast8_t scope_option = 0, scope_source = 0, scope_style = 0; uint16_t console_cols, console_rows, console_line; char * console_stats; char * console_memory; char ** console_lines; - float scope_data[SSD1309_WIDTH*2]; // 128 pixels + float scope_data[SSD1309_WIDTH*2][2]; // 128 pixels char scope_label[11]; #endif // OOPSY_TARGET_HAS_OLED @@ -383,12 +400,18 @@ namespace oopsy { #endif // OOPSY_MULTI_APP #ifdef OOPSY_TARGET_HAS_OLED } else if (mode == MODE_SCOPE) { - if (menu_button_incr > 0) { - scope_zoom = scope_zoom + 1; - if (scope_zoom > OOPSY_SCOPE_MAX_ZOOM) scope_zoom = 1; - } else if (menu_button_incr < 0) { - scope_zoom = scope_zoom - 1; - if (scope_zoom < 1) scope_zoom = OOPSY_SCOPE_MAX_ZOOM; + switch (scope_option) { + case SCOPEOPTION_STYLE: { + scope_style = (scope_style + menu_button_incr) % SCOPESTYLE_COUNT; + } break; + case SCOPEOPTION_SOURCE: { + if (menu_button_incr) scope_source = !scope_source; + } break; + case SCOPEOPTION_ZOOM: { + scope_zoom = (scope_zoom + menu_button_incr); + if (scope_zoom > OOPSY_SCOPE_MAX_ZOOM) scope_zoom = 1; + if (scope_zoom < 1) scope_zoom = OOPSY_SCOPE_MAX_ZOOM; + } break; } #endif //OOPSY_TARGET_HAS_OLED } @@ -406,6 +429,10 @@ namespace oopsy { mode = mode_default; } #endif + #ifdef OOPSY_TARGET_HAS_OLED + } else if (mode == MODE_SCOPE) { + scope_option = (scope_option + 1) % SCOPEOPTION_COUNT; + #endif } } menu_button_released = 0; @@ -427,19 +454,74 @@ namespace oopsy { } break; #endif //OOPSY_MULTI_APP case MODE_SCOPE: { - uint8_t h = SSD1309_HEIGHT - font.FontHeight; - hardware.display.Fill(false); - for (uint_fast8_t i=0; i' : ' '); + offset += snprintf(console_stats+offset, console_cols-offset, "%cM%c ", midi.in_active ? '<' : ' ', midi.out_active ? '>' : ' '); midi.in_active = midi.out_active = 0; #endif + offset += snprintf(console_stats+offset, console_cols-offset, "%02d%%", int(0.0001f*audioCpuUs*(samplerate)/blocksize)); // stats: - hardware.display.SetCursor(0, font.FontHeight * console_rows); + hardware.display.SetCursor(SSD1309_WIDTH - (offset) * font.FontWidth, font.FontHeight * 0); hardware.display.WriteString(console_stats, font, true); } hardware.display.Update(); @@ -517,6 +598,7 @@ namespace oopsy { menu_button_held = hardware.tap_.Pressed(); menu_button_incr += hardware.GetKnobValue(6) * app_count; menu_button_held_ms = hardware.tap_.TimeHeldMs(); + if (hardware.tap_.FallingEdge()) menu_button_released = 1; #else menu_button_held = hardware.encoder.Pressed(); menu_button_incr += hardware.encoder.Increment(); @@ -529,19 +611,25 @@ namespace oopsy { #ifdef OOPSY_TARGET_HAS_OLED if (mode == MODE_SCOPE) { // TODO: add selector for scope storage source: - float * buf = hardware_outs[0]; + float * buf0 = scope_source ? hardware_ins[0] : hardware_outs[0]; + float * buf1 = scope_source ? hardware_ins[1] : hardware_outs[1]; size_t samples = scope_samples(); for (size_t i=0; i pt0 ? pt0 : min0; max0 = max0 < pt0 ? pt0 : max0; + min1 = min1 > pt1 ? pt1 : min1; + max1 = max1 < pt1 ? pt1 : max1; } - scope_data[scope_step] = (min0); + scope_data[scope_step][0] = (min0); + scope_data[scope_step][1] = (min1); scope_step++; - scope_data[scope_step] = (max0); + scope_data[scope_step][0] = (max0); + scope_data[scope_step][1] = (min1); scope_step++; if (scope_step >= SSD1309_WIDTH*2) scope_step = 0; } From 43137e99c080cac08a6a358dbc6c8f44fcde2f87 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 17:21:02 -0500 Subject: [PATCH 26/58] fix typo --- source/genlib_daisy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 99b3958..f499d99 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -511,7 +511,7 @@ namespace oopsy { switch (scope_option) { case SCOPEOPTION_SOURCE: { hardware.display.SetCursor(0, h - font.FontHeight); - hardware.display.WriteString(scope_source ? "inputs" : "outputs", font, true); + hardware.display.WriteString(scope_source ? "in1 in2" : "out1 out2", font, true); } break; case SCOPEOPTION_ZOOM: { // each pixel is zoom samples; zoom/samplerate seconds @@ -629,7 +629,7 @@ namespace oopsy { scope_data[scope_step][1] = (min1); scope_step++; scope_data[scope_step][0] = (max0); - scope_data[scope_step][1] = (min1); + scope_data[scope_step][1] = (max1); scope_step++; if (scope_step >= SSD1309_WIDTH*2) scope_step = 0; } From a1aaa27791fea24d274b0a9098fccd800eb8239c Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 19:49:02 -0500 Subject: [PATCH 27/58] dummy --- source/genlib_daisy.h | 2 +- source/readme.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index f499d99..79fd22d 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -250,7 +250,7 @@ namespace oopsy { } ScopeOptions; FontDef& font = Font_6x8; - uint_fast8_t scope_zoom = 5; + uint_fast8_t scope_zoom = 3; uint_fast8_t scope_step = 0; uint_fast8_t scope_option = 0, scope_source = 0, scope_style = 0; uint16_t console_cols, console_rows, console_line; diff --git a/source/readme.md b/source/readme.md index c37e483..c8a8b9b 100644 --- a/source/readme.md +++ b/source/readme.md @@ -24,3 +24,4 @@ Memory allocation for the exported gen~ code happens only when an app is loaded. Oopsy uses two pre-allocated blocks of memory, a smaller one in SRAM (around 500Kb) and a larger one in SDRAM (64Mb). Both memory blocks are reset when an app is loaded, so that each gen~ has the full blocks available. Generally SRAM seems to offer faster access, so allocations go to this block if they will fit, which is the case for most gen~ patchers and gen~ operators. Only `data` and `delay` operators with large contents that do not fit in SRAM will use the SDRAM block. The Daisy offers 128k for code size. Initial testing showed that multiple apps have very limited impact on code size. + From 793adf3dcaa9acf28cd7a1b5aa4bb5ba594cb7ab Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 19:51:35 -0500 Subject: [PATCH 28/58] dummy --- source/readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/source/readme.md b/source/readme.md index c8a8b9b..c37e483 100644 --- a/source/readme.md +++ b/source/readme.md @@ -24,4 +24,3 @@ Memory allocation for the exported gen~ code happens only when an app is loaded. Oopsy uses two pre-allocated blocks of memory, a smaller one in SRAM (around 500Kb) and a larger one in SDRAM (64Mb). Both memory blocks are reset when an app is loaded, so that each gen~ has the full blocks available. Generally SRAM seems to offer faster access, so allocations go to this block if they will fit, which is the case for most gen~ patchers and gen~ operators. Only `data` and `delay` operators with large contents that do not fit in SRAM will use the SDRAM block. The Daisy offers 128k for code size. Initial testing showed that multiple apps have very limited impact on code size. - From 7f32851bc86bee99ac4184c7f8be247f26510bc7 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Thu, 3 Dec 2020 19:55:16 -0500 Subject: [PATCH 29/58] doc update --- README.md | 2 +- source/oopsy.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index e6df19f..334d22d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Each Daisy binary can hold several gen~ patcher "apps", which can be switched be ## How gen~ features map to Daisy -Mostly this works by adding an appropriate name to the `in`, `out`, and `param` objects. +Mostly this works by adding an appropriate name to the `in`, `out`, and `param` objects, but many features will also auto-map without special naming. ### Audio diff --git a/source/oopsy.js b/source/oopsy.js index 79fe3af..5d9d7d1 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -145,7 +145,6 @@ function run() { }) let build_name = apps.map(v=>v.patch.name).join("_") - // configure build path: const build_path = path.join(__dirname, `build_${build_name}_${target}`) console.log(`Building to ${build_path}`) From 0b35b1e4666d53da8837e800013b9df55d8584f2 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Fri, 4 Dec 2020 13:29:39 -0500 Subject: [PATCH 30/58] added 3-pole smoothing abstraction for sensitive operations with ctrls --- README.md | 2 +- code/oopsy.ctrl.smooth3.gendsp | 330 ++++++++++++++++++ ...format.gendsp => oopsy.midi.format.gendsp} | 0 ...diparse.gendsp => oopsy.midi.parse.gendsp} | 0 examples/midi_io.maxpat | 8 +- examples/reverb.maxpat | 2 +- examples/simple.maxpat | 12 - source/genlib_daisy.h | 5 +- 8 files changed, 339 insertions(+), 20 deletions(-) create mode 100644 code/oopsy.ctrl.smooth3.gendsp rename code/{gen2daisy.midiformat.gendsp => oopsy.midi.format.gendsp} (100%) rename code/{gen2daisy.midiparse.gendsp => oopsy.midi.parse.gendsp} (100%) diff --git a/README.md b/README.md index 334d22d..4c00e61 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Hardware voltages are mapped to gen~ -1..1 ### CV/Gate/Knobs/Switches etc. -- `param cv1`, `param gate2`, `param knob1`, `param key2` etc. will give you the CV and gate inputs, hardware knobs, keys, etc. Use `@min` and `@max` to remap the normalized ranges. Use `@min` and `@max` to remap normalized ranges as desired. +- `param cv1`, `param gate2`, `param knob1`, `param key2`, `param knob_delay`, `param switch_enable` etc. will give you the CV and gate inputs, hardware knobs, keys, etc. Use `@min` and `@max` to remap the normalized ranges. Use `@min` and `@max` to remap normalized ranges as desired. - Oopsy will try to auto-map any other `param` objects to any unused Knob/CV inputs. - `out cv1`, `out gate2`, etc. will send the signal to corresponding CV or Gate outputs if the device has them. `` just needs to be an output channel number that isn't being used for anything else. - CV/gate inputs and outputs are sampled at block rate, which on the default configuration of the Daisy is every 48 samples = 1ms. Trigger/gates shorter than 1-2ms might be missed. diff --git a/code/oopsy.ctrl.smooth3.gendsp b/code/oopsy.ctrl.smooth3.gendsp new file mode 100644 index 0000000..a4c9913 --- /dev/null +++ b/code/oopsy.ctrl.smooth3.gendsp @@ -0,0 +1,330 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 5, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 84.0, 103.0, 466.0, 288.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-15", + "linecount" : 13, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 276.0, 35.0, 150.0, 181.0 ], + "text" : "A 3-pole lowpass filter at 30Hz seems to effectively silence any noise from hardware input ADCs.\n\nMost of the time this level of aggressive smoothing is probably unnecessary, but for some applications that are very sensitive (e.g. setting long delay line lengths) it might be needed." + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-11", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 190.5, 193.0, 46.0, 23.0 ], + "text" : "mix" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-12", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 190.5, 153.0, 45.0, 23.0 ], + "text" : "history" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 118.0, 193.0, 46.0, 23.0 ], + "text" : "mix" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-9", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 118.0, 153.0, 45.0, 23.0 ], + "text" : "history" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 190.5, 240.0, 37.0, 23.0 ], + "text" : "out 1" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 44.0, 193.0, 46.0, 23.0 ], + "text" : "mix" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-10", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 127.5, 53.0, 109.0, 23.0 ], + "text" : "* twopi/samplerate" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 44.0, 153.0, 45.0, 23.0 ], + "text" : "history" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 127.5, 84.0, 26.0, 23.0 ], + "text" : "sin" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 57.5, 84.0, 28.0, 23.0 ], + "text" : "in 1" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 127.5, 23.0, 83.0, 23.0 ], + "text" : "param freq 30" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-6", 1 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-12", 0 ], + "midpoints" : [ 200.0, 222.0, 178.0, 222.0, 178.0, 141.0, 200.0, 141.0 ], + "order" : 1, + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "order" : 0, + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 0 ], + "source" : [ "obj-12", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-6", 0 ], + "source" : [ "obj-14", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-10", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 2 ], + "midpoints" : [ 137.0, 123.5, 227.0, 123.5 ], + "order" : 0, + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-6", 2 ], + "midpoints" : [ 137.0, 121.5, 80.5, 121.5 ], + "order" : 2, + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-8", 2 ], + "midpoints" : [ 137.0, 122.5, 154.5, 122.5 ], + "order" : 1, + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-14", 0 ], + "midpoints" : [ 53.5, 222.0, 31.5, 222.0, 31.5, 141.0, 53.5, 141.0 ], + "order" : 1, + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-8", 1 ], + "order" : 0, + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 1 ], + "order" : 0, + "source" : [ "obj-8", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-9", 0 ], + "midpoints" : [ 127.5, 222.0, 105.5, 222.0, 105.5, 141.0, 127.5, 141.0 ], + "order" : 1, + "source" : [ "obj-8", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-8", 0 ], + "source" : [ "obj-9", 0 ] + } + + } + ] + } + +} diff --git a/code/gen2daisy.midiformat.gendsp b/code/oopsy.midi.format.gendsp similarity index 100% rename from code/gen2daisy.midiformat.gendsp rename to code/oopsy.midi.format.gendsp diff --git a/code/gen2daisy.midiparse.gendsp b/code/oopsy.midi.parse.gendsp similarity index 100% rename from code/gen2daisy.midiparse.gendsp rename to code/oopsy.midi.parse.gendsp diff --git a/examples/midi_io.maxpat b/examples/midi_io.maxpat index 0ebd7ee..9e29a5b 100644 --- a/examples/midi_io.maxpat +++ b/examples/midi_io.maxpat @@ -3030,7 +3030,7 @@ "numoutlets" : 25, "outlettype" : [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" ], "patching_rect" : [ 55.0, 185.0, 271.0, 22.0 ], - "text" : "gen2daisy.midiparse" + "text" : "oopsy.midi.parse" } } @@ -3422,7 +3422,7 @@ "numoutlets" : 1, "outlettype" : [ "" ], "patching_rect" : [ 508.0, 185.0, 166.0, 22.0 ], - "text" : "gen2daisy.midiformat" + "text" : "oopsy.midi.format" } } @@ -3697,14 +3697,14 @@ } , "dependency_cache" : [ { - "name" : "gen2daisy.midiparse.gendsp", + "name" : "oopsy.midi.format.gendsp", "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", "implicit" : 1 } , { - "name" : "gen2daisy.midiformat.gendsp", + "name" : "oopsy.midi.parse.gendsp", "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", "patcherrelativepath" : "../code", "type" : "gDSP", diff --git a/examples/reverb.maxpat b/examples/reverb.maxpat index b92806e..85f1a98 100644 --- a/examples/reverb.maxpat +++ b/examples/reverb.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 1213.0, 82.0, 431.0, 612.0 ], + "rect" : [ 926.0, 78.0, 593.0, 651.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, diff --git a/examples/simple.maxpat b/examples/simple.maxpat index cede418..30617ba 100644 --- a/examples/simple.maxpat +++ b/examples/simple.maxpat @@ -104,18 +104,6 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { - "box" : { - "id" : "obj-3", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 164.0, 51.0, 74.0, 22.0 ], - "text" : "data leds 24" - } - - } -, { "box" : { "id" : "obj-13", "maxclass" : "newobj", diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 79fd22d..5aada31 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -140,6 +140,7 @@ namespace oopsy { #ifdef OOPSY_TARGET_HAS_OLED MODE_CONSOLE, MODE_SCOPE, + //MODE_PARAMS, #endif MODE_COUNT @@ -276,7 +277,7 @@ namespace oopsy { // install new callbacks: mainloopCallback = newapp.staticMainloopCallback; hardware.ChangeAudioCallback(newapp.staticAudioCallback); - log("loaded %s", appdefs[app_selected].name); + log("loaded gen~ %s", appdefs[app_selected].name); log("%d/%dK+%d/%dM", oopsy::sram_used/1024, OOPSY_SRAM_SIZE/1024, oopsy::sdram_used/1048576, OOPSY_SDRAM_SIZE/1048576); } @@ -293,7 +294,7 @@ namespace oopsy { #ifdef OOPSY_TARGET_HAS_OLED console_cols = SSD1309_WIDTH / font.FontWidth + 1; // +1 to accommodate null terminators. - console_rows = SSD1309_HEIGHT / font.FontHeight - 1; // leave one row free for stats + console_rows = SSD1309_HEIGHT / font.FontHeight; console_memory = (char *)calloc(console_cols, console_rows); console_stats = (char *)calloc(console_cols, 1); for (int i=0; i Date: Fri, 4 Dec 2020 14:12:13 -0500 Subject: [PATCH 31/58] auto-bpatcher creation --- .gitignore | 4 +- examples/daisy_field.maxpat | 734 --------------------- init/oopsy-objectmappings.txt | 10 + patchers/oopsy.maxpat | 413 ++++++------ {examples => templates}/daisy_patch.maxpat | 227 ++----- 5 files changed, 273 insertions(+), 1115 deletions(-) delete mode 100644 examples/daisy_field.maxpat create mode 100644 init/oopsy-objectmappings.txt rename {examples => templates}/daisy_patch.maxpat (56%) diff --git a/.gitignore b/.gitignore index a37bde5..3af64a4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ notes/ examples/*.cpp examples/*.h help/*.cpp -help/*.h \ No newline at end of file +help/*.h +templates/*.cpp +templates/*.h \ No newline at end of file diff --git a/examples/daisy_field.maxpat b/examples/daisy_field.maxpat deleted file mode 100644 index 4ce129f..0000000 --- a/examples/daisy_field.maxpat +++ /dev/null @@ -1,734 +0,0 @@ -{ - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "box", - "rect" : [ 386.0, 113.0, 479.0, 644.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { - "box" : { - "args" : [ "@target", "field" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 191.5, 106.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - - } -, { - "box" : { - "id" : "obj-6", - "lastchannelcount" : 0, - "maxclass" : "live.gain~", - "numinlets" : 2, - "numoutlets" : 5, - "outlettype" : [ "signal", "signal", "", "float", "list" ], - "parameter_enable" : 1, - "patching_rect" : [ 29.333333333333343, 384.0, 48.0, 136.0 ], - "saved_attribute_attributes" : { - "valueof" : { - "parameter_longname" : "live.gain~", - "parameter_mmax" : 6.0, - "parameter_mmin" : -70.0, - "parameter_shortname" : "live.gain~", - "parameter_type" : 0, - "parameter_unitstyle" : 4 - } - - } -, - "varname" : "live.gain~" - } - - } -, { - "box" : { - "id" : "obj-19", - "maxclass" : "ezdac~", - "numinlets" : 2, - "numoutlets" : 0, - "patching_rect" : [ 29.333333333333343, 532.0, 45.0, 45.0 ] - } - - } -, { - "box" : { - "fontname" : "Arial Bold Italic", - "fontsize" : 24.0, - "id" : "obj-49", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 25.0, 27.0, 141.0, 33.0 ], - "text" : "Daisy Field" - } - - } -, { - "box" : { - "color" : [ 0.254901960784314, 0.533333333333333, 0.258823529411765, 1.0 ], - "fontsize" : 24.0, - "id" : "obj-16", - "maxclass" : "newobj", - "numinlets" : 3, - "numoutlets" : 6, - "outlettype" : [ "signal", "signal", "signal", "signal", "signal", "signal" ], - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "dsp.gen", - "rect" : [ 67.0, 198.0, 1141.0, 427.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { - "box" : { - "id" : "obj-40", - "linecount" : 4, - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 876.0, 216.0, 194.0, 60.0 ], - "text" : "Quick demo of using [data leds] to update the LED buttons\n\nValues should be between 0 and 1" - } - - } -, { - "box" : { - "id" : "obj-37", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 876.0, 152.0, 28.0, 22.0 ], - "text" : "abs" - } - - } -, { - "box" : { - "id" : "obj-36", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 876.0, 117.0, 37.0, 22.0 ], - "text" : "noise" - } - - } -, { - "box" : { - "id" : "obj-26", - "maxclass" : "newobj", - "numinlets" : 3, - "numoutlets" : 0, - "patching_rect" : [ 876.0, 184.0, 178.0, 22.0 ], - "text" : "poke leds 0 @boundmode wrap" - } - - } -, { - "box" : { - "id" : "obj-25", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 955.5, 117.0, 72.0, 22.0 ], - "text" : "phasor 1/24" - } - - } -, { - "box" : { - "id" : "obj-24", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 955.5, 152.0, 29.5, 22.0 ], - "text" : "*" - } - - } -, { - "box" : { - "id" : "obj-23", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 966.0, 45.0, 74.0, 22.0 ], - "text" : "data leds 24" - } - - } -, { - "box" : { - "id" : "obj-22", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 127.0, 275.0, 29.5, 22.0 ], - "text" : "*" - } - - } -, { - "box" : { - "id" : "obj-21", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 83.0, 275.0, 29.5, 22.0 ], - "text" : "*" - } - - } -, { - "box" : { - "id" : "obj-6", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 175.0, 275.0, 99.0, 22.0 ], - "text" : "param knob1 0.1" - } - - } -, { - "box" : { - "id" : "obj-20", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 572.0, 124.0, 186.0, 22.0 ], - "text" : "param gate 0 @min 0 @max 100" - } - - } -, { - "box" : { - "id" : "obj-19", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 489.0, 87.0, 181.0, 22.0 ], - "text" : "param cv4 0 @min 0 @max 400" - } - - } -, { - "box" : { - "id" : "obj-18", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 436.0, 56.0, 181.0, 22.0 ], - "text" : "param cv1 0 @min 0 @max 100" - } - - } -, { - "box" : { - "id" : "obj-17", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 712.0, 206.0, 26.0, 22.0 ], - "text" : "> 0" - } - - } -, { - "box" : { - "id" : "obj-16", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 712.0, 250.0, 62.0, 22.0 ], - "text" : "out 6 gate" - } - - } -, { - "box" : { - "id" : "obj-15", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 582.0, 206.0, 46.0, 22.0 ], - "text" : "cycle 1" - } - - } -, { - "box" : { - "id" : "obj-14", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 517.0, 206.0, 37.0, 22.0 ], - "text" : "noise" - } - - } -, { - "box" : { - "id" : "obj-13", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 582.0, 250.0, 77.0, 22.0 ], - "text" : "out 5 cv2_lfo" - } - - } -, { - "box" : { - "id" : "obj-12", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 517.0, 250.0, 51.0, 22.0 ], - "text" : "out 4 cv" - } - - } -, { - "box" : { - "id" : "obj-11", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 181.0, 206.0, 194.0, 22.0 ], - "text" : "param key16 0 @min 0 @max 100" - } - - } -, { - "box" : { - "id" : "obj-10", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 438.0, 250.0, 61.0, 22.0 ], - "text" : "out 3 midi" - } - - } -, { - "box" : { - "id" : "obj-9", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 438.0, 184.0, 53.0, 22.0 ], - "text" : "in 3 midi" - } - - } -, { - "box" : { - "id" : "obj-8", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 127.0, 142.0, 222.0, 22.0 ], - "text" : "param knob8 400 @min 200 @max 800" - } - - } -, { - "box" : { - "id" : "obj-7", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 83.0, 52.0, 222.0, 22.0 ], - "text" : "param knob2 300 @min 200 @max 400" - } - - } -, { - "box" : { - "id" : "obj-5", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 127.0, 366.0, 35.0, 22.0 ], - "text" : "out 2" - } - - } -, { - "box" : { - "id" : "obj-4", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 127.0, 184.0, 36.0, 22.0 ], - "text" : "cycle" - } - - } -, { - "box" : { - "id" : "obj-3", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 83.0, 366.0, 35.0, 22.0 ], - "text" : "out 1" - } - - } -, { - "box" : { - "id" : "obj-2", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 83.0, 184.0, 36.0, 22.0 ], - "text" : "cycle" - } - - } -, { - "box" : { - "id" : "obj-1", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 83.0, 94.0, 222.0, 22.0 ], - "text" : "param knob2 300 @min 200 @max 400" - } - - } - ], - "lines" : [ { - "patchline" : { - "destination" : [ "obj-2", 0 ], - "source" : [ "obj-1", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-4", 0 ], - "source" : [ "obj-11", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-12", 0 ], - "source" : [ "obj-14", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-13", 0 ], - "order" : 1, - "source" : [ "obj-15", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-17", 0 ], - "order" : 0, - "source" : [ "obj-15", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-16", 0 ], - "source" : [ "obj-17", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-2", 0 ], - "source" : [ "obj-18", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-2", 0 ], - "source" : [ "obj-19", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-21", 0 ], - "source" : [ "obj-2", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-2", 0 ], - "source" : [ "obj-20", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-3", 0 ], - "source" : [ "obj-21", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-5", 0 ], - "source" : [ "obj-22", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-24", 1 ], - "source" : [ "obj-23", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-26", 1 ], - "source" : [ "obj-24", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-24", 0 ], - "source" : [ "obj-25", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-37", 0 ], - "source" : [ "obj-36", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-26", 0 ], - "source" : [ "obj-37", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-22", 0 ], - "source" : [ "obj-4", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-21", 1 ], - "order" : 1, - "source" : [ "obj-6", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-22", 1 ], - "order" : 0, - "source" : [ "obj-6", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-4", 0 ], - "source" : [ "obj-8", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-10", 0 ], - "source" : [ "obj-9", 0 ] - } - - } - ] - } -, - "patching_rect" : [ 29.333333333333343, 313.0, 71.5, 35.0 ], - "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/examples/", - "exportname" : "field" - } -, - "text" : "gen~", - "textcolor" : [ 0.996078431372549, 0.996078431372549, 0.996078431372549, 1.0 ], - "varname" : "field" - } - - } - ], - "lines" : [ { - "patchline" : { - "destination" : [ "obj-6", 0 ], - "source" : [ "obj-16", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-19", 1 ], - "order" : 0, - "source" : [ "obj-6", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-19", 0 ], - "order" : 1, - "source" : [ "obj-6", 0 ] - } - - } - ], - "parameters" : { - "obj-6" : [ "live.gain~", "live.gain~", 0 ], - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], - "parameterbanks" : { - - } -, - "inherited_shortname" : 1 - } -, - "dependency_cache" : [ { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } - ], - "autosave" : 0 - } - -} diff --git a/init/oopsy-objectmappings.txt b/init/oopsy-objectmappings.txt new file mode 100644 index 0000000..04440f5 --- /dev/null +++ b/init/oopsy-objectmappings.txt @@ -0,0 +1,10 @@ +max definesubstitution oopsy.patch bpatcher @name oopsy.maxpat @args patch; +max objectfile oopsy.patch oopsy.patch; +max definesubstitution oopsy.field bpatcher @name oopsy.maxpat @args field; +max objectfile oopsy.field oopsy.field; +max definesubstitution oopsy.petal bpatcher @name oopsy.maxpat @args petal; +max objectfile oopsy.petal oopsy.petal; +max definesubstitution oopsy.pod bpatcher @name oopsy.maxpat @args pod; +max objectfile oopsy.pod oopsy.pod; +max definesubstitution oopsy.versio bpatcher @name oopsy.maxpat @args versio; +max objectfile oopsy.versio oopsy.versio; diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index 4858c2f..349ada7 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 707.0, 381.0, 714.0, 635.0 ], + "rect" : [ 608.0, 155.0, 806.0, 727.0 ], "bglocked" : 0, "openinpresentation" : 1, "default_fontsize" : 12.0, @@ -40,13 +40,136 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-10", + "id" : "obj-56", + "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 183.0, 309.0, 150.0, 20.0 ], - "presentation" : 1, - "presentation_rect" : [ 183.0, 309.0, 150.0, 20.0 ] + "patching_rect" : [ 44.5, 134.5, 150.0, 33.0 ], + "presentation_linecount" : 2, + "text" : "saving a patcher will also trigger compile" + } + + } +, { + "box" : { + "id" : "obj-55", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 44.5, 179.5, 150.0, 33.0 ], + "presentation_linecount" : 4, + "text" : "audio must be on for exportcode to work" + } + + } +, { + "box" : { + "id" : "obj-48", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "", "int" ], + "patching_rect" : [ 241.0, 185.0, 91.0, 22.0 ], + "text" : "adstatus switch" + } + + } +, { + "box" : { + "id" : "obj-45", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "bang" ], + "patching_rect" : [ 243.5, 94.0, 61.0, 22.0 ], + "text" : "savebang" + } + + } +, { + "box" : { + "comment" : "", + "id" : "obj-43", + "index" : 0, + "maxclass" : "inlet", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 227.0, 31.0, 30.0, 30.0 ] + } + + } +, { + "box" : { + "id" : "obj-41", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "bang", "int" ], + "patching_rect" : [ 227.0, 156.0, 32.0, 22.0 ], + "text" : "t b 1" + } + + } +, { + "box" : { + "id" : "obj-38", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "bang", "" ], + "patching_rect" : [ 227.0, 66.0, 136.0, 22.0 ], + "text" : "sel bang" + } + + } +, { + "box" : { + "id" : "obj-37", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 227.0, 262.0, 94.0, 22.0 ], + "text" : "prepend symbol" + } + + } +, { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 3, + "outlettype" : [ "", "", "" ], + "patching_rect" : [ 344.0, 220.0, 153.0, 22.0 ], + "text" : "route target done" + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 227.0, 220.0, 72.0, 22.0 ], + "text" : "patcherargs" + } + + } +, { + "box" : { + "id" : "obj-11", + "linecount" : 6, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 44.5, 31.0, 150.0, 87.0 ], + "text" : "bang input triggers patcherargs, which via 'done' will trigger compile\nother messages route to patcherattrs parser, but do not trigger compile" } } @@ -215,7 +338,7 @@ ] } , - "patching_rect" : [ 271.0, 450.0, 53.0, 22.0 ], + "patching_rect" : [ 278.0, 565.0, 53.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -234,7 +357,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "clear" ], - "patching_rect" : [ 327.5, 450.0, 41.0, 22.0 ], + "patching_rect" : [ 334.5, 565.0, 41.0, 22.0 ], "text" : "t clear" } @@ -247,7 +370,7 @@ "numoutlets" : 4, "outlettype" : [ "", "int", "", "" ], "parameter_enable" : 0, - "patching_rect" : [ 271.0, 485.0, 136.0, 75.0 ], + "patching_rect" : [ 278.0, 600.0, 136.0, 75.0 ], "presentation" : 1, "presentation_rect" : [ 0.0, 32.0, 128.0, 92.0 ], "readonly" : 1, @@ -263,7 +386,7 @@ "numoutlets" : 3, "outlettype" : [ "", "", "float" ], "parameter_enable" : 1, - "patching_rect" : [ 90.0, 178.0, 100.0, 15.0 ], + "patching_rect" : [ 227.0, 296.0, 100.0, 15.0 ], "presentation" : 1, "presentation_rect" : [ 31.0, 0.0, 45.0, 15.0 ], "saved_attribute_attributes" : { @@ -291,7 +414,7 @@ "numoutlets" : 2, "outlettype" : [ "", "" ], "parameter_enable" : 1, - "patching_rect" : [ 500.0, 445.191985999999986, 62.0, 16.0 ], + "patching_rect" : [ 507.0, 560.191986000000043, 62.0, 16.0 ], "presentation" : 1, "presentation_rect" : [ 76.0, 0.0, 52.0, 15.0 ], "saved_attribute_attributes" : { @@ -320,7 +443,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "bang", "" ], - "patching_rect" : [ 131.0, 210.25, 29.5, 22.0 ], + "patching_rect" : [ 267.5, 318.0, 29.5, 22.0 ], "text" : "t b l" } @@ -332,43 +455,19 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 550.0, 474.0, 32.0, 22.0 ], + "patching_rect" : [ 557.0, 589.0, 32.0, 22.0 ], "text" : "gate" } - } -, { - "box" : { - "id" : "obj-4", - "linecount" : 2, - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 192.0, 22.0, 168.0, 33.0 ], - "text" : "bang (or save patcher) to trigger the oopsy workflow" - } - - } -, { - "box" : { - "id" : "obj-3", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "bang" ], - "patching_rect" : [ 123.5, 38.0, 61.0, 22.0 ], - "text" : "savebang" - } - } , { "box" : { "id" : "obj-30", - "linecount" : 4, + "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 14.0, 178.0, 67.0, 60.0 ], + "patching_rect" : [ 44.5, 278.0, 150.0, 33.0 ], "text" : "choose device target to compile for" } @@ -380,7 +479,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 37.5, 378.0, 224.0, 74.0 ], + "patching_rect" : [ 44.5, 493.0, 224.0, 74.0 ], "text" : "the node.js script is a thin wrapper around oopsy.js, which will generate the glue code between gen~ export and the Daisy APIs, compile it, and try to upload it to a device." } @@ -392,7 +491,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 37.5, 288.000003099441528, 223.5, 60.0 ], + "patching_rect" : [ 44.5, 403.000003099441528, 223.5, 60.0 ], "text" : "oopsy.snoop will find all the gen~ objects in the parent patcher, configure them for export, trigger the export, then notify the node.js script" } @@ -404,56 +503,10 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 454.0, 288.000003099441528, 114.0, 33.0 ], + "patching_rect" : [ 461.0, 403.000003099441528, 114.0, 33.0 ], "text" : "turn Max-style path into OS path" } - } -, { - "box" : { - "id" : "obj-25", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 2, - "outlettype" : [ "bang", "" ], - "patching_rect" : [ 327.5, 149.0, 54.0, 22.0 ], - "text" : "sel bang" - } - - } -, { - "box" : { - "id" : "obj-24", - "linecount" : 5, - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 387.0, 149.0, 94.0, 74.0 ], - "text" : "audio must be on for the exportcode message to work" - } - - } -, { - "box" : { - "id" : "obj-20", - "maxclass" : "ezdac~", - "numinlets" : 2, - "numoutlets" : 0, - "patching_rect" : [ 342.5, 206.0, 31.0, 31.0 ] - } - - } -, { - "box" : { - "id" : "obj-19", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "int" ], - "patching_rect" : [ 342.5, 182.0, 22.0, 22.0 ], - "text" : "t 1" - } - } , { "box" : { @@ -462,7 +515,7 @@ "numinlets" : 2, "numoutlets" : 4, "outlettype" : [ "dictionary", "", "", "" ], - "patching_rect" : [ 480.0, 506.0, 50.5, 22.0 ], + "patching_rect" : [ 487.0, 621.0, 50.5, 22.0 ], "saved_object_attributes" : { "embed" : 0, "parameter_enable" : 0, @@ -479,7 +532,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 550.0, 506.0, 114.0, 22.0 ], + "patching_rect" : [ 557.0, 621.0, 114.0, 22.0 ], "text" : "print oopsy-verbose" } @@ -491,7 +544,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 480.0, 474.0, 65.0, 22.0 ], + "patching_rect" : [ 487.0, 589.0, 65.0, 22.0 ], "text" : "route error" } @@ -503,7 +556,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 480.0, 413.0, 102.0, 22.0 ], + "patching_rect" : [ 487.0, 528.0, 102.0, 22.0 ], "text" : "route terminated" } @@ -516,7 +569,7 @@ "numoutlets" : 1, "outlettype" : [ "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 123.5, 76.0, 30.0, 30.0 ], + "patching_rect" : [ 227.0, 122.0, 30.0, 30.0 ], "presentation" : 1, "presentation_rect" : [ 0.0, 0.0, 30.0, 30.0 ] } @@ -531,7 +584,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 271.0, 378.0, 228.0, 26.0 ], + "patching_rect" : [ 278.0, 493.0, 228.0, 26.0 ], "saved_object_attributes" : { "autostart" : 0, "defer" : 0, @@ -551,46 +604,10 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 271.0, 320.0, 111.0, 22.0 ], + "patching_rect" : [ 278.0, 435.0, 111.0, 22.0 ], "text" : "prepend script start" } - } -, { - "box" : { - "id" : "obj-18", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 90.5, 149.0, 94.0, 22.0 ], - "text" : "prepend symbol" - } - - } -, { - "box" : { - "id" : "obj-17", - "maxclass" : "newobj", - "numinlets" : 3, - "numoutlets" : 3, - "outlettype" : [ "", "", "" ], - "patching_rect" : [ 90.5, 119.0, 199.0, 22.0 ], - "text" : "route target done" - } - - } -, { - "box" : { - "id" : "obj-16", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 217.5, 84.0, 72.0, 22.0 ], - "text" : "patcherargs" - } - } , { "box" : { @@ -599,7 +616,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 141.5, 242.5, 130.0, 22.0 ], + "patching_rect" : [ 278.0, 350.25, 130.0, 22.0 ], "text" : "prepend setprop target" } @@ -744,7 +761,7 @@ ] } , - "patching_rect" : [ 395.0, 288.000003099441528, 54.0, 22.0 ], + "patching_rect" : [ 402.0, 403.000003099441528, 54.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -755,19 +772,6 @@ "text" : "p fixpath" } - } -, { - "box" : { - "comment" : "", - "id" : "obj-1", - "index" : 0, - "maxclass" : "inlet", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 90.5, 76.0, 30.0, 30.0 ] - } - } , { "box" : { @@ -778,7 +782,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 271.0, 288.000003099441528, 114.0, 26.0 ], + "patching_rect" : [ 278.0, 403.000003099441528, 114.0, 26.0 ], "saved_object_attributes" : { "filename" : "oopsy.snoop", "parameter_enable" : 0 @@ -790,14 +794,6 @@ } ], "lines" : [ { - "patchline" : { - "destination" : [ "obj-17", 0 ], - "midpoints" : [ 100.0, 112.0, 100.0, 112.0 ], - "source" : [ "obj-1", 0 ] - } - - } -, { "patchline" : { "destination" : [ "obj-5", 1 ], "source" : [ "obj-12", 0 ] @@ -814,138 +810,134 @@ , { "patchline" : { "destination" : [ "obj-5", 0 ], - "midpoints" : [ 151.0, 275.750001549720764, 280.5, 275.750001549720764 ], + "midpoints" : [ 287.5, 390.750001549720764, 287.5, 390.750001549720764 ], "source" : [ "obj-14", 0 ] } } , { "patchline" : { - "destination" : [ "obj-17", 0 ], - "midpoints" : [ 280.0, 112.0, 100.0, 112.0 ], - "source" : [ "obj-16", 1 ] + "destination" : [ "obj-21", 0 ], + "source" : [ "obj-15", 1 ] } } , { "patchline" : { - "destination" : [ "obj-18", 0 ], - "source" : [ "obj-17", 0 ] + "destination" : [ "obj-37", 0 ], + "source" : [ "obj-15", 0 ] } } , { "patchline" : { - "destination" : [ "obj-25", 0 ], + "destination" : [ "obj-13", 1 ], "order" : 0, - "source" : [ "obj-17", 2 ] + "source" : [ "obj-2", 0 ] } } , { "patchline" : { - "destination" : [ "obj-5", 0 ], + "destination" : [ "obj-35", 0 ], "order" : 1, - "source" : [ "obj-17", 2 ] + "source" : [ "obj-2", 0 ] } } , { "patchline" : { - "destination" : [ "obj-36", 0 ], - "source" : [ "obj-18", 0 ] + "destination" : [ "obj-42", 0 ], + "source" : [ "obj-2", 1 ] } } , { "patchline" : { - "destination" : [ "obj-20", 0 ], - "source" : [ "obj-19", 0 ] + "destination" : [ "obj-37", 0 ], + "midpoints" : [ 353.5, 254.5, 236.5, 254.5 ], + "source" : [ "obj-21", 0 ] } } , { "patchline" : { - "destination" : [ "obj-13", 1 ], - "order" : 0, - "source" : [ "obj-2", 0 ] + "destination" : [ "obj-5", 0 ], + "midpoints" : [ 420.5, 385.500001549720764, 287.5, 385.500001549720764 ], + "source" : [ "obj-21", 1 ] } } , { "patchline" : { - "destination" : [ "obj-35", 0 ], - "order" : 1, - "source" : [ "obj-2", 0 ] + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-32", 0 ] } } , { "patchline" : { - "destination" : [ "obj-42", 0 ], - "source" : [ "obj-2", 1 ] + "destination" : [ "obj-47", 0 ], + "source" : [ "obj-35", 0 ] } } , { "patchline" : { - "destination" : [ "obj-16", 0 ], - "midpoints" : [ 337.0, 175.0, 299.0, 175.0, 299.0, 74.0, 227.0, 74.0 ], - "order" : 1, - "source" : [ "obj-25", 0 ] + "destination" : [ "obj-6", 0 ], + "source" : [ "obj-36", 1 ] } } , { "patchline" : { - "destination" : [ "obj-19", 0 ], - "order" : 0, - "source" : [ "obj-25", 0 ] + "destination" : [ "obj-36", 0 ], + "source" : [ "obj-37", 0 ] } } , { "patchline" : { - "destination" : [ "obj-7", 0 ], - "source" : [ "obj-3", 0 ] + "destination" : [ "obj-21", 0 ], + "source" : [ "obj-38", 1 ] } } , { "patchline" : { - "destination" : [ "obj-13", 0 ], - "source" : [ "obj-32", 0 ] + "destination" : [ "obj-7", 0 ], + "source" : [ "obj-38", 0 ] } } , { "patchline" : { - "destination" : [ "obj-47", 0 ], - "source" : [ "obj-35", 0 ] + "destination" : [ "obj-2", 0 ], + "order" : 1, + "source" : [ "obj-40", 0 ] } } , { "patchline" : { - "destination" : [ "obj-6", 0 ], - "source" : [ "obj-36", 1 ] + "destination" : [ "obj-51", 0 ], + "midpoints" : [ 287.5, 474.5, 344.0, 474.5 ], + "order" : 0, + "source" : [ "obj-40", 0 ] } } , { "patchline" : { - "destination" : [ "obj-2", 0 ], - "order" : 1, - "source" : [ "obj-40", 0 ] + "destination" : [ "obj-15", 0 ], + "source" : [ "obj-41", 0 ] } } , { "patchline" : { - "destination" : [ "obj-51", 0 ], - "midpoints" : [ 280.5, 359.5, 337.0, 359.5 ], - "order" : 0, - "source" : [ "obj-40", 0 ] + "destination" : [ "obj-48", 0 ], + "source" : [ "obj-41", 1 ] } } @@ -962,6 +954,13 @@ "source" : [ "obj-42", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-38", 0 ], + "source" : [ "obj-43", 0 ] + } + } , { "patchline" : { @@ -969,6 +968,13 @@ "source" : [ "obj-44", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-7", 0 ], + "source" : [ "obj-45", 0 ] + } + } , { "patchline" : { @@ -1000,16 +1006,7 @@ } , { "patchline" : { - "destination" : [ "obj-7", 0 ], - "midpoints" : [ 140.5, 237.25, 86.25, 237.25, 86.25, 69.0, 133.0, 69.0 ], - "source" : [ "obj-6", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-17", 0 ], - "midpoints" : [ 133.0, 112.0, 100.0, 112.0 ], + "destination" : [ "obj-41", 0 ], "source" : [ "obj-7", 0 ] } diff --git a/examples/daisy_patch.maxpat b/templates/daisy_patch.maxpat similarity index 56% rename from examples/daisy_patch.maxpat rename to templates/daisy_patch.maxpat index 558bbc1..483daeb 100644 --- a/examples/daisy_patch.maxpat +++ b/templates/daisy_patch.maxpat @@ -40,7 +40,7 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "args" : [ "@target", "patch" ], + "args" : [ "field", "@target", "patch" ], "bgmode" : 0, "border" : 0, "clickthrough" : 0, @@ -53,18 +53,18 @@ "numinlets" : 1, "numoutlets" : 0, "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 191.5, 106.0, 128.0, 128.0 ], + "patching_rect" : [ 293.5, 139.0, 128.0, 128.0 ], "viewvisibility" : 1 } } , { "box" : { - "id" : "obj-13", + "id" : "obj-3", "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 3, - "outlettype" : [ "signal", "signal", "signal" ], + "numinlets" : 4, + "numoutlets" : 4, + "outlettype" : [ "signal", "signal", "signal", "signal" ], "patcher" : { "fileversion" : 1, "appversion" : { @@ -106,71 +106,69 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-9", - "maxclass" : "newobj", + "id" : "obj-12", + "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 395.0, 266.0, 57.0, 22.0 ], - "text" : "out 3 cv1" + "patching_rect" : [ 213.5, 35.0, 150.0, 34.0 ], + "text" : "Parameters:\n" } } , { "box" : { - "id" : "obj-8", - "maxclass" : "newobj", + "id" : "obj-11", + "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 352.0, 339.0, 69.0, 22.0 ], - "text" : "out 2 gate1" + "patching_rect" : [ 23.5, 111.0, 150.0, 20.0 ], + "text" : "Audio IOs" } } , { "box" : { - "id" : "obj-7", + "id" : "obj-6", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 73.0, 316.0, 65.0, 22.0 ], - "text" : "param cv2" + "patching_rect" : [ 146.5, 146.0, 28.0, 22.0 ], + "text" : "in 4" } } , { "box" : { - "id" : "obj-5", + "id" : "obj-7", "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 315.0, 138.0, 102.0, 22.0 ], - "text" : "data foodat 100 2" + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 146.5, 215.0, 35.0, 22.0 ], + "text" : "out 4" } } , { "box" : { - "id" : "obj-1", + "id" : "obj-8", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 50.0, 14.0, 60.0, 22.0 ], - "text" : "in 1 offset" + "patching_rect" : [ 105.5, 146.0, 28.0, 22.0 ], + "text" : "in 3" } } , { "box" : { - "id" : "obj-2", + "id" : "obj-9", "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 305.0, 14.0, 88.0, 22.0 ], - "text" : "param cv1_foo" + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 105.5, 215.0, 35.0, 22.0 ], + "text" : "out 3" } } @@ -181,162 +179,33 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 176.0, 149.0, 37.0, 22.0 ], - "text" : "noise" + "patching_rect" : [ 64.5, 146.0, 28.0, 22.0 ], + "text" : "in 2" } } , { "box" : { - "id" : "obj-4", + "id" : "obj-5", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 176.0, 418.0, 61.0, 22.0 ], - "text" : "out 1 sum" - } - - } - ], - "lines" : [ { - "patchline" : { - "destination" : [ "obj-4", 0 ], - "source" : [ "obj-1", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-4", 0 ], - "source" : [ "obj-2", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-4", 0 ], - "source" : [ "obj-3", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-8", 0 ], - "order" : 1, - "source" : [ "obj-5", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-9", 0 ], - "order" : 0, - "source" : [ "obj-5", 0 ] + "patching_rect" : [ 64.5, 215.0, 35.0, 22.0 ], + "text" : "out 2" } } , { - "patchline" : { - "destination" : [ "obj-4", 0 ], - "source" : [ "obj-7", 0 ] - } - - } - ] - } -, - "patching_rect" : [ 184.0, 291.0, 130.0, 22.0 ], - "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/examples/", - "exportname" : "otherpatch" - } -, - "text" : "gen~ @title otherpatch", - "varname" : "otherpatch" - } - - } -, { - "box" : { - "id" : "obj-3", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "signal" ], - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "dsp.gen", - "rect" : [ 84.0, 103.0, 600.0, 450.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { "box" : { "id" : "obj-1", "maxclass" : "newobj", "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 50.0, 14.0, 28.0, 22.0 ], + "patching_rect" : [ 23.5, 146.0, 28.0, 22.0 ], "text" : "in 1" } - } -, { - "box" : { - "id" : "obj-2", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 305.0, 14.0, 28.0, 22.0 ], - "text" : "in 2" - } - - } -, { - "box" : { - "id" : "obj-3", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 176.0, 149.0, 36.0, 22.0 ], - "text" : "cycle" - } - } , { "box" : { @@ -344,7 +213,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 46.5, 302.0, 35.0, 22.0 ], + "patching_rect" : [ 23.5, 215.0, 35.0, 22.0 ], "text" : "out 1" } @@ -359,21 +228,35 @@ } , { "patchline" : { - "destination" : [ "obj-4", 0 ], + "destination" : [ "obj-5", 0 ], "source" : [ "obj-3", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-7", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-9", 0 ], + "source" : [ "obj-8", 0 ] + } + } ] } , - "patching_rect" : [ 33.0, 291.0, 137.0, 22.0 ], + "patching_rect" : [ 81.0, 245.0, 36.0, 22.0 ], "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/examples/", + "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", "exportname" : "simplepatch" } , - "text" : "gen~ @title simplepatch", + "text" : "gen~", "varname" : "simplepatch" } From 5446d04ac213bd411c084f11dda4c4980a0db27b Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Fri, 4 Dec 2020 14:16:38 -0500 Subject: [PATCH 32/58] remove snippets in favour of templates/objectmapppings --- javascript/oopsy.snoop.js | 2 +- snippets/oopsy_builder.maxpat | 97 ---------------------------- snippets/oopsy_builder_field.maxpat | 98 ----------------------------- snippets/oopsy_builder_patch.maxpat | 98 ----------------------------- snippets/oopsy_builder_petal.maxpat | 98 ----------------------------- snippets/oopsy_builder_pod.maxpat | 98 ----------------------------- 6 files changed, 1 insertion(+), 490 deletions(-) delete mode 100644 snippets/oopsy_builder.maxpat delete mode 100644 snippets/oopsy_builder_field.maxpat delete mode 100644 snippets/oopsy_builder_patch.maxpat delete mode 100644 snippets/oopsy_builder_petal.maxpat delete mode 100644 snippets/oopsy_builder_pod.maxpat diff --git a/javascript/oopsy.snoop.js b/javascript/oopsy.snoop.js index aee5728..5bde857 100644 --- a/javascript/oopsy.snoop.js +++ b/javascript/oopsy.snoop.js @@ -14,7 +14,7 @@ function bang() { function configure(doExport) { var pat = this.patcher.parentpatcher; if (!pat.filepath) { - error("patcher needs to be saved first\n"); + error("oopsy: your patcher needs to be saved first\n"); pat.message("write"); return false; } diff --git a/snippets/oopsy_builder.maxpat b/snippets/oopsy_builder.maxpat deleted file mode 100644 index 409b066..0000000 --- a/snippets/oopsy_builder.maxpat +++ /dev/null @@ -1,97 +0,0 @@ -{ - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "box", - "rect" : [ 84.0, 103.0, 640.0, 480.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { - "box" : { - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - - } - ], - "lines" : [ ], - "parameters" : { - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], - "parameterbanks" : { - - } -, - "inherited_shortname" : 1 - } -, - "dependency_cache" : [ { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } - ], - "autosave" : 0 - } - -} diff --git a/snippets/oopsy_builder_field.maxpat b/snippets/oopsy_builder_field.maxpat deleted file mode 100644 index cfff87c..0000000 --- a/snippets/oopsy_builder_field.maxpat +++ /dev/null @@ -1,98 +0,0 @@ -{ - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "box", - "rect" : [ 84.0, 103.0, 640.0, 480.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { - "box" : { - "args" : [ "@target", "field" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - - } - ], - "lines" : [ ], - "parameters" : { - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], - "parameterbanks" : { - - } -, - "inherited_shortname" : 1 - } -, - "dependency_cache" : [ { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } - ], - "autosave" : 0 - } - -} diff --git a/snippets/oopsy_builder_patch.maxpat b/snippets/oopsy_builder_patch.maxpat deleted file mode 100644 index 954eb5f..0000000 --- a/snippets/oopsy_builder_patch.maxpat +++ /dev/null @@ -1,98 +0,0 @@ -{ - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "box", - "rect" : [ 84.0, 103.0, 640.0, 480.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { - "box" : { - "args" : [ "@target", "patch" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - - } - ], - "lines" : [ ], - "parameters" : { - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], - "parameterbanks" : { - - } -, - "inherited_shortname" : 1 - } -, - "dependency_cache" : [ { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } - ], - "autosave" : 0 - } - -} diff --git a/snippets/oopsy_builder_petal.maxpat b/snippets/oopsy_builder_petal.maxpat deleted file mode 100644 index 32b44fa..0000000 --- a/snippets/oopsy_builder_petal.maxpat +++ /dev/null @@ -1,98 +0,0 @@ -{ - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "box", - "rect" : [ 84.0, 103.0, 640.0, 480.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { - "box" : { - "args" : [ "@target", "petal" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - - } - ], - "lines" : [ ], - "parameters" : { - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], - "parameterbanks" : { - - } -, - "inherited_shortname" : 1 - } -, - "dependency_cache" : [ { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } - ], - "autosave" : 0 - } - -} diff --git a/snippets/oopsy_builder_pod.maxpat b/snippets/oopsy_builder_pod.maxpat deleted file mode 100644 index 98f653c..0000000 --- a/snippets/oopsy_builder_pod.maxpat +++ /dev/null @@ -1,98 +0,0 @@ -{ - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "box", - "rect" : [ 84.0, 103.0, 640.0, 480.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { - "box" : { - "args" : [ "@target", "pod" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 39.5, 35.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - - } - ], - "lines" : [ ], - "parameters" : { - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], - "parameterbanks" : { - - } -, - "inherited_shortname" : 1 - } -, - "dependency_cache" : [ { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } - ], - "autosave" : 0 - } - -} From fd3aa750f902ae1378a6dde203e4f4ad6e1816dc Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Fri, 4 Dec 2020 14:35:17 -0500 Subject: [PATCH 33/58] limit versio to single-app for now --- source/daisy.versio.json | 2 +- source/genlib_daisy.h | 10 +- templates/daisy_patch.maxpat | 301 ----------------------------------- 3 files changed, 9 insertions(+), 304 deletions(-) delete mode 100644 templates/daisy_patch.maxpat diff --git a/source/daisy.versio.json b/source/daisy.versio.json index 39ab53b..369e3d4 100644 --- a/source/daisy.versio.json +++ b/source/daisy.versio.json @@ -1,5 +1,5 @@ { - "max_apps":4, + "max_apps":1, "defines": { "OOPSY_TARGET_VERSIO": 1 }, diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 5aada31..ae7b703 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -377,17 +377,19 @@ namespace oopsy { } #endif //OOPSY_TARGET_VERSIO + #if (MODE_COUNT > 1) if (menu_button_held_ms > OOPSY_LONG_PRESS_MS) { // LONG PRESS #ifndef OOPSY_TARGET_PETAL is_mode_selecting = 1; #endif } + #endif // Handle encoder increment actions: - if (is_mode_selecting) { + if (MODE_COUNT > 1 && is_mode_selecting) { mode += menu_button_incr; - if (mode >= MODE_COUNT) mode = 1; + if (mode >= MODE_COUNT) mode = 0; if (mode < 1) mode = MODE_COUNT-1; #ifdef OOPSY_MULTI_APP } else if (mode == MODE_MENU) { @@ -590,6 +592,8 @@ namespace oopsy { hardware.UpdateAnalogControls(); #endif + #if (MODE_COUNT > 1) + #ifdef OOPSY_TARGET_FIELD menu_button_held = hardware.GetSwitch(0)->Pressed(); menu_button_incr += hardware.GetSwitch(1)->FallingEdge(); @@ -606,6 +610,8 @@ namespace oopsy { menu_button_held_ms = hardware.encoder.TimeHeldMs(); if (hardware.encoder.FallingEdge()) menu_button_released = 1; #endif + + #endif //(MODE_COUNT > 1) } void audio_postperform(float **hardware_ins, float **hardware_outs, size_t size) { diff --git a/templates/daisy_patch.maxpat b/templates/daisy_patch.maxpat deleted file mode 100644 index 483daeb..0000000 --- a/templates/daisy_patch.maxpat +++ /dev/null @@ -1,301 +0,0 @@ -{ - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "box", - "rect" : [ 692.0, 240.0, 640.0, 480.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { - "box" : { - "args" : [ "field", "@target", "patch" ], - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-9", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "oopsy.maxpat", - "numinlets" : 1, - "numoutlets" : 0, - "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 293.5, 139.0, 128.0, 128.0 ], - "viewvisibility" : 1 - } - - } -, { - "box" : { - "id" : "obj-3", - "maxclass" : "newobj", - "numinlets" : 4, - "numoutlets" : 4, - "outlettype" : [ "signal", "signal", "signal", "signal" ], - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 5, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "dsp.gen", - "rect" : [ 84.0, 103.0, 600.0, 450.0 ], - "bglocked" : 0, - "openinpresentation" : 0, - "default_fontsize" : 12.0, - "default_fontface" : 0, - "default_fontname" : "Arial", - "gridonopen" : 1, - "gridsize" : [ 15.0, 15.0 ], - "gridsnaponopen" : 1, - "objectsnaponopen" : 1, - "statusbarvisible" : 2, - "toolbarvisible" : 1, - "lefttoolbarpinned" : 0, - "toptoolbarpinned" : 0, - "righttoolbarpinned" : 0, - "bottomtoolbarpinned" : 0, - "toolbars_unpinned_last_save" : 0, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, - "boxes" : [ { - "box" : { - "id" : "obj-12", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 213.5, 35.0, 150.0, 34.0 ], - "text" : "Parameters:\n" - } - - } -, { - "box" : { - "id" : "obj-11", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 23.5, 111.0, 150.0, 20.0 ], - "text" : "Audio IOs" - } - - } -, { - "box" : { - "id" : "obj-6", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 146.5, 146.0, 28.0, 22.0 ], - "text" : "in 4" - } - - } -, { - "box" : { - "id" : "obj-7", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 146.5, 215.0, 35.0, 22.0 ], - "text" : "out 4" - } - - } -, { - "box" : { - "id" : "obj-8", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 105.5, 146.0, 28.0, 22.0 ], - "text" : "in 3" - } - - } -, { - "box" : { - "id" : "obj-9", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 105.5, 215.0, 35.0, 22.0 ], - "text" : "out 3" - } - - } -, { - "box" : { - "id" : "obj-3", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 64.5, 146.0, 28.0, 22.0 ], - "text" : "in 2" - } - - } -, { - "box" : { - "id" : "obj-5", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 64.5, 215.0, 35.0, 22.0 ], - "text" : "out 2" - } - - } -, { - "box" : { - "id" : "obj-1", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 23.5, 146.0, 28.0, 22.0 ], - "text" : "in 1" - } - - } -, { - "box" : { - "id" : "obj-4", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 23.5, 215.0, 35.0, 22.0 ], - "text" : "out 1" - } - - } - ], - "lines" : [ { - "patchline" : { - "destination" : [ "obj-4", 0 ], - "source" : [ "obj-1", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-5", 0 ], - "source" : [ "obj-3", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-7", 0 ], - "source" : [ "obj-6", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-9", 0 ], - "source" : [ "obj-8", 0 ] - } - - } - ] - } -, - "patching_rect" : [ 81.0, 245.0, 36.0, 22.0 ], - "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", - "exportname" : "simplepatch" - } -, - "text" : "gen~", - "varname" : "simplepatch" - } - - } - ], - "lines" : [ ], - "parameters" : { - "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], - "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], - "parameterbanks" : { - - } -, - "inherited_shortname" : 1 - } -, - "dependency_cache" : [ { - "name" : "oopsy.maxpat", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", - "patcherrelativepath" : "../patchers", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "oopsy.snoop.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "oopsy.node4max.js", - "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", - "patcherrelativepath" : "../javascript", - "type" : "TEXT", - "implicit" : 1 - } - ], - "autosave" : 0 - } - -} From c15aa491abbfe866e1b740f430a02ae411b2b923 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Fri, 4 Dec 2020 14:41:32 -0500 Subject: [PATCH 34/58] modeselector fixxxx --- source/genlib_daisy.h | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index ae7b703..4e89b0e 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -377,20 +377,18 @@ namespace oopsy { } #endif //OOPSY_TARGET_VERSIO - #if (MODE_COUNT > 1) if (menu_button_held_ms > OOPSY_LONG_PRESS_MS) { // LONG PRESS #ifndef OOPSY_TARGET_PETAL is_mode_selecting = 1; #endif } - #endif - + // Handle encoder increment actions: - if (MODE_COUNT > 1 && is_mode_selecting) { + if (is_mode_selecting) { mode += menu_button_incr; if (mode >= MODE_COUNT) mode = 0; - if (mode < 1) mode = MODE_COUNT-1; + if (mode < 0) mode = MODE_COUNT-1; #ifdef OOPSY_MULTI_APP } else if (mode == MODE_MENU) { #ifdef OOPSY_TARGET_VERSIO @@ -592,26 +590,22 @@ namespace oopsy { hardware.UpdateAnalogControls(); #endif - #if (MODE_COUNT > 1) - #ifdef OOPSY_TARGET_FIELD menu_button_held = hardware.GetSwitch(0)->Pressed(); menu_button_incr += hardware.GetSwitch(1)->FallingEdge(); menu_button_held_ms = hardware.GetSwitch(0)->TimeHeldMs(); if (hardware.GetSwitch(0)->FallingEdge()) menu_button_released = 1; #elif OOPSY_TARGET_VERSIO - menu_button_held = hardware.tap_.Pressed(); - menu_button_incr += hardware.GetKnobValue(6) * app_count; - menu_button_held_ms = hardware.tap_.TimeHeldMs(); - if (hardware.tap_.FallingEdge()) menu_button_released = 1; + // menu_button_held = hardware.tap_.Pressed(); + // menu_button_incr += hardware.GetKnobValue(6) * app_count; + // menu_button_held_ms = hardware.tap_.TimeHeldMs(); + // if (hardware.tap_.FallingEdge()) menu_button_released = 1; #else menu_button_held = hardware.encoder.Pressed(); menu_button_incr += hardware.encoder.Increment(); menu_button_held_ms = hardware.encoder.TimeHeldMs(); if (hardware.encoder.FallingEdge()) menu_button_released = 1; #endif - - #endif //(MODE_COUNT > 1) } void audio_postperform(float **hardware_ins, float **hardware_outs, size_t size) { From 8491fbe4af918dd74e1af7d87a4e174f687c154f Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Fri, 4 Dec 2020 15:26:03 -0500 Subject: [PATCH 35/58] template patch for patch --- code/oopsy.suggestions.gendsp | 69 +++ source/genlib_daisy.h | 4 +- templates/oopsy_patch.maxpat | 1093 +++++++++++++++++++++++++++++++++ 3 files changed, 1163 insertions(+), 3 deletions(-) create mode 100644 code/oopsy.suggestions.gendsp create mode 100644 templates/oopsy_patch.maxpat diff --git a/code/oopsy.suggestions.gendsp b/code/oopsy.suggestions.gendsp new file mode 100644 index 0000000..aa79ffd --- /dev/null +++ b/code/oopsy.suggestions.gendsp @@ -0,0 +1,69 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 84.0, 103.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-32", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 168.5, 108.0, 22.0 ], + "text" : "oopsy.ctrl.smooth3" + } + + } +, { + "box" : { + "id" : "obj-22", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 50.0, 100.0, 404.0, 60.0 ], + "text" : "Note that CV/knob inputs update at block-rate, which is by default 1ms for Daisy. You may want to add some filtering or smoothing to CVs, depending on how they are being used in the patch. Similarly, output gates that are shorter than 1ms may be missed. " + } + + } + ], + "lines" : [ ] + } + +} diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 4e89b0e..5529e2d 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -548,9 +548,7 @@ namespace oopsy { #endif } #ifdef OOPSY_TARGET_HAS_OLED - #ifdef OOPSY_MULTI_APP - if (mode != MODE_MENU) - #endif //OOPSY_MULTI_APP + if (mode != MODE_NONE) { int offset = 0; #ifdef OOPSY_TARGET_USES_MIDI_UART diff --git a/templates/oopsy_patch.maxpat b/templates/oopsy_patch.maxpat new file mode 100644 index 0000000..45a8b1c --- /dev/null +++ b/templates/oopsy_patch.maxpat @@ -0,0 +1,1093 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 431.0, 199.0, 711.0, 513.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "fontname" : "Arial Italic", + "fontsize" : 18.0, + "id" : "obj-24", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 24.0, 22.0, 221.0, 27.0 ], + "text" : "Template for DaisyPatch" + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "toggle", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "int" ], + "parameter_enable" : 0, + "patching_rect" : [ 243.0, 365.0, 24.0, 24.0 ] + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "bang", "bang" ], + "patching_rect" : [ 243.0, 333.0, 42.0, 22.0 ], + "text" : "edge~" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 243.0, 391.0, 42.0, 20.0 ], + "text" : "gate" + } + + } +, { + "box" : { + "id" : "obj-18", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 183.0, 391.0, 42.0, 20.0 ], + "text" : "cv2" + } + + } +, { + "box" : { + "id" : "obj-17", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 122.0, 389.0, 42.0, 20.0 ], + "text" : "cv1" + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-14", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 183.0, 365.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-1", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 122.0, 365.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "ezdac~", + "numinlets" : 2, + "numoutlets" : 0, + "patching_rect" : [ 24.0, 425.0, 45.0, 45.0 ] + } + + } +, { + "box" : { + "id" : "obj-12", + "lastchannelcount" : 0, + "maxclass" : "live.gain~", + "numinlets" : 2, + "numoutlets" : 5, + "outlettype" : [ "signal", "signal", "", "float", "list" ], + "parameter_enable" : 1, + "patching_rect" : [ 73.0, 319.0, 44.0, 90.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_longname" : "live.gain~[1]", + "parameter_mmax" : 6.0, + "parameter_mmin" : -70.0, + "parameter_shortname" : "live.gain~", + "parameter_type" : 0, + "parameter_unitstyle" : 4 + } + + } +, + "varname" : "live.gain~[1]" + } + + } +, { + "box" : { + "id" : "obj-11", + "lastchannelcount" : 0, + "maxclass" : "live.gain~", + "numinlets" : 2, + "numoutlets" : 5, + "outlettype" : [ "signal", "signal", "", "float", "list" ], + "parameter_enable" : 1, + "patching_rect" : [ 24.0, 319.0, 44.0, 90.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_longname" : "live.gain~", + "parameter_mmax" : 6.0, + "parameter_mmin" : -70.0, + "parameter_shortname" : "live.gain~", + "parameter_type" : 0, + "parameter_unitstyle" : 4 + } + + } +, + "varname" : "live.gain~" + } + + } +, { + "box" : { + "attr" : "gate2", + "displaymode" : 8, + "id" : "obj-10", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 211.714285714285666, 150.0, 22.0 ] + } + + } +, { + "box" : { + "args" : [ "@loop", 1, "@file", "jongly.aif" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-7", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "demosound.maxpat", + "numinlets" : 0, + "numoutlets" : 1, + "offset" : [ 0.0, 0.0 ], + "outlettype" : [ "signal" ], + "patching_rect" : [ 24.0, 97.0, 225.0, 105.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "args" : [ "field", "@target", "patch" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 485.5, 97.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "fontsize" : 24.0, + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 5, + "numoutlets" : 8, + "outlettype" : [ "signal", "signal", "signal", "signal", "signal", "signal", "signal", "signal" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 84.0, 103.0, 1101.0, 556.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 369.5, 323.0, 36.5, 22.0 ], + "text" : "min" + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 308.5, 323.0, 38.0, 22.0 ], + "text" : "max" + } + + } +, { + "box" : { + "id" : "obj-18", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 511.5, 133.0, 29.5, 22.0 ], + "text" : "or" + } + + } +, { + "box" : { + "id" : "obj-39", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 911.5, 96.0, 107.0, 22.0 ], + "text" : "oopsy.suggestions" + } + + } +, { + "box" : { + "id" : "obj-38", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 9.5, 350.0, 69.0, 20.0 ], + "text" : "OUTPUTS" + } + + } +, { + "box" : { + "id" : "obj-37", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 9.5, 96.0, 69.0, 20.0 ], + "text" : "INPUTS" + } + + } +, { + "box" : { + "id" : "obj-36", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 727.0, 61.0, 139.0, 20.0 ], + "text" : "MIDI:" + } + + } +, { + "box" : { + "id" : "obj-34", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 511.5, 453.0, 201.0, 60.0 ], + "text" : "Gate will be low (0v) if the value here is equal to or less than zero, and high (5v) if the value here is greater than zero. " + } + + } +, { + "box" : { + "id" : "obj-33", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 511.5, 350.0, 69.0, 22.0 ], + "text" : "out 7 gate1" + } + + } +, { + "box" : { + "id" : "obj-31", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 308.5, 453.0, 189.0, 33.0 ], + "text" : "CV outputs clamp a 0..1 range to 0-5v on the Daisy hardware. " + } + + } +, { + "box" : { + "id" : "obj-29", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 369.5, 350.0, 57.0, 22.0 ], + "text" : "out 6 cv2" + } + + } +, { + "box" : { + "id" : "obj-28", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 308.5, 350.0, 57.0, 22.0 ], + "text" : "out 5 cv1" + } + + } +, { + "box" : { + "id" : "obj-27", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 511.5, 384.400900900363922, 201.0, 47.0 ], + "text" : "Gate inputs are similar to CVs, but the input is always either @min or @max, also 0 or 1 by default." + } + + } +, { + "box" : { + "id" : "obj-25", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 594.5, 96.0, 76.0, 22.0 ], + "text" : "param gate2" + } + + } +, { + "box" : { + "id" : "obj-26", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 511.5, 94.5, 76.0, 22.0 ], + "text" : "param gate1" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 727.0, 94.5, 53.0, 22.0 ], + "text" : "in 5 midi" + } + + } +, { + "box" : { + "id" : "obj-30", + "linecount" : 7, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 747.0, 155.5, 139.0, 100.0 ], + "text" : "\"midi\" input/output is converted to/from normalized byte streams. See the MIDI examples more info on how to read and write these. " + } + + } +, { + "box" : { + "id" : "obj-51", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 727.0, 350.0, 61.0, 22.0 ], + "text" : "out 8 midi" + } + + } +, { + "box" : { + "id" : "obj-17", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 308.5, 384.400900900363922, 189.0, 60.0 ], + "text" : "CV inputs of 0v to 5v will be mapped to the @min..@max range. @min @max are 0 and 1 by default." + } + + } +, { + "box" : { + "id" : "obj-16", + "linecount" : 3, + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 387.0, 171.0, 86.0, 49.0 ], + "text" : "param ctrl4 @min -10 @max 10" + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 369.5, 145.5, 69.0, 22.0 ], + "text" : "param ctrl3" + } + + } +, { + "box" : { + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 327.5, 119.900900900363922, 69.0, 22.0 ], + "text" : "param ctrl2" + } + + } +, { + "box" : { + "id" : "obj-13", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 407.211711704730988, 225.0, 74.288288295269012, 47.0 ], + "text" : "cv1, knob1, cv1_foo, etc. all work" + } + + } +, { + "box" : { + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 308.5, 96.0, 69.0, 22.0 ], + "text" : "param ctrl1" + } + + } +, { + "box" : { + "id" : "obj-12", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 308.5, 61.0, 150.0, 20.0 ], + "text" : "Knob/CV/Gate etc." + } + + } +, { + "box" : { + "id" : "obj-11", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 117.5, 61.0, 150.0, 20.0 ], + "text" : "Audio IOs" + } + + } +, { + "box" : { + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 240.5, 96.0, 28.0, 22.0 ], + "text" : "in 4" + } + + } +, { + "box" : { + "id" : "obj-7", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 240.5, 350.0, 35.0, 22.0 ], + "text" : "out 4" + } + + } +, { + "box" : { + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 199.5, 96.0, 28.0, 22.0 ], + "text" : "in 3" + } + + } +, { + "box" : { + "id" : "obj-9", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 199.5, 350.0, 35.0, 22.0 ], + "text" : "out 3" + } + + } +, { + "box" : { + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 158.5, 96.0, 28.0, 22.0 ], + "text" : "in 2" + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 158.5, 350.0, 35.0, 22.0 ], + "text" : "out 2" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 117.5, 96.0, 28.0, 22.0 ], + "text" : "in 1" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 117.5, 350.0, 35.0, 22.0 ], + "text" : "out 1" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-20", 1 ], + "source" : [ "obj-14", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-21", 0 ], + "source" : [ "obj-15", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-21", 1 ], + "source" : [ "obj-16", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-33", 0 ], + "source" : [ "obj-18", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-51", 0 ], + "source" : [ "obj-19", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-20", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-28", 0 ], + "source" : [ "obj-20", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-29", 0 ], + "source" : [ "obj-21", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-18", 1 ], + "source" : [ "obj-25", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-18", 0 ], + "source" : [ "obj-26", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-3", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-7", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-9", 0 ], + "source" : [ "obj-8", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 24.0, 267.0, 194.0, 35.0 ], + "saved_object_attributes" : { + "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportname" : "simplepatch" + } +, + "text" : "gen~", + "varname" : "simplepatch" + } + + } +, { + "box" : { + "attr" : "ctrl1", + "id" : "obj-2", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 97.0, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "ctrl2", + "id" : "obj-4", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 119.942857142857122, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "ctrl3", + "id" : "obj-5", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 142.885714285714272, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "ctrl4", + "id" : "obj-6", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 165.828571428571394, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "gate1", + "displaymode" : 8, + "id" : "obj-8", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 188.771428571428544, 150.0, 22.0 ] + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 1 ], + "source" : [ "obj-11", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-22", 0 ], + "source" : [ "obj-20", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-22", 0 ], + "source" : [ "obj-20", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-3", 4 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 1 ], + "source" : [ "obj-3", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 0 ], + "source" : [ "obj-3", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-12", 1 ], + "source" : [ "obj-3", 3 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-12", 0 ], + "source" : [ "obj-3", 2 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-14", 0 ], + "source" : [ "obj-3", 5 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-20", 0 ], + "source" : [ "obj-3", 6 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-4", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-7", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-8", 0 ] + } + + } + ], + "parameters" : { + "obj-11" : [ "live.gain~", "live.gain~", 0 ], + "obj-12" : [ "live.gain~[1]", "live.gain~", 0 ], + "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], + "obj-7::obj-35" : [ "[5]", "Level", 0 ], + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.suggestions.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.ctrl.smooth3.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "demosound.maxpat", + "bootpath" : "C74:/help/msp", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "sine.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "saw.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "square.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "random.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "interfacecolor.js", + "bootpath" : "C74:/interfaces", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} From 981a211c530dc5b37335fee6a794f42efe866339 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Fri, 4 Dec 2020 15:36:10 -0500 Subject: [PATCH 36/58] windows stdout filtering --- javascript/oopsy.node4max.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/javascript/oopsy.node4max.js b/javascript/oopsy.node4max.js index 53f9f3b..63521b1 100644 --- a/javascript/oopsy.node4max.js +++ b/javascript/oopsy.node4max.js @@ -27,14 +27,10 @@ process.stdout.write = (function() { const stdout_write = process.stdout.write; return function(str) { stdout_write.apply(process.stdout, arguments); - if (os.platform() == "win32") { - maxAPI.outlet(str) - } else { - let match - if (match = str.match(/^oopsy (.*)/i)) { - maxAPI.outlet(match[1]) - } - } + let match + if (match = str.match(/^oopsy (.*)/i)) { + maxAPI.outlet(match[1]) + } } })(); From 2d9c2c075e63b9ec6306442de1a15cb700a5f0af Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Fri, 4 Dec 2020 16:09:42 -0500 Subject: [PATCH 37/58] added daisy field template --- templates/oopsy_field.maxpat | 2186 ++++++++++++++++++++++++++++++++++ 1 file changed, 2186 insertions(+) create mode 100644 templates/oopsy_field.maxpat diff --git a/templates/oopsy_field.maxpat b/templates/oopsy_field.maxpat new file mode 100644 index 0000000..87770c1 --- /dev/null +++ b/templates/oopsy_field.maxpat @@ -0,0 +1,2186 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 890.0, 138.0, 756.0, 494.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "attr" : "keyB2", + "displaymode" : 8, + "id" : "obj-12", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 235.714285714285666, 150.0, 22.0 ] + } + + } +, { + "box" : { + "fontname" : "Arial Italic", + "fontsize" : 18.0, + "id" : "obj-24", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 24.0, 22.0, 221.0, 27.0 ], + "text" : "Template for DaisyField" + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "toggle", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "int" ], + "parameter_enable" : 0, + "patching_rect" : [ 215.0, 353.0, 24.0, 24.0 ] + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "bang", "bang" ], + "patching_rect" : [ 215.0, 321.0, 42.0, 22.0 ], + "text" : "edge~" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 215.0, 379.0, 42.0, 20.0 ], + "text" : "gate" + } + + } +, { + "box" : { + "id" : "obj-18", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 155.0, 379.0, 42.0, 20.0 ], + "text" : "cv2" + } + + } +, { + "box" : { + "id" : "obj-17", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 94.0, 377.0, 42.0, 20.0 ], + "text" : "cv1" + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-14", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 155.0, 353.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-1", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 94.0, 353.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "ezdac~", + "numinlets" : 2, + "numoutlets" : 0, + "patching_rect" : [ 24.0, 425.0, 45.0, 45.0 ] + } + + } +, { + "box" : { + "id" : "obj-11", + "lastchannelcount" : 0, + "maxclass" : "live.gain~", + "numinlets" : 2, + "numoutlets" : 5, + "outlettype" : [ "signal", "signal", "", "float", "list" ], + "parameter_enable" : 1, + "patching_rect" : [ 24.0, 319.0, 44.0, 90.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_longname" : "live.gain~", + "parameter_mmax" : 6.0, + "parameter_mmin" : -70.0, + "parameter_shortname" : "live.gain~", + "parameter_type" : 0, + "parameter_unitstyle" : 4 + } + + } +, + "varname" : "live.gain~" + } + + } +, { + "box" : { + "attr" : "keyA1", + "displaymode" : 8, + "id" : "obj-10", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 211.714285714285666, 150.0, 22.0 ] + } + + } +, { + "box" : { + "args" : [ "@loop", 1, "@file", "jongly.aif" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-7", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "demosound.maxpat", + "numinlets" : 0, + "numoutlets" : 1, + "offset" : [ 0.0, 0.0 ], + "outlettype" : [ "signal" ], + "patching_rect" : [ 24.0, 97.0, 225.0, 105.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "fontsize" : 24.0, + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 5, + "numoutlets" : 6, + "outlettype" : [ "signal", "signal", "signal", "signal", "signal", "signal" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 84.0, 103.0, 1095.0, 792.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-36", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 916.633333333333439, 34.0, 139.0, 20.0 ], + "text" : "MIDI:" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 916.633333333333439, 67.5, 53.0, 22.0 ], + "text" : "in 3 midi" + } + + } +, { + "box" : { + "id" : "obj-30", + "linecount" : 7, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 936.633333333333439, 128.5, 139.0, 100.0 ], + "text" : "\"midi\" input/output is converted to/from normalized byte streams. See the MIDI examples more info on how to read and write these. " + } + + } +, { + "box" : { + "id" : "obj-51", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 916.633333333333439, 323.0, 61.0, 22.0 ], + "text" : "out 6 midi" + } + + } +, { + "box" : { + "id" : "obj-88", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 913.133333333333326, 640.0, 79.0, 22.0 ], + "text" : "param keyB8" + } + + } +, { + "box" : { + "id" : "obj-89", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 926.800000000000182, 671.0, 22.0, 22.0 ], + "text" : "15" + } + + } +, { + "box" : { + "id" : "obj-90", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 913.133333333333439, 696.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-91", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 830.990476190476215, 640.0, 79.0, 22.0 ], + "text" : "param keyB7" + } + + } +, { + "box" : { + "id" : "obj-92", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 843.800000000000068, 671.0, 22.0, 22.0 ], + "text" : "14" + } + + } +, { + "box" : { + "id" : "obj-93", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 830.133333333333439, 696.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-94", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 748.847619047619105, 640.0, 79.0, 22.0 ], + "text" : "param keyB6" + } + + } +, { + "box" : { + "id" : "obj-95", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 762.800000000000182, 671.0, 22.0, 22.0 ], + "text" : "13" + } + + } +, { + "box" : { + "id" : "obj-96", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 748.133333333333553, 696.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-97", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 666.704761904761995, 640.0, 79.0, 22.0 ], + "text" : "param keyB5" + } + + } +, { + "box" : { + "id" : "obj-98", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 679.800000000000068, 671.0, 22.0, 22.0 ], + "text" : "12" + } + + } +, { + "box" : { + "id" : "obj-99", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 666.133333333333439, 696.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-100", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 584.561904761904884, 640.0, 79.0, 22.0 ], + "text" : "param keyB4" + } + + } +, { + "box" : { + "id" : "obj-101", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 598.800000000000182, 671.0, 21.0, 22.0 ], + "text" : "11" + } + + } +, { + "box" : { + "id" : "obj-102", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 584.561904761904884, 696.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-103", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 502.419047619047774, 640.0, 79.0, 22.0 ], + "text" : "param keyB3" + } + + } +, { + "box" : { + "id" : "obj-104", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 515.800000000000068, 671.0, 22.0, 22.0 ], + "text" : "10" + } + + } +, { + "box" : { + "id" : "obj-105", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 502.133333333333439, 696.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-106", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 420.276190476190607, 640.0, 79.0, 22.0 ], + "text" : "param keyB2" + } + + } +, { + "box" : { + "id" : "obj-107", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 434.800000000000182, 671.0, 19.0, 22.0 ], + "text" : "9" + } + + } +, { + "box" : { + "id" : "obj-108", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 421.133333333333553, 696.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-109", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 338.133333333333439, 640.0, 79.0, 22.0 ], + "text" : "param keyB1" + } + + } +, { + "box" : { + "id" : "obj-110", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 351.800000000000068, 671.0, 19.0, 22.0 ], + "text" : "8" + } + + } +, { + "box" : { + "id" : "obj-111", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 338.133333333333439, 696.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-76", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 913.133333333333326, 553.0, 79.0, 22.0 ], + "text" : "param keyA8" + } + + } +, { + "box" : { + "id" : "obj-77", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 926.800000000000182, 584.0, 19.0, 22.0 ], + "text" : "7" + } + + } +, { + "box" : { + "id" : "obj-78", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 913.133333333333439, 609.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-79", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 830.990476190476215, 553.0, 79.0, 22.0 ], + "text" : "param keyA7" + } + + } +, { + "box" : { + "id" : "obj-80", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 843.800000000000068, 584.0, 19.0, 22.0 ], + "text" : "6" + } + + } +, { + "box" : { + "id" : "obj-81", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 830.133333333333439, 609.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-82", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 748.847619047619105, 553.0, 79.0, 22.0 ], + "text" : "param keyA6" + } + + } +, { + "box" : { + "id" : "obj-83", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 762.800000000000182, 584.0, 19.0, 22.0 ], + "text" : "5" + } + + } +, { + "box" : { + "id" : "obj-84", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 748.133333333333553, 609.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-85", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 666.704761904761995, 553.0, 79.0, 22.0 ], + "text" : "param keyA5" + } + + } +, { + "box" : { + "id" : "obj-86", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 679.800000000000068, 584.0, 19.0, 22.0 ], + "text" : "4" + } + + } +, { + "box" : { + "id" : "obj-87", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 666.133333333333439, 609.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-70", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 584.561904761904884, 553.0, 79.0, 22.0 ], + "text" : "param keyA4" + } + + } +, { + "box" : { + "id" : "obj-71", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 598.800000000000182, 584.0, 19.0, 22.0 ], + "text" : "3" + } + + } +, { + "box" : { + "id" : "obj-72", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 584.561904761904884, 609.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-73", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 502.419047619047774, 553.0, 79.0, 22.0 ], + "text" : "param keyA3" + } + + } +, { + "box" : { + "id" : "obj-74", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 515.800000000000068, 584.0, 19.0, 22.0 ], + "text" : "2" + } + + } +, { + "box" : { + "id" : "obj-75", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 502.133333333333439, 609.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-67", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 420.276190476190607, 553.0, 79.0, 22.0 ], + "text" : "param keyA2" + } + + } +, { + "box" : { + "id" : "obj-68", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 434.800000000000182, 584.0, 19.0, 22.0 ], + "text" : "1" + } + + } +, { + "box" : { + "id" : "obj-69", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 421.133333333333553, 609.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-66", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 338.133333333333439, 553.0, 79.0, 22.0 ], + "text" : "param keyA1" + } + + } +, { + "box" : { + "id" : "obj-64", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 351.800000000000068, 584.0, 19.0, 22.0 ], + "text" : "0" + } + + } +, { + "box" : { + "id" : "obj-65", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 338.133333333333439, 609.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-63", + "linecount" : 6, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 42.5, 553.0, 256.0, 87.0 ], + "text" : "Use a [data leds 24] to address the LEDs on Field, since there are so many of them. \n\nLEDS 0-7 correspond to buttons A1-8\nLEDS 8-15 correspond to buttons B1-8\nLEDS 16-23 correspond to knobs 1-8" + } + + } +, { + "box" : { + "id" : "obj-54", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 408.633333333333439, 295.0, 22.0, 22.0 ], + "text" : "23" + } + + } +, { + "box" : { + "id" : "obj-55", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 394.966666666666697, 320.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-56", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 392.900000000000091, 345.0, 22.0, 22.0 ], + "text" : "22" + } + + } +, { + "box" : { + "id" : "obj-57", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 379.233333333333462, 370.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-58", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 377.033333333333417, 395.0, 22.0, 22.0 ], + "text" : "21" + } + + } +, { + "box" : { + "id" : "obj-59", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 363.366666666666731, 420.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-60", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 361.300000000000125, 446.0, 22.0, 22.0 ], + "text" : "20" + } + + } +, { + "box" : { + "id" : "obj-61", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 347.633333333333439, 471.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-49", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 272.56666666666672, 295.0, 22.0, 22.0 ], + "text" : "19" + } + + } +, { + "box" : { + "id" : "obj-50", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 258.899999999999977, 320.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-52", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 256.833333333333371, 345.0, 22.0, 22.0 ], + "text" : "18" + } + + } +, { + "box" : { + "id" : "obj-53", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 243.166666666666714, 370.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-47", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 240.966666666666697, 395.0, 22.0, 22.0 ], + "text" : "17" + } + + } +, { + "box" : { + "id" : "obj-48", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 227.300000000000011, 420.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-46", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 225.233333333333377, 446.0, 22.0, 22.0 ], + "text" : "16" + } + + } +, { + "box" : { + "id" : "obj-45", + "maxclass" : "newobj", + "numinlets" : 4, + "numoutlets" : 0, + "patching_rect" : [ 211.56666666666672, 471.0, 60.0, 22.0 ], + "text" : "poke leds" + } + + } +, { + "box" : { + "id" : "obj-44", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 42.5, 522.0, 74.0, 22.0 ], + "text" : "data leds 24" + } + + } +, { + "box" : { + "id" : "obj-40", + "linecount" : 3, + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 394.899999999999977, 154.0, 80.0, 49.0 ], + "text" : "param knob8 @min 0 @max 1" + } + + } +, { + "box" : { + "id" : "obj-41", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 379.100000000000023, 124.599099099636078, 79.0, 22.0 ], + "text" : "param knob7" + } + + } +, { + "box" : { + "id" : "obj-42", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 363.300000000000011, 96.0, 79.0, 22.0 ], + "text" : "param knob6" + } + + } +, { + "box" : { + "id" : "obj-43", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 347.5, 69.0, 79.0, 22.0 ], + "text" : "param knob5" + } + + } +, { + "box" : { + "id" : "obj-10", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 258.899999999999977, 154.0, 79.0, 22.0 ], + "text" : "param knob4" + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 243.099999999999994, 124.599099099636078, 79.0, 22.0 ], + "text" : "param knob3" + } + + } +, { + "box" : { + "id" : "obj-23", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 227.300000000000011, 96.0, 79.0, 22.0 ], + "text" : "param knob2" + } + + } +, { + "box" : { + "id" : "obj-24", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 272.56666666666672, 185.0, 74.288288295269012, 47.0 ], + "presentation_linecount" : 3, + "text" : "knob1_foo etc also works" + } + + } +, { + "box" : { + "id" : "obj-32", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 211.5, 69.0, 79.0, 22.0 ], + "text" : "param knob1" + } + + } +, { + "box" : { + "id" : "obj-35", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 211.5, 34.0, 150.0, 20.0 ], + "text" : "Knobs" + } + + } +, { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 570.5, 296.0, 36.5, 22.0 ], + "text" : "min" + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 509.5, 296.0, 38.0, 22.0 ], + "text" : "max" + } + + } +, { + "box" : { + "id" : "obj-39", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 42.5, 667.0, 107.0, 22.0 ], + "text" : "oopsy.suggestions" + } + + } +, { + "box" : { + "id" : "obj-38", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 7.5, 323.0, 69.0, 20.0 ], + "text" : "OUTPUTS" + } + + } +, { + "box" : { + "id" : "obj-37", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 7.5, 69.0, 69.0, 20.0 ], + "text" : "INPUTS" + } + + } +, { + "box" : { + "id" : "obj-34", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 702.5, 426.0, 201.0, 60.0 ], + "text" : "Gate will be low (0v) if the value here is equal to or less than zero, and high (5v) if the value here is greater than zero. " + } + + } +, { + "box" : { + "id" : "obj-33", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 702.5, 323.0, 69.0, 22.0 ], + "text" : "out 5 gate1" + } + + } +, { + "box" : { + "id" : "obj-31", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 509.5, 426.0, 189.0, 33.0 ], + "text" : "CV outputs clamp a 0..1 range to 0-5v on the Daisy hardware. " + } + + } +, { + "box" : { + "id" : "obj-29", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 570.5, 323.0, 57.0, 22.0 ], + "text" : "out 4 cv2" + } + + } +, { + "box" : { + "id" : "obj-28", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 509.5, 323.0, 57.0, 22.0 ], + "text" : "out 3 cv1" + } + + } +, { + "box" : { + "id" : "obj-27", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 702.5, 357.400900900363922, 201.0, 47.0 ], + "text" : "Gate inputs are similar to CVs, but the input is always either @min or @max, also 0 or 1 by default." + } + + } +, { + "box" : { + "id" : "obj-26", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 702.5, 67.5, 76.0, 22.0 ], + "text" : "param gate1" + } + + } +, { + "box" : { + "id" : "obj-17", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 509.5, 357.400900900363922, 189.0, 60.0 ], + "text" : "CV inputs of 0v to 5v will be mapped to the @min..@max range. @min @max are 0 and 1 by default." + } + + } +, { + "box" : { + "id" : "obj-16", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 588.0, 144.0, 65.0, 22.0 ], + "text" : "param cv4" + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 570.5, 118.5, 65.0, 22.0 ], + "text" : "param cv3" + } + + } +, { + "box" : { + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 528.5, 92.900900900363922, 65.0, 22.0 ], + "text" : "param cv2" + } + + } +, { + "box" : { + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 509.5, 69.0, 65.0, 22.0 ], + "text" : "param cv1" + } + + } +, { + "box" : { + "id" : "obj-12", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 509.5, 34.0, 150.0, 20.0 ], + "text" : "CV/Gate etc." + } + + } +, { + "box" : { + "id" : "obj-11", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 115.5, 34.0, 69.0, 20.0 ], + "text" : "Audio IOs" + } + + } +, { + "box" : { + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 156.5, 69.0, 28.0, 22.0 ], + "text" : "in 2" + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 156.5, 323.0, 35.0, 22.0 ], + "text" : "out 2" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 115.5, 69.0, 28.0, 22.0 ], + "text" : "in 1" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 115.5, 323.0, 35.0, 22.0 ], + "text" : "out 1" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-50", 0 ], + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-102", 0 ], + "source" : [ "obj-100", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-102", 1 ], + "source" : [ "obj-101", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-105", 0 ], + "source" : [ "obj-103", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-105", 1 ], + "source" : [ "obj-104", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-108", 0 ], + "source" : [ "obj-106", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-108", 1 ], + "source" : [ "obj-107", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-111", 0 ], + "source" : [ "obj-109", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-111", 1 ], + "source" : [ "obj-110", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-20", 1 ], + "source" : [ "obj-14", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-21", 0 ], + "source" : [ "obj-15", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-21", 1 ], + "source" : [ "obj-16", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-51", 0 ], + "source" : [ "obj-19", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-20", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-28", 0 ], + "source" : [ "obj-20", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-29", 0 ], + "source" : [ "obj-21", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-53", 0 ], + "source" : [ "obj-22", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-48", 0 ], + "source" : [ "obj-23", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-33", 0 ], + "source" : [ "obj-26", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-3", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-45", 0 ], + "source" : [ "obj-32", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-55", 0 ], + "source" : [ "obj-40", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-57", 0 ], + "source" : [ "obj-41", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-59", 0 ], + "source" : [ "obj-42", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-61", 0 ], + "source" : [ "obj-43", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-45", 1 ], + "source" : [ "obj-46", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-48", 1 ], + "source" : [ "obj-47", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-50", 1 ], + "source" : [ "obj-49", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-53", 1 ], + "source" : [ "obj-52", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-55", 1 ], + "source" : [ "obj-54", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-57", 1 ], + "source" : [ "obj-56", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-59", 1 ], + "source" : [ "obj-58", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-61", 1 ], + "source" : [ "obj-60", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-65", 1 ], + "source" : [ "obj-64", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-65", 0 ], + "source" : [ "obj-66", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-69", 0 ], + "source" : [ "obj-67", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-69", 1 ], + "source" : [ "obj-68", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-72", 0 ], + "source" : [ "obj-70", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-72", 1 ], + "source" : [ "obj-71", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-75", 0 ], + "source" : [ "obj-73", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-75", 1 ], + "source" : [ "obj-74", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-78", 0 ], + "source" : [ "obj-76", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-78", 1 ], + "source" : [ "obj-77", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-81", 0 ], + "source" : [ "obj-79", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-81", 1 ], + "source" : [ "obj-80", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-84", 0 ], + "source" : [ "obj-82", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-84", 1 ], + "source" : [ "obj-83", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-87", 0 ], + "source" : [ "obj-85", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-87", 1 ], + "source" : [ "obj-86", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-90", 0 ], + "source" : [ "obj-88", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-90", 1 ], + "source" : [ "obj-89", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-93", 0 ], + "source" : [ "obj-91", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-93", 1 ], + "source" : [ "obj-92", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-96", 0 ], + "source" : [ "obj-94", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-96", 1 ], + "source" : [ "obj-95", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-99", 0 ], + "source" : [ "obj-97", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-99", 1 ], + "source" : [ "obj-98", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 24.0, 267.0, 194.0, 35.0 ], + "saved_object_attributes" : { + "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportname" : "simplepatch" + } +, + "text" : "gen~", + "varname" : "simplepatch" + } + + } +, { + "box" : { + "attr" : "cv1", + "id" : "obj-2", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 97.0, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "cv2", + "id" : "obj-4", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 119.942857142857122, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "gate1", + "id" : "obj-5", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 142.885714285714272, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "knob1", + "id" : "obj-6", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 165.828571428571394, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "knob2", + "displaymode" : 8, + "id" : "obj-8", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 269.0, 188.771428571428544, 150.0, 22.0 ] + } + + } +, { + "box" : { + "args" : [ "@target", "field" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 568.5, 87.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 1 ], + "source" : [ "obj-11", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-12", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-22", 0 ], + "source" : [ "obj-20", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-22", 0 ], + "source" : [ "obj-20", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-3", 2 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 1 ], + "source" : [ "obj-3", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 0 ], + "source" : [ "obj-3", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-14", 0 ], + "source" : [ "obj-3", 3 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-20", 0 ], + "source" : [ "obj-3", 4 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-4", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-7", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-8", 0 ] + } + + } + ], + "parameters" : { + "obj-11" : [ "live.gain~", "live.gain~", 0 ], + "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], + "obj-7::obj-35" : [ "[5]", "Level", 0 ], + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.suggestions.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.ctrl.smooth3.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "demosound.maxpat", + "bootpath" : "C74:/help/msp", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "sine.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "saw.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "square.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "random.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "interfacecolor.js", + "bootpath" : "C74:/interfaces", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} From 3d7fd584d1ba9d051ac0a4d5822412eb77467e6d Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Fri, 4 Dec 2020 18:01:24 -0500 Subject: [PATCH 38/58] oopsy abstractions for dealing with smoothing knob/CV inputs and for ensuring very short gates can make it out --- code/oopsy.ctrl.smooth2.gendsp | 269 +++++++++++++++++++++++++++++++++ code/oopsy.ctrl.smooth3.gendsp | 9 +- code/oopsy.gate.min.gendsp | 241 +++++++++++++++++++++++++++++ code/oopsy.suggestions.gendsp | 43 +++++- source/daisy.patch.json | 4 +- source/genlib_daisy.h | 26 +++- source/oopsy.js | 28 +++- templates/oopsy_field.maxpat | 78 +++++++--- templates/oopsy_patch.maxpat | 7 + 9 files changed, 666 insertions(+), 39 deletions(-) create mode 100644 code/oopsy.ctrl.smooth2.gendsp create mode 100644 code/oopsy.gate.min.gendsp diff --git a/code/oopsy.ctrl.smooth2.gendsp b/code/oopsy.ctrl.smooth2.gendsp new file mode 100644 index 0000000..e26e7f3 --- /dev/null +++ b/code/oopsy.ctrl.smooth2.gendsp @@ -0,0 +1,269 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 84.0, 103.0, 466.0, 288.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-15", + "linecount" : 8, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 254.0, 61.0, 150.0, 114.0 ], + "text" : "A 2-pole lowpass filter at 10Hz seems to effectively silence noise from hardware input ADCs.\n\nBut a 10Hz filter might be too slow to respond, if so, try the smooth3 option." + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 118.0, 193.0, 46.0, 23.0 ], + "text" : "mix" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-9", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 118.0, 153.0, 45.0, 23.0 ], + "text" : "history" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 118.0, 239.0, 37.0, 23.0 ], + "text" : "out 1" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 44.0, 193.0, 46.0, 23.0 ], + "text" : "mix" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-10", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 127.5, 53.0, 109.0, 23.0 ], + "text" : "* twopi/samplerate" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 44.0, 153.0, 45.0, 23.0 ], + "text" : "history" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 127.5, 84.0, 26.0, 23.0 ], + "text" : "sin" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 57.5, 84.0, 28.0, 23.0 ], + "text" : "in 1" + } + + } +, { + "box" : { + "fontname" : "Lato", + "fontsize" : 12.0, + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 127.5, 23.0, 22.0, 23.0 ], + "text" : "10" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-6", 1 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-6", 0 ], + "source" : [ "obj-14", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-10", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-6", 2 ], + "midpoints" : [ 137.0, 121.5, 80.5, 121.5 ], + "order" : 1, + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-8", 2 ], + "midpoints" : [ 137.0, 122.5, 154.5, 122.5 ], + "order" : 0, + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-14", 0 ], + "midpoints" : [ 53.5, 222.0, 31.5, 222.0, 31.5, 141.0, 53.5, 141.0 ], + "order" : 1, + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-8", 1 ], + "order" : 0, + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "order" : 0, + "source" : [ "obj-8", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-9", 0 ], + "midpoints" : [ 127.5, 222.0, 105.5, 222.0, 105.5, 141.0, 127.5, 141.0 ], + "order" : 1, + "source" : [ "obj-8", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-8", 0 ], + "source" : [ "obj-9", 0 ] + } + + } + ] + } + +} diff --git a/code/oopsy.ctrl.smooth3.gendsp b/code/oopsy.ctrl.smooth3.gendsp index a4c9913..9cb3de8 100644 --- a/code/oopsy.ctrl.smooth3.gendsp +++ b/code/oopsy.ctrl.smooth3.gendsp @@ -4,7 +4,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 5, + "revision" : 8, "architecture" : "x64", "modernui" : 1 } @@ -198,8 +198,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 127.5, 23.0, 83.0, 23.0 ], - "text" : "param freq 30" + "patching_rect" : [ 127.5, 23.0, 22.0, 23.0 ], + "text" : "30" } } @@ -324,7 +324,8 @@ } } - ] + ], + "autosave" : 0 } } diff --git a/code/oopsy.gate.min.gendsp b/code/oopsy.gate.min.gendsp new file mode 100644 index 0000000..89913c2 --- /dev/null +++ b/code/oopsy.gate.min.gendsp @@ -0,0 +1,241 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 84.0, 103.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-2", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 141.25, 287.0, 196.0, 33.0 ], + "presentation_linecount" : 2, + "text" : "On Daisy with the default blockrate of 1kHz this implies 1ms." + } + + } +, { + "box" : { + "id" : "obj-1", + "linecount" : 10, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 376.25, 130.0, 229.0, 141.0 ], + "presentation_linecount" : 10, + "text" : "This subpatcher will extend any short click or gate (positive non-zero values) at least one signal vector's worth.\n\nThis may be necessary to ensure that any very short gates are not 'missed' by the GPIO output handling of the hardware (or indeed by any other hardware unable to register very short gates). " + } + + } +, { + "box" : { + "id" : "obj-41", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 141.25, 245.0, 196.0, 33.0 ], + "text" : "keep gate high until one control vector has passed." + } + + } +, { + "box" : { + "id" : "obj-40", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 108.25, 195.0, 229.0, 20.0 ], + "text" : "Reset sample counter on rising edge" + } + + } +, { + "box" : { + "id" : "obj-37", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 108.25, 133.5, 229.0, 20.0 ], + "text" : "Detect rising edge" + } + + } +, { + "box" : { + "id" : "obj-36", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 108.25, 102.0, 229.0, 20.0 ], + "text" : "Basic daisy gate logic (gate high if > 0)" + } + + } +, { + "box" : { + "id" : "obj-34", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.25, 245.0, 80.0, 22.0 ], + "text" : "<= vectorsize" + } + + } +, { + "box" : { + "id" : "obj-32", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 195.0, 33.0, 22.0 ], + "text" : "+= 1" + } + + } +, { + "box" : { + "id" : "obj-31", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 160.5, 26.0, 22.0 ], + "text" : "> 0" + } + + } +, { + "box" : { + "id" : "obj-30", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 133.5, 48.0, 22.0 ], + "text" : "change" + } + + } +, { + "box" : { + "id" : "obj-27", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 100.0, 26.0, 22.0 ], + "text" : "> 0" + } + + } +, { + "box" : { + "id" : "obj-43", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 40.0, 28.0, 22.0 ], + "text" : "in 1" + } + + } +, { + "box" : { + "id" : "obj-44", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 50.25, 338.0, 35.0, 22.0 ], + "text" : "out 1" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-30", 0 ], + "source" : [ "obj-27", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-31", 0 ], + "source" : [ "obj-30", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-32", 0 ], + "source" : [ "obj-31", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-34", 0 ], + "source" : [ "obj-32", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-44", 0 ], + "source" : [ "obj-34", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-27", 0 ], + "source" : [ "obj-43", 0 ] + } + + } + ] + } + +} diff --git a/code/oopsy.suggestions.gendsp b/code/oopsy.suggestions.gendsp index aa79ffd..ed1bcef 100644 --- a/code/oopsy.suggestions.gendsp +++ b/code/oopsy.suggestions.gendsp @@ -40,15 +40,52 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-32", + "id" : "obj-3", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 50.0, 235.0, 404.0, 60.0 ], + "presentation_linecount" : 4, + "text" : "Similarly, output gates that are shorter than 1ms may be missed, because of control-rate sampling. This subpatcher ensures even a single-sample click will be extended to the minimum gate duration for the hardware (1ms by default):" + } + + } +, { + "box" : { + "id" : "obj-2", "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 50.0, 168.5, 108.0, 22.0 ], + "patching_rect" : [ 50.0, 297.0, 89.0, 22.0 ], + "text" : "oopsy.gate.min" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 170.0, 166.5, 108.0, 22.0 ], "text" : "oopsy.ctrl.smooth3" } + } +, { + "box" : { + "id" : "obj-32", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 166.5, 108.0, 22.0 ], + "text" : "oopsy.ctrl.smooth2" + } + } , { "box" : { @@ -58,7 +95,7 @@ "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 50.0, 100.0, 404.0, 60.0 ], - "text" : "Note that CV/knob inputs update at block-rate, which is by default 1ms for Daisy. You may want to add some filtering or smoothing to CVs, depending on how they are being used in the patch. Similarly, output gates that are shorter than 1ms may be missed. " + "text" : "Note that CV/knob inputs update at block-rate, which is by default 1ms for Daisy. You may want to add some filtering or smoothing to CVs, depending on how they are being used in the patch. Here are some options:" } } diff --git a/source/daisy.patch.json b/source/daisy.patch.json index 3c18016..95d0d0e 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -41,7 +41,9 @@ }, "setters": { "dsy_cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", - "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)", + "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)" + }, + "setters_audio": { "dsy_gate_out1": "dsy_gpio_write(&hardware.gate_output, $ > 0.f)" }, "mainhandlers": {}, diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 5529e2d..39efbec 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -229,6 +229,7 @@ namespace oopsy { size_t blocksize; // default 48 void (*mainloopCallback)(uint32_t t, uint32_t dt); + void (*displayCallback)(uint32_t t, uint32_t dt); void * app = nullptr; void * gen = nullptr; bool nullAudioCallbackRunning = false; @@ -266,6 +267,7 @@ namespace oopsy { void reset(A& newapp) { // first, remove callbacks: mainloopCallback = nullMainloopCallback; + displayCallback = nullMainloopCallback; nullAudioCallbackRunning = false; hardware.ChangeAudioCallback(nullAudioCallback); while (!nullAudioCallbackRunning) dsy_system_delay(10); @@ -276,6 +278,7 @@ namespace oopsy { newapp.init(*this); // install new callbacks: mainloopCallback = newapp.staticMainloopCallback; + displayCallback = newapp.staticDisplayCallback; hardware.ChangeAudioCallback(newapp.staticAudioCallback); log("loaded gen~ %s", appdefs[app_selected].name); log("%d/%dK+%d/%dM", oopsy::sram_used/1024, OOPSY_SRAM_SIZE/1024, oopsy::sdram_used/1048576, OOPSY_SDRAM_SIZE/1048576); @@ -306,6 +309,7 @@ namespace oopsy { hardware.StartAdc(); hardware.StartAudio(nullAudioCallback); mainloopCallback = nullMainloopCallback; + displayCallback = nullMainloopCallback; #ifdef OOPSY_TARGET_USES_MIDI_UART midi.init(); @@ -324,6 +328,9 @@ namespace oopsy { dt = t1-t; t = t1; + // handle app-level code (e.g. for CV/gate outs) + mainloopCallback(t, dt); + if (uitimer.ready(dt)) { #ifdef OOPSY_TARGET_USES_MIDI_UART @@ -337,10 +344,7 @@ namespace oopsy { #ifdef OOPSY_TARGET_PETAL hardware.ClearLeds(); #endif - - // handle app-level code (e.g. for LED/CV/gate outs) - mainloopCallback(t, dt); - + #ifdef OOPSY_TARGET_PETAL // has no mode selection is_mode_selecting = 0; @@ -552,7 +556,7 @@ namespace oopsy { { int offset = 0; #ifdef OOPSY_TARGET_USES_MIDI_UART - offset += snprintf(console_stats+offset, console_cols-offset, "%cM%c ", midi.in_active ? '<' : ' ', midi.out_active ? '>' : ' '); + offset += snprintf(console_stats+offset, console_cols-offset, "%c%c", midi.in_active ? '<' : ' ', midi.out_active ? '>' : ' '); midi.in_active = midi.out_active = 0; #endif offset += snprintf(console_stats+offset, console_cols-offset, "%02d%%", int(0.0001f*audioCpuUs*(samplerate)/blocksize)); @@ -560,9 +564,14 @@ namespace oopsy { hardware.display.SetCursor(SSD1309_WIDTH - (offset) * font.FontWidth, font.FontHeight * 0); hardware.display.WriteString(console_stats, font, true); } - hardware.display.Update(); #endif //OOPSY_TARGET_HAS_OLED + + // handle app-level code (e.g. for LED etc.) + displayCallback(t, dt); + #ifdef OOPSY_TARGET_HAS_OLED + hardware.display.Update(); + #endif //OOPSY_TARGET_HAS_OLED #if (OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) hardware.UpdateLeds(); #endif //(OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) @@ -701,6 +710,11 @@ namespace oopsy { self.mainloopCallback(daisy, t, dt); } + static void staticDisplayCallback(uint32_t t, uint32_t dt) { + T& self = *(T *)daisy.app; + self.displayCallback(daisy, t, dt); + } + static void staticAudioCallback(float **hardware_ins, float **hardware_outs, size_t size) { uint32_t start = dsy_tim_get_tick(); // 200MHz daisy.audio_preperform(size); diff --git a/source/oopsy.js b/source/oopsy.js index 5d9d7d1..bacf370 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -375,6 +375,15 @@ function generate_daisy(hardware, nodes, target) { return name; }), + gpio_outs_audio: Object.keys(hardware.setters_audio).map(name => { + nodes[name] = { + name: name, + setter: hardware.setters_audio[name], + from: [], + } + return name; + }), + // DEVICE OUTPUTS: mainhandlers: Object.keys(hardware.mainhandlers).map(name => { nodes[name] = { @@ -571,7 +580,7 @@ function generate_app(app, hardware, target) { let i=0 daisy.gpio_outs.forEach(name => { const node = nodes[name]; - // does this output have an audio source? + // does this output have an cv source? if (node.from.length) { available.push(name); } else if (available.length) { @@ -586,6 +595,7 @@ struct App_${name} : public oopsy::App { ${gen.params .filter(name => nodes[name].src) .concat(daisy.gpio_outs) + .concat(daisy.gpio_outs_audio) .map(name=>` float ${name};`).join("")} ${app.audio_outs.map(name=>` @@ -596,18 +606,23 @@ struct App_${name} : public oopsy::App { ${gen.params .filter(name => nodes[name].src) .concat(daisy.gpio_outs) + .concat(daisy.gpio_outs_audio) .map(name=>` ${name} = 0.f;`).join("")} } void mainloopCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { - // whatever handling is needed here Daisy& hardware = daisy.hardware; ${name}::State& gen = *(${name}::State *)daisy.gen; ${daisy.gpio_outs .filter(name => nodes[name].src || nodes[name].from.length) .map((name, i)=>` ${interpolate(nodes[name].setter, nodes[name])};`).join("")} + } + + void displayCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { + Daisy& hardware = daisy.hardware; + ${name}::State& gen = *(${name}::State *)daisy.gen; ${daisy.mainhandlers .filter(name => nodes[name].data) .map(name =>` @@ -641,6 +656,15 @@ struct App_${name} : public oopsy::App { .map(name => nodes[name].src ? ` ${name} = ${nodes[name].src};` : ` ${name} = ${nodes[name].from.map(name=>name+"[size-1]").join(" + ")};`).join("")} + ${daisy.gpio_outs_audio + .filter(name => nodes[name].src || nodes[name].from.length > 0) + .map(name => nodes[name].src ? ` + ${name} = ${nodes[name].src};` : ` + ${name} = ${nodes[name].from.map(name=>name+"[size-1]").join(" + ")};`).join("")} + ${daisy.gpio_outs_audio + .filter(name => nodes[name].src || nodes[name].from.length) + .map((name, i)=>` + ${interpolate(nodes[name].setter, nodes[name])};`).join("")} ${app.has_midi_out ? daisy.midi_outs.map(name=>nodes[name].from.map(name=>` oopsy::midi.postperform(${name}, size);`).join("")).join("") : ''} } diff --git a/templates/oopsy_field.maxpat b/templates/oopsy_field.maxpat index 87770c1..7e5973d 100644 --- a/templates/oopsy_field.maxpat +++ b/templates/oopsy_field.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 890.0, 138.0, 756.0, 494.0 ], + "rect" : [ 890.0, 138.0, 756.0, 523.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -39,6 +39,39 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-23", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 279.0, 127.942857142857122, 48.0, 20.0 ], + "text" : "etc." + } + + } +, { + "box" : { + "id" : "obj-21", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 279.0, 198.771428571428544, 48.0, 20.0 ], + "text" : "etc." + } + + } +, { + "box" : { + "id" : "obj-16", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 279.0, 270.714285714285666, 48.0, 20.0 ], + "text" : "etc." + } + + } +, { "box" : { "attr" : "keyB2", "displaymode" : 8, @@ -47,7 +80,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 269.0, 235.714285714285666, 150.0, 22.0 ] + "patching_rect" : [ 269.0, 246.714285714285666, 150.0, 22.0 ] } } @@ -72,7 +105,7 @@ "numoutlets" : 1, "outlettype" : [ "int" ], "parameter_enable" : 0, - "patching_rect" : [ 215.0, 353.0, 24.0, 24.0 ] + "patching_rect" : [ 215.0, 376.0, 24.0, 24.0 ] } } @@ -83,7 +116,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "bang", "bang" ], - "patching_rect" : [ 215.0, 321.0, 42.0, 22.0 ], + "patching_rect" : [ 215.0, 344.0, 42.0, 22.0 ], "text" : "edge~" } @@ -94,7 +127,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 215.0, 379.0, 42.0, 20.0 ], + "patching_rect" : [ 215.0, 402.0, 42.0, 20.0 ], "text" : "gate" } @@ -105,7 +138,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 155.0, 379.0, 42.0, 20.0 ], + "patching_rect" : [ 155.0, 402.0, 42.0, 20.0 ], "text" : "cv2" } @@ -116,7 +149,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 94.0, 377.0, 42.0, 20.0 ], + "patching_rect" : [ 94.0, 400.0, 42.0, 20.0 ], "text" : "cv1" } @@ -132,7 +165,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "signal", "float" ], - "patching_rect" : [ 155.0, 353.0, 56.0, 22.0 ], + "patching_rect" : [ 155.0, 376.0, 56.0, 22.0 ], "sig" : 0.0 } @@ -148,7 +181,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "signal", "float" ], - "patching_rect" : [ 94.0, 353.0, 56.0, 22.0 ], + "patching_rect" : [ 94.0, 376.0, 56.0, 22.0 ], "sig" : 0.0 } @@ -159,7 +192,7 @@ "maxclass" : "ezdac~", "numinlets" : 2, "numoutlets" : 0, - "patching_rect" : [ 24.0, 425.0, 45.0, 45.0 ] + "patching_rect" : [ 24.0, 448.0, 45.0, 45.0 ] } } @@ -172,7 +205,7 @@ "numoutlets" : 5, "outlettype" : [ "signal", "signal", "", "float", "list" ], "parameter_enable" : 1, - "patching_rect" : [ 24.0, 319.0, 44.0, 90.0 ], + "patching_rect" : [ 24.0, 342.0, 44.0, 90.0 ], "saved_attribute_attributes" : { "valueof" : { "parameter_longname" : "live.gain~", @@ -198,7 +231,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 269.0, 211.714285714285666, 150.0, 22.0 ] + "patching_rect" : [ 269.0, 222.714285714285666, 150.0, 22.0 ] } } @@ -218,7 +251,7 @@ "numoutlets" : 1, "offset" : [ 0.0, 0.0 ], "outlettype" : [ "signal" ], - "patching_rect" : [ 24.0, 97.0, 225.0, 105.0 ], + "patching_rect" : [ 24.0, 55.0, 225.0, 105.0 ], "viewvisibility" : 1 } @@ -228,7 +261,7 @@ "fontsize" : 24.0, "id" : "obj-3", "maxclass" : "newobj", - "numinlets" : 5, + "numinlets" : 3, "numoutlets" : 6, "outlettype" : [ "signal", "signal", "signal", "signal", "signal", "signal" ], "patcher" : { @@ -1177,7 +1210,6 @@ "numinlets" : 1, "numoutlets" : 0, "patching_rect" : [ 272.56666666666672, 185.0, 74.288288295269012, 47.0 ], - "presentation_linecount" : 3, "text" : "knob1_foo etc also works" } @@ -1882,7 +1914,7 @@ ] } , - "patching_rect" : [ 24.0, 267.0, 194.0, 35.0 ], + "patching_rect" : [ 24.0, 290.0, 194.0, 35.0 ], "saved_object_attributes" : { "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", "exportname" : "simplepatch" @@ -1901,7 +1933,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 269.0, 97.0, 150.0, 22.0 ] + "patching_rect" : [ 269.0, 81.0, 150.0, 22.0 ] } } @@ -1913,19 +1945,20 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 269.0, 119.942857142857122, 150.0, 22.0 ] + "patching_rect" : [ 269.0, 103.942857142857122, 150.0, 22.0 ] } } , { "box" : { "attr" : "gate1", + "displaymode" : 8, "id" : "obj-5", "maxclass" : "attrui", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 269.0, 142.885714285714272, 150.0, 22.0 ] + "patching_rect" : [ 269.0, 57.0, 150.0, 22.0 ] } } @@ -1937,20 +1970,19 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 269.0, 165.828571428571394, 150.0, 22.0 ] + "patching_rect" : [ 269.0, 151.828571428571394, 150.0, 22.0 ] } } , { "box" : { "attr" : "knob2", - "displaymode" : 8, "id" : "obj-8", "maxclass" : "attrui", "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 269.0, 188.771428571428544, 150.0, 22.0 ] + "patching_rect" : [ 269.0, 174.771428571428544, 150.0, 22.0 ] } } @@ -1969,7 +2001,7 @@ "numinlets" : 1, "numoutlets" : 0, "offset" : [ 0.0, 0.0 ], - "patching_rect" : [ 568.5, 87.0, 128.0, 128.0 ], + "patching_rect" : [ 567.5, 57.0, 128.0, 128.0 ], "viewvisibility" : 1 } diff --git a/templates/oopsy_patch.maxpat b/templates/oopsy_patch.maxpat index 45a8b1c..a68f06d 100644 --- a/templates/oopsy_patch.maxpat +++ b/templates/oopsy_patch.maxpat @@ -1029,6 +1029,13 @@ "type" : "gDSP", "implicit" : 1 } +, { + "name" : "oopsy.ctrl.smooth2.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } , { "name" : "oopsy.maxpat", "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", From 0ec7881d04edfa48746a85a0016dd278d7e60de8 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Mon, 7 Dec 2020 16:15:00 -0500 Subject: [PATCH 39/58] example & subpatcher --- code/oopsy.gate.min.gendsp | 80 +++++++++++++++++++++++++++++--------- examples/reverb.maxpat | 16 ++++---- 2 files changed, 70 insertions(+), 26 deletions(-) diff --git a/code/oopsy.gate.min.gendsp b/code/oopsy.gate.min.gendsp index 89913c2..1e34dd8 100644 --- a/code/oopsy.gate.min.gendsp +++ b/code/oopsy.gate.min.gendsp @@ -10,7 +10,7 @@ } , "classnamespace" : "dsp.gen", - "rect" : [ 84.0, 103.0, 640.0, 480.0 ], + "rect" : [ 84.0, 103.0, 658.0, 409.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -40,14 +40,37 @@ "assistshowspatchername" : 0, "boxes" : [ { "box" : { - "id" : "obj-2", - "linecount" : 2, - "maxclass" : "comment", + "id" : "obj-5", + "maxclass" : "newobj", "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 141.25, 287.0, 196.0, 33.0 ], - "presentation_linecount" : 2, - "text" : "On Daisy with the default blockrate of 1kHz this implies 1ms." + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 108.25, 267.0, 70.0, 22.0 ], + "text" : "mstosamps" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 108.25, 291.0, 89.0, 22.0 ], + "text" : "max vectorsize" + } + + } +, { + "box" : { + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 108.25, 243.0, 62.0, 22.0 ], + "text" : "param ms" } } @@ -58,8 +81,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 376.25, 130.0, 229.0, 141.0 ], - "presentation_linecount" : 10, + "patching_rect" : [ 376.25, 130.0, 230.0, 141.0 ], "text" : "This subpatcher will extend any short click or gate (positive non-zero values) at least one signal vector's worth.\n\nThis may be necessary to ensure that any very short gates are not 'missed' by the GPIO output handling of the hardware (or indeed by any other hardware unable to register very short gates). " } @@ -67,12 +89,12 @@ , { "box" : { "id" : "obj-41", - "linecount" : 2, + "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 141.25, 245.0, 196.0, 33.0 ], - "text" : "keep gate high until one control vector has passed." + "patching_rect" : [ 112.25, 319.0, 196.0, 60.0 ], + "text" : "keep gate high until 1+ control vectors have passed. On Daisy with the default blockrate of 1kHz this implies 1ms." } } @@ -113,11 +135,11 @@ "box" : { "id" : "obj-34", "maxclass" : "newobj", - "numinlets" : 1, + "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 50.25, 245.0, 80.0, 22.0 ], - "text" : "<= vectorsize" + "patching_rect" : [ 50.0, 333.0, 29.5, 22.0 ], + "text" : "<=" } } @@ -187,7 +209,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 50.25, 338.0, 35.0, 22.0 ], + "patching_rect" : [ 50.25, 357.0, 35.0, 22.0 ], "text" : "out 1" } @@ -199,6 +221,13 @@ "source" : [ "obj-27", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-3", 0 ] + } + } , { "patchline" : { @@ -227,6 +256,13 @@ "source" : [ "obj-34", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-34", 1 ], + "source" : [ "obj-4", 0 ] + } + } , { "patchline" : { @@ -235,7 +271,15 @@ } } - ] +, { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-5", 0 ] + } + + } + ], + "autosave" : 0 } } diff --git a/examples/reverb.maxpat b/examples/reverb.maxpat index 85f1a98..37cb233 100644 --- a/examples/reverb.maxpat +++ b/examples/reverb.maxpat @@ -4,13 +4,13 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 5, + "revision" : 8, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 926.0, 78.0, 593.0, 651.0 ], + "rect" : [ 926.0, 78.0, 576.0, 594.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -60,12 +60,12 @@ , { "box" : { "id" : "obj-7", - "linecount" : 2, + "linecount" : 4, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 148.0, 272.0, 215.0, 33.0 ], - "text" : "Based on the Dattoro reverb gen~ example inclouded with Max" + "patching_rect" : [ 191.5, 508.0, 337.0, 60.0 ], + "text" : "Adapted from the Dattoro reverb gen~ example included with Max, which is based on Jon Dattorro's Effect Design Part 1: Reverberator and Other Filters, located here: https://ccrma.stanford.edu/~dattorro/EffectDesignPart1.pdf" } } @@ -107,7 +107,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 5, + "revision" : 8, "architecture" : "x64", "modernui" : 1 } @@ -318,7 +318,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 5, + "revision" : 8, "architecture" : "x64", "modernui" : 1 } @@ -2042,7 +2042,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 5, + "revision" : 8, "architecture" : "x64", "modernui" : 1 } From 1f87db538b75fe25ce6d2a031a94d37506a517c6 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Mon, 7 Dec 2020 16:33:52 -0500 Subject: [PATCH 40/58] fix for field target node.script error --- patchers/oopsy.maxpat | 162 +++++++++++++++++++++++++++------------ source/daisy.field.json | 4 +- source/daisy.petal.json | 1 + source/daisy.pod.json | 1 + source/daisy.versio.json | 1 + 5 files changed, 117 insertions(+), 52 deletions(-) diff --git a/patchers/oopsy.maxpat b/patchers/oopsy.maxpat index 349ada7..6f896fe 100644 --- a/patchers/oopsy.maxpat +++ b/patchers/oopsy.maxpat @@ -4,7 +4,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 5, + "revision" : 8, "architecture" : "x64", "modernui" : 1 } @@ -39,14 +39,37 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 3, + "outlettype" : [ "", "", "" ], + "patching_rect" : [ 552.0, 594.0, 106.0, 22.0 ], + "text" : "route stdout stderr" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "bang" ], + "patching_rect" : [ 222.0, 166.0, 58.0, 22.0 ], + "text" : "loadbang" + } + + } +, { "box" : { "id" : "obj-56", "linecount" : 2, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 44.5, 134.5, 150.0, 33.0 ], - "presentation_linecount" : 2, + "patching_rect" : [ 516.0, 193.0, 150.0, 33.0 ], "text" : "saving a patcher will also trigger compile" } @@ -58,8 +81,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 44.5, 179.5, 150.0, 33.0 ], - "presentation_linecount" : 4, + "patching_rect" : [ 521.0, 323.25, 150.0, 33.0 ], "text" : "audio must be on for exportcode to work" } @@ -71,7 +93,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "int" ], - "patching_rect" : [ 241.0, 185.0, 91.0, 22.0 ], + "patching_rect" : [ 425.0, 323.25, 91.0, 22.0 ], "text" : "adstatus switch" } @@ -83,7 +105,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "bang" ], - "patching_rect" : [ 243.5, 94.0, 61.0, 22.0 ], + "patching_rect" : [ 435.0, 193.0, 61.0, 22.0 ], "text" : "savebang" } @@ -97,7 +119,7 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 227.0, 31.0, 30.0, 30.0 ] + "patching_rect" : [ 222.0, 53.0, 30.0, 30.0 ] } } @@ -108,7 +130,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "bang", "int" ], - "patching_rect" : [ 227.0, 156.0, 32.0, 22.0 ], + "patching_rect" : [ 406.0, 291.0, 32.0, 22.0 ], "text" : "t b 1" } @@ -120,7 +142,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "bang", "" ], - "patching_rect" : [ 227.0, 66.0, 136.0, 22.0 ], + "patching_rect" : [ 222.0, 90.0, 136.0, 22.0 ], "text" : "sel bang" } @@ -132,7 +154,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 227.0, 262.0, 94.0, 22.0 ], + "patching_rect" : [ 222.0, 235.0, 94.0, 22.0 ], "text" : "prepend symbol" } @@ -140,11 +162,12 @@ , { "box" : { "id" : "obj-21", + "linecount" : 3, "maxclass" : "newobj", "numinlets" : 3, "numoutlets" : 3, "outlettype" : [ "", "", "" ], - "patching_rect" : [ 344.0, 220.0, 153.0, 22.0 ], + "patching_rect" : [ 339.0, 166.0, 64.0, 49.0 ], "text" : "route target done" } @@ -156,7 +179,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 227.0, 220.0, 72.0, 22.0 ], + "patching_rect" : [ 222.0, 193.0, 72.0, 22.0 ], "text" : "patcherargs" } @@ -164,12 +187,12 @@ , { "box" : { "id" : "obj-11", - "linecount" : 6, + "linecount" : 3, "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 44.5, 31.0, 150.0, 87.0 ], - "text" : "bang input triggers patcherargs, which via 'done' will trigger compile\nother messages route to patcherattrs parser, but do not trigger compile" + "patching_rect" : [ 39.5, 65.0, 152.0, 47.0 ], + "text" : "bang will trigger compile,\nother messages route to patcherattrs parser first" } } @@ -185,7 +208,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 5, + "revision" : 8, "architecture" : "x64", "modernui" : 1 } @@ -338,7 +361,7 @@ ] } , - "patching_rect" : [ 278.0, 565.0, 53.0, 22.0 ], + "patching_rect" : [ 273.0, 538.0, 53.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -357,7 +380,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "clear" ], - "patching_rect" : [ 334.5, 565.0, 41.0, 22.0 ], + "patching_rect" : [ 329.5, 538.0, 41.0, 22.0 ], "text" : "t clear" } @@ -370,7 +393,7 @@ "numoutlets" : 4, "outlettype" : [ "", "int", "", "" ], "parameter_enable" : 0, - "patching_rect" : [ 278.0, 600.0, 136.0, 75.0 ], + "patching_rect" : [ 273.0, 573.0, 136.0, 75.0 ], "presentation" : 1, "presentation_rect" : [ 0.0, 32.0, 128.0, 92.0 ], "readonly" : 1, @@ -386,7 +409,7 @@ "numoutlets" : 3, "outlettype" : [ "", "", "float" ], "parameter_enable" : 1, - "patching_rect" : [ 227.0, 296.0, 100.0, 15.0 ], + "patching_rect" : [ 222.0, 269.0, 100.0, 15.0 ], "presentation" : 1, "presentation_rect" : [ 31.0, 0.0, 45.0, 15.0 ], "saved_attribute_attributes" : { @@ -414,7 +437,7 @@ "numoutlets" : 2, "outlettype" : [ "", "" ], "parameter_enable" : 1, - "patching_rect" : [ 507.0, 560.191986000000043, 62.0, 16.0 ], + "patching_rect" : [ 502.0, 533.191986000000043, 62.0, 16.0 ], "presentation" : 1, "presentation_rect" : [ 76.0, 0.0, 52.0, 15.0 ], "saved_attribute_attributes" : { @@ -443,7 +466,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "bang", "" ], - "patching_rect" : [ 267.5, 318.0, 29.5, 22.0 ], + "patching_rect" : [ 262.5, 291.0, 29.5, 22.0 ], "text" : "t b l" } @@ -455,7 +478,7 @@ "numinlets" : 2, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 557.0, 589.0, 32.0, 22.0 ], + "patching_rect" : [ 552.0, 562.0, 32.0, 22.0 ], "text" : "gate" } @@ -467,7 +490,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 44.5, 278.0, 150.0, 33.0 ], + "patching_rect" : [ 39.5, 235.0, 150.0, 33.0 ], "text" : "choose device target to compile for" } @@ -479,7 +502,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 44.5, 493.0, 224.0, 74.0 ], + "patching_rect" : [ 39.5, 466.0, 224.0, 74.0 ], "text" : "the node.js script is a thin wrapper around oopsy.js, which will generate the glue code between gen~ export and the Daisy APIs, compile it, and try to upload it to a device." } @@ -491,7 +514,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 44.5, 403.000003099441528, 223.5, 60.0 ], + "patching_rect" : [ 39.5, 376.000003099441528, 223.5, 60.0 ], "text" : "oopsy.snoop will find all the gen~ objects in the parent patcher, configure them for export, trigger the export, then notify the node.js script" } @@ -503,7 +526,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 461.0, 403.000003099441528, 114.0, 33.0 ], + "patching_rect" : [ 456.0, 376.000003099441528, 114.0, 33.0 ], "text" : "turn Max-style path into OS path" } @@ -515,7 +538,7 @@ "numinlets" : 2, "numoutlets" : 4, "outlettype" : [ "dictionary", "", "", "" ], - "patching_rect" : [ 487.0, 621.0, 50.5, 22.0 ], + "patching_rect" : [ 482.0, 594.0, 50.5, 22.0 ], "saved_object_attributes" : { "embed" : 0, "parameter_enable" : 0, @@ -532,7 +555,7 @@ "maxclass" : "newobj", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 557.0, 621.0, 114.0, 22.0 ], + "patching_rect" : [ 552.0, 626.0, 114.0, 22.0 ], "text" : "print oopsy-verbose" } @@ -544,7 +567,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 487.0, 589.0, 65.0, 22.0 ], + "patching_rect" : [ 482.0, 562.0, 65.0, 22.0 ], "text" : "route error" } @@ -556,7 +579,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 487.0, 528.0, 102.0, 22.0 ], + "patching_rect" : [ 482.0, 501.0, 102.0, 22.0 ], "text" : "route terminated" } @@ -569,7 +592,7 @@ "numoutlets" : 1, "outlettype" : [ "bang" ], "parameter_enable" : 0, - "patching_rect" : [ 227.0, 122.0, 30.0, 30.0 ], + "patching_rect" : [ 406.0, 235.0, 30.0, 30.0 ], "presentation" : 1, "presentation_rect" : [ 0.0, 0.0, 30.0, 30.0 ] } @@ -584,7 +607,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 278.0, 493.0, 228.0, 26.0 ], + "patching_rect" : [ 273.0, 466.0, 228.0, 26.0 ], "saved_object_attributes" : { "autostart" : 0, "defer" : 0, @@ -604,7 +627,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 278.0, 435.0, 111.0, 22.0 ], + "patching_rect" : [ 273.0, 408.0, 111.0, 22.0 ], "text" : "prepend script start" } @@ -616,7 +639,7 @@ "numinlets" : 1, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 278.0, 350.25, 130.0, 22.0 ], + "patching_rect" : [ 273.0, 323.25, 130.0, 22.0 ], "text" : "prepend setprop target" } @@ -633,7 +656,7 @@ "appversion" : { "major" : 8, "minor" : 1, - "revision" : 5, + "revision" : 8, "architecture" : "x64", "modernui" : 1 } @@ -761,7 +784,7 @@ ] } , - "patching_rect" : [ 402.0, 403.000003099441528, 54.0, 22.0 ], + "patching_rect" : [ 397.0, 376.000003099441528, 54.0, 22.0 ], "saved_object_attributes" : { "description" : "", "digest" : "", @@ -782,7 +805,7 @@ "numinlets" : 2, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 278.0, 403.000003099441528, 114.0, 26.0 ], + "patching_rect" : [ 273.0, 376.000003099441528, 114.0, 26.0 ], "saved_object_attributes" : { "filename" : "oopsy.snoop", "parameter_enable" : 0 @@ -794,6 +817,13 @@ } ], "lines" : [ { + "patchline" : { + "destination" : [ "obj-15", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { "patchline" : { "destination" : [ "obj-5", 1 ], "source" : [ "obj-12", 0 ] @@ -802,7 +832,7 @@ } , { "patchline" : { - "destination" : [ "obj-49", 0 ], + "destination" : [ "obj-3", 0 ], "source" : [ "obj-13", 0 ] } @@ -810,7 +840,7 @@ , { "patchline" : { "destination" : [ "obj-5", 0 ], - "midpoints" : [ 287.5, 390.750001549720764, 287.5, 390.750001549720764 ], + "midpoints" : [ 282.5, 363.750001549720764, 282.5, 363.750001549720764 ], "source" : [ "obj-14", 0 ] } @@ -855,18 +885,38 @@ , { "patchline" : { "destination" : [ "obj-37", 0 ], - "midpoints" : [ 353.5, 254.5, 236.5, 254.5 ], + "midpoints" : [ 348.5, 227.5, 231.5, 227.5 ], "source" : [ "obj-21", 0 ] } } , { "patchline" : { - "destination" : [ "obj-5", 0 ], - "midpoints" : [ 420.5, 385.500001549720764, 287.5, 385.500001549720764 ], + "destination" : [ "obj-7", 0 ], "source" : [ "obj-21", 1 ] } + } +, { + "patchline" : { + "destination" : [ "obj-49", 0 ], + "source" : [ "obj-3", 2 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-49", 0 ], + "source" : [ "obj-3", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-49", 0 ], + "source" : [ "obj-3", 0 ] + } + } , { "patchline" : { @@ -906,31 +956,33 @@ , { "patchline" : { "destination" : [ "obj-7", 0 ], + "midpoints" : [ 231.5, 131.0, 415.5, 131.0 ], "source" : [ "obj-38", 0 ] } } , { "patchline" : { - "destination" : [ "obj-2", 0 ], - "order" : 1, + "destination" : [ "obj-13", 1 ], + "order" : 0, "source" : [ "obj-40", 0 ] } } , { "patchline" : { - "destination" : [ "obj-51", 0 ], - "midpoints" : [ 287.5, 474.5, 344.0, 474.5 ], - "order" : 0, + "destination" : [ "obj-2", 0 ], + "order" : 2, "source" : [ "obj-40", 0 ] } } , { "patchline" : { - "destination" : [ "obj-15", 0 ], - "source" : [ "obj-41", 0 ] + "destination" : [ "obj-51", 0 ], + "midpoints" : [ 282.5, 447.5, 339.0, 447.5 ], + "order" : 1, + "source" : [ "obj-40", 0 ] } } @@ -940,6 +992,14 @@ "source" : [ "obj-41", 1 ] } + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "midpoints" : [ 415.5, 358.500001549720764, 282.5, 358.500001549720764 ], + "source" : [ "obj-41", 0 ] + } + } , { "patchline" : { diff --git a/source/daisy.field.json b/source/daisy.field.json index 2cbf8a8..62b0819 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -117,7 +117,9 @@ }, "setters": { "dsy_cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", - "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)", + "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)" + }, + "setters_audio": { "dsy_gate_out1": "dsy_gpio_write(&hardware.gate_out_, $ > 0.f)" }, "mainhandlers": { diff --git a/source/daisy.petal.json b/source/daisy.petal.json index b3d11a6..8acf196 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -57,6 +57,7 @@ "dsy_switch7": "(hardware.switches[6].Pressed()?1.f:0.f)" }, "setters": {}, + "setters_audio": {}, "mainhandlers": {}, "audio_ins": [ "dsy_in1", diff --git a/source/daisy.pod.json b/source/daisy.pod.json index adc7192..97492cb 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -30,6 +30,7 @@ "dsy_switch2": "(hardware.button2.Pressed()?1.f:0.f)" }, "setters": {}, + "setters_audio": {}, "mainhandlers": {}, "audio_ins": [ "dsy_in1", diff --git a/source/daisy.versio.json b/source/daisy.versio.json index 369e3d4..df7f0e8 100644 --- a/source/daisy.versio.json +++ b/source/daisy.versio.json @@ -67,6 +67,7 @@ "dsy_gate_in1": "(hardware.Gate()?1.f:0.f)" }, "setters": {}, + "setters_audio": {}, "mainhandlers": {}, "audio_ins": [ "dsy_in1", From 50ae2ac6c9c81a8bdd1fc36d9906035967095414 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Mon, 7 Dec 2020 20:21:36 -0500 Subject: [PATCH 41/58] petal and pod templates --- code/oopsy.cv2hz.gendsp | 236 ++++++++++ source/daisy.petal.json | 20 +- source/daisy.pod.json | 10 +- source/oopsy.js | 2 +- templates/oopsy_field.maxpat | 8 +- templates/oopsy_patch.maxpat | 8 +- templates/oopsy_petal.maxpat | 882 +++++++++++++++++++++++++++++++++++ templates/oopsy_pod.maxpat | 694 +++++++++++++++++++++++++++ 8 files changed, 1839 insertions(+), 21 deletions(-) create mode 100644 code/oopsy.cv2hz.gendsp create mode 100644 templates/oopsy_petal.maxpat create mode 100644 templates/oopsy_pod.maxpat diff --git a/code/oopsy.cv2hz.gendsp b/code/oopsy.cv2hz.gendsp new file mode 100644 index 0000000..49d76ce --- /dev/null +++ b/code/oopsy.cv2hz.gendsp @@ -0,0 +1,236 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 742.0, 324.0, 764.0, 299.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 536.0, 20.0, 71.0, 22.0 ], + "text" : "in 2 register" + } + + } +, { + "box" : { + "id" : "obj-33", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 551.0, 50.0, 187.0, 33.0 ], + "text" : "add integer here to shift register (default 3v = C4 MIDI 60" + } + + } +, { + "box" : { + "id" : "obj-29", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 489.0, 121.0, 150.0, 20.0 ], + "text" : "chroma rotate A->C (3/12)" + } + + } +, { + "box" : { + "id" : "obj-24", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 444.0, 121.0, 42.0, 22.0 ], + "text" : "+ 0.25" + } + + } +, { + "box" : { + "id" : "obj-25", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 421.0, 121.0, 19.0, 22.0 ], + "text" : "2" + } + + } +, { + "box" : { + "id" : "obj-26", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 421.0, 150.0, 42.0, 22.0 ], + "text" : "pow" + } + + } +, { + "box" : { + "id" : "obj-27", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 421.0, 179.0, 40.0, 22.0 ], + "text" : "* 27.5" + } + + } +, { + "box" : { + "id" : "obj-15", + "linecount" : 14, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 23.0, 20.0, 354.0, 194.0 ], + "text" : "CV to Hz is somewhat arbitrary, with a variety of conventions in wide use. \n\nOne widespread convention is that adding one volt will increase pitch by one octave (every 2^1/12 volt is a semitone), which is implemented here. The base tuning of an integer voltage is mostly a \"C\", which is also implemented here, but see https://learningmodular.com/matching-octaves-in-your-modular to see how much the register can vary in hardware; 0v, 1v, 2v and 3v are all widespread tunings for MIDI note 60 (C4) for example.\n\nYou can shift the register simply by adding an integer to the input CV. Here we chose 3v == C4/MIDI 60 as a default." + } + + } +, { + "box" : { + "id" : "obj-41", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 444.0, 72.0, 29.5, 22.0 ], + "text" : "+" + } + + } +, { + "box" : { + "id" : "obj-40", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 489.0, 179.0, 150.0, 20.0 ], + "text" : "frequency of MIDI A0" + } + + } +, { + "box" : { + "id" : "obj-12", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 444.0, 20.0, 75.0, 22.0 ], + "text" : "in 1 pitch_cv" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 421.0, 252.0, 53.0, 22.0 ], + "text" : "out 1 Hz" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-41", 1 ], + "midpoints" : [ 545.5, 54.0, 464.0, 54.0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-41", 0 ], + "source" : [ "obj-12", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-26", 1 ], + "source" : [ "obj-24", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-26", 0 ], + "source" : [ "obj-25", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-27", 0 ], + "source" : [ "obj-26", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-27", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-24", 0 ], + "source" : [ "obj-41", 0 ] + } + + } + ] + } + +} diff --git a/source/daisy.petal.json b/source/daisy.petal.json index 8acf196..8bafdb9 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -18,6 +18,7 @@ "sw5": "dsy_switch5", "sw6": "dsy_switch6", "sw7": "dsy_switch7", + "exp1": "dsy_exp1", "ctrl1": "dsy_knob1", "ctrl2": "dsy_knob2", @@ -34,10 +35,15 @@ "switch7": "dsy_switch7", "knob": "dsy_knob1", "ctrl": "dsy_knob1", - "switch": "dsy_switch1" + "switch": "dsy_switch1", + "exp": "dsy_exp1", + "expression": "dsy_exp1" }, "outs": { - + "led1": "dsy_footswitch_led1", + "led2": "dsy_footswitch_led2", + "led3": "dsy_footswitch_led3", + "led4": "dsy_footswitch_led4" }, "datas": {} }, @@ -54,9 +60,15 @@ "dsy_switch4": "(hardware.switches[3].Pressed()?1.f:0.f)", "dsy_switch5": "(hardware.switches[4].Pressed()?1.f:0.f)", "dsy_switch6": "(hardware.switches[5].Pressed()?1.f:0.f)", - "dsy_switch7": "(hardware.switches[6].Pressed()?1.f:0.f)" + "dsy_switch7": "(hardware.switches[6].Pressed()?1.f:0.f)", + "dsy_exp1": "(hardware.GetExpression())" + }, + "setters": { + "dsy_footswitch_led1": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_1, $)", + "dsy_footswitch_led2": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_2, $)", + "dsy_footswitch_led3": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_3, $)", + "dsy_footswitch_led4": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_4, $)" }, - "setters": {}, "setters_audio": {}, "mainhandlers": {}, "audio_ins": [ diff --git a/source/daisy.pod.json b/source/daisy.pod.json index 97492cb..1c1ca23 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -9,14 +9,18 @@ "knob2": "dsy_knob2", "sw1": "dsy_switch1", "sw2": "dsy_switch2", + "sw3": "dsy_encoder_switch", + "encoder": "dsy_encoder_incr", "ctrl1": "dsy_knob1", "ctrl2": "dsy_knob2", "switch1": "dsy_switch1", "switch2": "dsy_switch2", + "switch3": "dsy_encoder_switch", "knob": "dsy_knob1", "ctrl": "dsy_knob1", - "switch": "dsy_switch1" + "switch": "dsy_switch1", + "press": "dsy_encoder_switch" }, "outs": { @@ -27,7 +31,9 @@ "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_1)", "dsy_knob2": "hardware.GetKnobValue(hardware.KNOB_2)", "dsy_switch1": "(hardware.button1.Pressed()?1.f:0.f)", - "dsy_switch2": "(hardware.button2.Pressed()?1.f:0.f)" + "dsy_switch2": "(hardware.button2.Pressed()?1.f:0.f)", + "dsy_encoder_incr": "(hardware.encoder.Increment())", + "dsy_encoder_switch": "(hardware.encoder.Pressed())" }, "setters": {}, "setters_audio": {}, diff --git a/source/oopsy.js b/source/oopsy.js index bacf370..d48d627 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -209,7 +209,7 @@ CPPFLAGS+=-O3 -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-var if (hardware.oled) defines.OOPSY_TARGET_HAS_OLED = 1 // store for debugging: - fs.writeFileSync(path.join(build_path, `${build_name}_${target}.json`), JSON.stringify(config,null," "),"utf8"); + //fs.writeFileSync(path.join(build_path, `${build_name}_${target}.json`), JSON.stringify(config,null," "),"utf8"); const cppcode = `${Object.keys(defines).map(k => ` #define ${k} (${defines[k]})`).join("")} diff --git a/templates/oopsy_field.maxpat b/templates/oopsy_field.maxpat index 7e5973d..401ab1d 100644 --- a/templates/oopsy_field.maxpat +++ b/templates/oopsy_field.maxpat @@ -1915,13 +1915,7 @@ } , "patching_rect" : [ 24.0, 290.0, 194.0, 35.0 ], - "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", - "exportname" : "simplepatch" - } -, - "text" : "gen~", - "varname" : "simplepatch" + "text" : "gen~" } } diff --git a/templates/oopsy_patch.maxpat b/templates/oopsy_patch.maxpat index a68f06d..26cf9a7 100644 --- a/templates/oopsy_patch.maxpat +++ b/templates/oopsy_patch.maxpat @@ -802,13 +802,7 @@ } , "patching_rect" : [ 24.0, 267.0, 194.0, 35.0 ], - "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", - "exportname" : "simplepatch" - } -, - "text" : "gen~", - "varname" : "simplepatch" + "text" : "gen~" } } diff --git a/templates/oopsy_petal.maxpat b/templates/oopsy_petal.maxpat new file mode 100644 index 0000000..957cb48 --- /dev/null +++ b/templates/oopsy_petal.maxpat @@ -0,0 +1,882 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 869.0, 147.0, 496.0, 523.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-17", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 262.333333333333371, 110.942857142857122, 150.0, 20.0 ], + "text" : "etc." + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-12", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 140.0, 314.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-14", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 140.0, 285.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-3", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 75.0, 314.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontface" : 0, + "fontname" : "Arial", + "fontsize" : 12.0, + "id" : "obj-1", + "maxclass" : "number~", + "mode" : 2, + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "float" ], + "patching_rect" : [ 75.0, 285.0, 56.0, 22.0 ], + "sig" : 0.0 + } + + } +, { + "box" : { + "fontname" : "Arial Italic", + "fontsize" : 18.0, + "id" : "obj-24", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 19.333333333333343, 22.0, 221.0, 27.0 ], + "text" : "Template for DaisyPetal" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "ezdac~", + "numinlets" : 2, + "numoutlets" : 0, + "patching_rect" : [ 17.333333333333343, 393.0, 45.0, 45.0 ] + } + + } +, { + "box" : { + "id" : "obj-11", + "lastchannelcount" : 0, + "maxclass" : "live.gain~", + "numinlets" : 2, + "numoutlets" : 5, + "outlettype" : [ "signal", "signal", "", "float", "list" ], + "parameter_enable" : 1, + "patching_rect" : [ 17.333333333333343, 287.0, 44.0, 90.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_longname" : "live.gain~", + "parameter_mmax" : 6.0, + "parameter_mmin" : -70.0, + "parameter_shortname" : "live.gain~", + "parameter_type" : 0, + "parameter_unitstyle" : 4 + } + + } +, + "varname" : "live.gain~" + } + + } +, { + "box" : { + "args" : [ "@loop", 1, "@file", "jongly.aif" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-7", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "demosound.maxpat", + "numinlets" : 0, + "numoutlets" : 1, + "offset" : [ 0.0, 0.0 ], + "outlettype" : [ "signal" ], + "patching_rect" : [ 17.333333333333343, 65.0, 225.0, 105.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "attr" : "sw1", + "id" : "obj-2", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 65.0, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "sw2", + "id" : "obj-4", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 87.942857142857122, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "knob5", + "id" : "obj-5", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 128.885714285714272, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "knob6", + "id" : "obj-6", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 151.828571428571394, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "exp", + "displaymode" : 1, + "id" : "obj-8", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 262.333333333333371, 174.771428571428544, 150.0, 22.0 ] + } + + } +, { + "box" : { + "args" : [ "@target", "petal" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 267.5, 327.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "color" : [ 0.254901960784314, 0.533333333333333, 0.258823529411765, 1.0 ], + "fontsize" : 24.0, + "id" : "obj-16", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 6, + "outlettype" : [ "signal", "signal", "signal", "signal", "signal", "signal" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 67.0, 198.0, 1141.0, 427.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-26", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 458.140522875816941, 341.0, 61.0, 22.0 ], + "text" : "out 6 led4" + } + + } +, { + "box" : { + "id" : "obj-27", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 381.5, 341.0, 61.0, 22.0 ], + "text" : "out 5 led3" + } + + } +, { + "box" : { + "id" : "obj-25", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 301.140522875816941, 341.0, 61.0, 22.0 ], + "text" : "out 4 led2" + } + + } +, { + "box" : { + "id" : "obj-24", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 235.5, 341.0, 61.0, 22.0 ], + "text" : "out 3 led1" + } + + } +, { + "box" : { + "id" : "obj-23", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 535.5, 88.0, 65.0, 22.0 ], + "text" : "param exp" + } + + } +, { + "box" : { + "id" : "obj-20", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 320.547120418848181, 230.30375586854467, 67.0, 22.0 ], + "text" : "param sw7" + } + + } +, { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 307.515706806282765, 206.586463223787234, 67.0, 22.0 ], + "text" : "param sw6" + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 291.74083769633512, 182.86917057902977, 67.0, 22.0 ], + "text" : "param sw5" + } + + } +, { + "box" : { + "id" : "obj-18", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 277.33769633507859, 159.151877934272306, 67.0, 22.0 ], + "text" : "param sw4" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 264.30628272251306, 135.434585289514871, 67.0, 22.0 ], + "text" : "param sw3" + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 458.140522875816941, 210.0, 176.0, 22.0 ], + "text" : "param knob6 @min -1 @max 1" + } + + } +, { + "box" : { + "id" : "obj-16", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 441.166666666666742, 185.600000000000023, 79.0, 22.0 ], + "text" : "param knob5" + } + + } +, { + "box" : { + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 427.807189542483684, 161.200000000000017, 79.0, 22.0 ], + "text" : "param knob4" + } + + } +, { + "box" : { + "id" : "obj-9", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 412.833333333333258, 136.800000000000011, 79.0, 22.0 ], + "text" : "param knob3" + } + + } +, { + "box" : { + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 248.531413612565416, 111.717292644757435, 67.0, 22.0 ], + "text" : "param sw2" + } + + } +, { + "box" : { + "id" : "obj-7", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 235.5, 88.0, 67.0, 22.0 ], + "text" : "param sw1" + } + + } +, { + "box" : { + "id" : "obj-39", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 1000.5, 88.0, 107.0, 22.0 ], + "text" : "oopsy.suggestions" + } + + } +, { + "box" : { + "id" : "obj-38", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 18.5, 342.0, 69.0, 20.0 ], + "text" : "OUTPUTS" + } + + } +, { + "box" : { + "id" : "obj-37", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 18.5, 88.0, 69.0, 20.0 ], + "text" : "INPUTS" + } + + } +, { + "box" : { + "id" : "obj-17", + "linecount" : 2, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 235.5, 40.0, 319.0, 33.0 ], + "text" : "Knob and switch inputs will be mapped to the @min..@max range. @min @max are 0 and 1 by default." + } + + } +, { + "box" : { + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 396.473856209150313, 112.400000000000006, 79.0, 22.0 ], + "text" : "param knob2" + } + + } +, { + "box" : { + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 381.5, 88.0, 79.0, 22.0 ], + "text" : "param knob1" + } + + } +, { + "box" : { + "id" : "obj-11", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 126.5, 53.0, 69.0, 20.0 ], + "text" : "Audio IOs" + } + + } +, { + "box" : { + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 167.5, 88.0, 28.0, 22.0 ], + "text" : "in 2" + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 167.5, 342.0, 35.0, 22.0 ], + "text" : "out 2" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 126.5, 88.0, 28.0, 22.0 ], + "text" : "in 1" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 126.5, 342.0, 35.0, 22.0 ], + "text" : "out 1" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-26", 0 ], + "source" : [ "obj-15", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-27", 0 ], + "source" : [ "obj-16", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-3", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-25", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-24", 0 ], + "source" : [ "obj-7", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 17.333333333333343, 222.0, 71.5, 35.0 ], + "saved_object_attributes" : { + "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportname" : "oopsy_petal" + } +, + "text" : "gen~", + "varname" : "oopsy_petal" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-13", 1 ], + "source" : [ "obj-11", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-16", 2 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 0 ], + "source" : [ "obj-16", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-12", 0 ], + "source" : [ "obj-16", 5 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-14", 0 ], + "source" : [ "obj-16", 4 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-16", 3 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-4", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-7", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-8", 0 ] + } + + } + ], + "parameters" : { + "obj-11" : [ "live.gain~", "live.gain~", 0 ], + "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], + "obj-7::obj-35" : [ "[5]", "Level", 0 ], + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.suggestions.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.gate.min.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.ctrl.smooth3.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.ctrl.smooth2.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "demosound.maxpat", + "bootpath" : "C74:/help/msp", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "sine.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "saw.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "square.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "random.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "interfacecolor.js", + "bootpath" : "C74:/interfaces", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} diff --git a/templates/oopsy_pod.maxpat b/templates/oopsy_pod.maxpat new file mode 100644 index 0000000..c1a9ac5 --- /dev/null +++ b/templates/oopsy_pod.maxpat @@ -0,0 +1,694 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 692.0, 240.0, 640.0, 480.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 3, + "numoutlets" : 2, + "outlettype" : [ "signal", "signal" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 8, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 84.0, 103.0, 964.0, 458.0 ], + "bglocked" : 0, + "openinpresentation" : 0, + "default_fontsize" : 12.0, + "default_fontface" : 0, + "default_fontname" : "Arial", + "gridonopen" : 1, + "gridsize" : [ 15.0, 15.0 ], + "gridsnaponopen" : 1, + "objectsnaponopen" : 1, + "statusbarvisible" : 2, + "toolbarvisible" : 1, + "lefttoolbarpinned" : 0, + "toptoolbarpinned" : 0, + "righttoolbarpinned" : 0, + "bottomtoolbarpinned" : 0, + "toolbars_unpinned_last_save" : 0, + "tallnewobj" : 0, + "boxanimatetime" : 200, + "enablehscroll" : 1, + "enablevscroll" : 1, + "devicewidth" : 0.0, + "description" : "", + "digest" : "", + "tags" : "", + "style" : "", + "subpatcher_template" : "", + "assistshowspatchername" : 0, + "boxes" : [ { + "box" : { + "id" : "obj-10", + "linecount" : 4, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 492.5, 157.0, 108.0, 60.0 ], + "text" : "Pod encoder will be +1, -1 or 0;\nencoder press will be 0 or 1" + } + + } +, { + "box" : { + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 472.5, 120.0, 75.0, 22.0 ], + "text" : "param press" + } + + } +, { + "box" : { + "id" : "obj-9", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 453.5, 96.0, 89.0, 22.0 ], + "text" : "param encoder" + } + + } +, { + "box" : { + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 284.5, 172.0, 164.0, 22.0 ], + "text" : "param sw2 @min -1 @max 1" + } + + } +, { + "box" : { + "id" : "obj-7", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 265.5, 148.0, 67.0, 22.0 ], + "text" : "param sw1" + } + + } +, { + "box" : { + "id" : "obj-39", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 794.5, 96.0, 107.0, 22.0 ], + "text" : "oopsy.suggestions" + } + + } +, { + "box" : { + "id" : "obj-38", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 9.5, 350.0, 69.0, 20.0 ], + "text" : "OUTPUTS" + } + + } +, { + "box" : { + "id" : "obj-37", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 9.5, 96.0, 69.0, 20.0 ], + "text" : "INPUTS" + } + + } +, { + "box" : { + "id" : "obj-36", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 631.0, 62.5, 139.0, 20.0 ], + "text" : "MIDI:" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 631.0, 96.0, 53.0, 22.0 ], + "text" : "in 3 midi" + } + + } +, { + "box" : { + "id" : "obj-30", + "linecount" : 7, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 651.0, 157.0, 139.0, 100.0 ], + "text" : "\"midi\" input/output is converted to/from normalized byte streams. See the MIDI examples more info on how to read and write these. " + } + + } +, { + "box" : { + "id" : "obj-17", + "linecount" : 6, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 313.5, 211.400900900363922, 122.0, 87.0 ], + "text" : "Knob and switch inputs will be mapped to the @min..@max range. @min @max are 0 and 1 by default." + } + + } +, { + "box" : { + "id" : "obj-14", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 244.5, 120.0, 176.0, 22.0 ], + "text" : "param knob2 @min -1 @max 1" + } + + } +, { + "box" : { + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 225.5, 96.0, 79.0, 22.0 ], + "text" : "param knob1" + } + + } +, { + "box" : { + "id" : "obj-12", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 225.5, 61.0, 57.0, 20.0 ], + "text" : "Knobs" + } + + } +, { + "box" : { + "id" : "obj-11", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 117.5, 61.0, 69.0, 20.0 ], + "text" : "Audio IOs" + } + + } +, { + "box" : { + "id" : "obj-3", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 158.5, 96.0, 28.0, 22.0 ], + "text" : "in 2" + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 158.5, 350.0, 35.0, 22.0 ], + "text" : "out 2" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 117.5, 96.0, 28.0, 22.0 ], + "text" : "in 1" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 117.5, 350.0, 35.0, 22.0 ], + "text" : "out 1" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "source" : [ "obj-3", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 18.0, 267.0, 137.0, 22.0 ], + "saved_object_attributes" : { + "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportname" : "oopsy_pod" + } +, + "text" : "gen~", + "varname" : "oopsy_pod" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "ezdac~", + "numinlets" : 2, + "numoutlets" : 0, + "patching_rect" : [ 18.0, 429.0, 45.0, 45.0 ] + } + + } +, { + "box" : { + "id" : "obj-11", + "lastchannelcount" : 0, + "maxclass" : "live.gain~", + "numinlets" : 2, + "numoutlets" : 5, + "outlettype" : [ "signal", "signal", "", "float", "list" ], + "parameter_enable" : 1, + "patching_rect" : [ 18.0, 323.0, 44.0, 90.0 ], + "saved_attribute_attributes" : { + "valueof" : { + "parameter_longname" : "live.gain~", + "parameter_mmax" : 6.0, + "parameter_mmin" : -70.0, + "parameter_shortname" : "live.gain~", + "parameter_type" : 0, + "parameter_unitstyle" : 4 + } + + } +, + "varname" : "live.gain~" + } + + } +, { + "box" : { + "attr" : "press", + "displaymode" : 8, + "id" : "obj-10", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 263.0, 215.714285714285666, 150.0, 22.0 ] + } + + } +, { + "box" : { + "args" : [ "@loop", 1, "@file", "jongly.aif" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-7", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "demosound.maxpat", + "numinlets" : 0, + "numoutlets" : 1, + "offset" : [ 0.0, 0.0 ], + "outlettype" : [ "signal" ], + "patching_rect" : [ 18.0, 101.0, 225.0, 105.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "attr" : "knob1", + "id" : "obj-2", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 263.0, 101.0, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "knob2", + "id" : "obj-4", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 263.0, 123.942857142857122, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "sw1", + "id" : "obj-5", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 263.0, 146.885714285714272, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "sw2", + "id" : "obj-6", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 263.0, 169.828571428571394, 150.0, 22.0 ] + } + + } +, { + "box" : { + "attr" : "encoder", + "displaymode" : 1, + "id" : "obj-8", + "maxclass" : "attrui", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 263.0, 192.771428571428544, 150.0, 22.0 ] + } + + } +, { + "box" : { + "fontname" : "Arial Italic", + "fontsize" : 18.0, + "id" : "obj-24", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 18.0, 25.0, 221.0, 27.0 ], + "text" : "Template for DaisyPod" + } + + } +, { + "box" : { + "args" : [ "@target", "pod" ], + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-9", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "oopsy.maxpat", + "numinlets" : 1, + "numoutlets" : 0, + "offset" : [ 0.0, 0.0 ], + "patching_rect" : [ 457.5, 101.0, 128.0, 128.0 ], + "viewvisibility" : 1 + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-11", 1 ], + "source" : [ "obj-1", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 1 ], + "source" : [ "obj-11", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-4", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-7", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-8", 0 ] + } + + } + ], + "parameters" : { + "obj-11" : [ "live.gain~", "live.gain~", 0 ], + "obj-7::obj-21::obj-6" : [ "live.tab[3]", "live.tab[1]", 0 ], + "obj-7::obj-35" : [ "[5]", "Level", 0 ], + "obj-9::obj-32" : [ "live.text[2]", "FILTER", 0 ], + "obj-9::obj-36" : [ "live.menu[1]", "live.menu", 0 ], + "parameterbanks" : { + + } +, + "inherited_shortname" : 1 + } +, + "dependency_cache" : [ { + "name" : "oopsy.maxpat", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/patchers", + "patcherrelativepath" : "../patchers", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "oopsy.snoop.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.node4max.js", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/javascript", + "patcherrelativepath" : "../javascript", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "demosound.maxpat", + "bootpath" : "C74:/help/msp", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "sine.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "saw.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "square.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "random.svg", + "bootpath" : "C74:/media/max/picts/m4l-picts", + "type" : "svg", + "implicit" : 1 + } +, { + "name" : "interfacecolor.js", + "bootpath" : "C74:/interfaces", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "oopsy.suggestions.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.gate.min.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.ctrl.smooth3.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } +, { + "name" : "oopsy.ctrl.smooth2.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} From 06455f72f3f84e7210a62f5b737c513094334a45 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 10:27:17 -0500 Subject: [PATCH 42/58] restructure code generation to fix led output on petal --- source/daisy.field.json | 21 +++++--- source/daisy.patch.json | 21 +++++--- source/daisy.petal.json | 30 ++++++++---- source/daisy.pod.json | 5 +- source/daisy.versio.json | 5 +- source/oopsy.js | 94 +++++++++++++++++------------------- templates/oopsy_petal.maxpat | 80 ++++++++++++++++++++++++++++++ 7 files changed, 178 insertions(+), 78 deletions(-) diff --git a/source/daisy.field.json b/source/daisy.field.json index 62b0819..de2492e 100644 --- a/source/daisy.field.json +++ b/source/daisy.field.json @@ -82,7 +82,7 @@ "leds": "dsy_leds" } }, - "getters": { + "inputs": { "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_1)", "dsy_knob2": "hardware.GetKnobValue(hardware.KNOB_2)", "dsy_knob3": "hardware.GetKnobValue(hardware.KNOB_3)", @@ -115,12 +115,19 @@ "dsy_cv_in4": "hardware.GetCvValue(3)", "dsy_gate_in1": "(hardware.gate_in_.State()?1.f:0.f)" }, - "setters": { - "dsy_cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", - "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)" - }, - "setters_audio": { - "dsy_gate_out1": "dsy_gpio_write(&hardware.gate_out_, $ > 0.f)" + "outputs": { + "dsy_cv_out1": { + "where":"main", + "setter": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)" + }, + "dsy_cv_out2": { + "where":"main", + "setter": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)" + }, + "dsy_gate_out1": { + "where":"audio", + "setter": "dsy_gpio_write(&hardware.gate_out_, $ > 0.f)" + } }, "mainhandlers": { "dsy_leds": "daisy.setFieldLedsFromData($)" diff --git a/source/daisy.patch.json b/source/daisy.patch.json index 95d0d0e..f5b23d2 100644 --- a/source/daisy.patch.json +++ b/source/daisy.patch.json @@ -31,7 +31,7 @@ }, "datas": {} }, - "getters": { + "inputs": { "dsy_cv_in1": "hardware.GetCtrlValue(hardware.CTRL_1)", "dsy_cv_in2": "hardware.GetCtrlValue(hardware.CTRL_2)", "dsy_cv_in3": "hardware.GetCtrlValue(hardware.CTRL_3)", @@ -39,12 +39,19 @@ "dsy_gate_in1": "(hardware.gate_input[hardware.GATE_IN_1].State()?1.f:0.f)", "dsy_gate_in2": "(hardware.gate_input[hardware.GATE_IN_2].State()?1.f:0.f)" }, - "setters": { - "dsy_cv_out1": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)", - "dsy_cv_out2": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)" - }, - "setters_audio": { - "dsy_gate_out1": "dsy_gpio_write(&hardware.gate_output, $ > 0.f)" + "outputs": { + "dsy_cv_out1": { + "where": "main", + "setter": "dsy_dac_write(DSY_DAC_CHN1, $ * 4095)" + }, + "dsy_cv_out2": { + "where": "main", + "setter": "dsy_dac_write(DSY_DAC_CHN2, $ * 4095)" + }, + "dsy_gate_out1": { + "where": "audio", + "setter": "dsy_gpio_write(&hardware.gate_output, $ > 0.f)" + } }, "mainhandlers": {}, "audio_ins": [ diff --git a/source/daisy.petal.json b/source/daisy.petal.json index 8bafdb9..bcf33f7 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -1,5 +1,5 @@ { - "max_apps":8, + "max_apps":1, "defines": { "OOPSY_TARGET_PETAL": 1 }, @@ -47,7 +47,7 @@ }, "datas": {} }, - "getters": { + "inputs": { "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_1)", "dsy_knob2": "hardware.GetKnobValue(hardware.KNOB_2)", "dsy_knob3": "hardware.GetKnobValue(hardware.KNOB_3)", @@ -63,14 +63,26 @@ "dsy_switch7": "(hardware.switches[6].Pressed()?1.f:0.f)", "dsy_exp1": "(hardware.GetExpression())" }, - "setters": { - "dsy_footswitch_led1": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_1, $)", - "dsy_footswitch_led2": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_2, $)", - "dsy_footswitch_led3": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_3, $)", - "dsy_footswitch_led4": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_4, $)" + "outputs": { + "dsy_footswitch_led1": { + "where": "display", + "setter": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_1, $)" + }, + "dsy_footswitch_led2": { + "where": "display", + "setter": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_2, $)" + }, + "dsy_footswitch_led3": { + "where": "display", + "setter": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_3, $)" + }, + "dsy_footswitch_led4": { + "where": "display", + "setter": "hardware.SetFootswitchLed(daisy::DaisyPetal::FOOTSWITCH_LED_4, $)" + } + }, + "mainhandlers": { }, - "setters_audio": {}, - "mainhandlers": {}, "audio_ins": [ "dsy_in1", "dsy_in2" diff --git a/source/daisy.pod.json b/source/daisy.pod.json index 1c1ca23..f7d20ee 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -27,7 +27,7 @@ }, "datas": {} }, - "getters": { + "inputs": { "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_1)", "dsy_knob2": "hardware.GetKnobValue(hardware.KNOB_2)", "dsy_switch1": "(hardware.button1.Pressed()?1.f:0.f)", @@ -35,8 +35,7 @@ "dsy_encoder_incr": "(hardware.encoder.Increment())", "dsy_encoder_switch": "(hardware.encoder.Pressed())" }, - "setters": {}, - "setters_audio": {}, + "outputs": {}, "mainhandlers": {}, "audio_ins": [ "dsy_in1", diff --git a/source/daisy.versio.json b/source/daisy.versio.json index df7f0e8..bfa5673 100644 --- a/source/daisy.versio.json +++ b/source/daisy.versio.json @@ -53,7 +53,7 @@ }, "datas": {} }, - "getters": { + "inputs": { "dsy_knob1": "hardware.GetKnobValue(hardware.KNOB_0)", "dsy_knob2": "hardware.GetKnobValue(hardware.KNOB_1)", "dsy_knob3": "hardware.GetKnobValue(hardware.KNOB_2)", @@ -66,8 +66,7 @@ "dsy_button1": "(hardware.SwitchPressed()?1.f:0.f)", "dsy_gate_in1": "(hardware.Gate()?1.f:0.f)" }, - "setters": {}, - "setters_audio": {}, + "outputs": {}, "mainhandlers": {}, "audio_ins": [ "dsy_in1", diff --git a/source/oopsy.js b/source/oopsy.js index d48d627..a319391 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -318,6 +318,7 @@ function generate_daisy(hardware, nodes, target) { audio_ins: hardware.audio_ins.map((v, i)=>{ let name = `dsy_in${i+1}` nodes[name] = { + name: name, // name: name, // kind: "input_buffer", // index: i, @@ -328,6 +329,7 @@ function generate_daisy(hardware, nodes, target) { audio_outs: hardware.audio_outs.map((v, i)=>{ let name = `dsy_out${i+1}` nodes[name] = { + name: name, // name: name, // kind: "output_buffer", // index: i, @@ -339,6 +341,7 @@ function generate_daisy(hardware, nodes, target) { midi_ins: hardware.midi_ins.map((v, i)=>{ let name = `dsy_midi_in${i+1}` nodes[name] = { + name: name, // buffername: name, // index: i, to: [], @@ -348,6 +351,7 @@ function generate_daisy(hardware, nodes, target) { midi_outs: hardware.midi_outs.map((v, i)=>{ let name = `dsy_midi_out${i+1}` nodes[name] = { + name: name, // buffername: name, // index: i, from: [], @@ -356,40 +360,32 @@ function generate_daisy(hardware, nodes, target) { }), // DEVICE INPUTS: - gpio_ins: Object.keys(hardware.getters).map(v => { + device_inputs: Object.keys(hardware.inputs).map(v => { let name = v nodes[name] = { + name: name, to: [], - get: hardware.getters[v], + get: hardware.inputs[v], } return name; }), // DEVICE OUTPUTS: - gpio_outs: Object.keys(hardware.setters).map(name => { - nodes[name] = { - name: name, - setter: hardware.setters[name], - from: [], - } - return name; - }), - - gpio_outs_audio: Object.keys(hardware.setters_audio).map(name => { + mainhandlers: Object.keys(hardware.mainhandlers).map(name => { nodes[name] = { name: name, - setter: hardware.setters_audio[name], - from: [], + setter: hardware.mainhandlers[name], + data: null, } return name; }), // DEVICE OUTPUTS: - mainhandlers: Object.keys(hardware.mainhandlers).map(name => { + device_outs: Object.keys(hardware.outputs).map(name => { nodes[name] = { name: name, - setter: hardware.mainhandlers[name], - data: null, + config: hardware.outputs[name], + from: [], } return name; }), @@ -547,7 +543,7 @@ function generate_app(app, hardware, target) { // map unused cvs/knobs to unmapped params let upi=0; // unused param index let param = gen.params[upi]; - Object.keys(hardware.getters).forEach(name => { + Object.keys(hardware.inputs).forEach(name => { const node = nodes[name]; if (node.to.length == 0) { //console.log(name, "not mapped") @@ -578,7 +574,7 @@ function generate_app(app, hardware, target) { { let available = [] let i=0 - daisy.gpio_outs.forEach(name => { + daisy.device_outs.forEach(name => { const node = nodes[name]; // does this output have an cv source? if (node.from.length) { @@ -594,8 +590,7 @@ function generate_app(app, hardware, target) { struct App_${name} : public oopsy::App { ${gen.params .filter(name => nodes[name].src) - .concat(daisy.gpio_outs) - .concat(daisy.gpio_outs_audio) + .concat(daisy.device_outs) .map(name=>` float ${name};`).join("")} ${app.audio_outs.map(name=>` @@ -605,8 +600,7 @@ struct App_${name} : public oopsy::App { daisy.gen = ${name}::create(daisy.samplerate, daisy.blocksize); ${gen.params .filter(name => nodes[name].src) - .concat(daisy.gpio_outs) - .concat(daisy.gpio_outs_audio) + .concat(daisy.device_outs) .map(name=>` ${name} = 0.f;`).join("")} } @@ -614,28 +608,34 @@ struct App_${name} : public oopsy::App { void mainloopCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { Daisy& hardware = daisy.hardware; ${name}::State& gen = *(${name}::State *)daisy.gen; - ${daisy.gpio_outs - .filter(name => nodes[name].src || nodes[name].from.length) - .map((name, i)=>` - ${interpolate(nodes[name].setter, nodes[name])};`).join("")} + ${daisy.device_outs.map(name => nodes[name]) + .filter(node => node.src || node.from.length) + .filter(node => node.config.where == "main") + .map(node=>` + ${interpolate(node.config.setter, node)};`).join("")} } void displayCallback(oopsy::GenDaisy& daisy, uint32_t t, uint32_t dt) { Daisy& hardware = daisy.hardware; ${name}::State& gen = *(${name}::State *)daisy.gen; - ${daisy.mainhandlers - .filter(name => nodes[name].data) - .map(name =>` - ${interpolate(nodes[name].setter, nodes[name])};`).join("")} + ${daisy.mainhandlers.map(name => nodes[name]) + .filter(node => node.data) + .map(node =>` + ${interpolate(node.setter, node)};`).join("")} + ${daisy.device_outs.map(name => nodes[name]) + .filter(node => node.src || node.from.length) + .filter(node => node.config.where == "display") + .map(node=>` + ${interpolate(node.config.setter, node)};`).join("")} } void audioCallback(oopsy::GenDaisy& daisy, float **hardware_ins, float **hardware_outs, size_t size) { Daisy& hardware = daisy.hardware; ${name}::State& gen = *(${name}::State *)daisy.gen; - ${daisy.gpio_ins - .filter(name => nodes[name].to.length) - .map(name=>` - float ${name} = ${nodes[name].get};`).join("")} + ${daisy.device_inputs.map(name => nodes[name]) + .filter(node => node.to.length) + .map(node=>` + float ${node.name} = ${node.get};`).join("")} ${gen.params.filter(name => nodes[name].src).map(name=>` // ${nodes[name].label} ${name} = ${nodes[name].src}*${toCfloat(nodes[name].max-nodes[name].min)} + ${toCfloat(nodes[name].min)}; @@ -651,20 +651,16 @@ struct App_${name} : public oopsy::App { // ${gen.audio_outs.map(name=>nodes[name].label).join(", ")}: float * outputs[] = { ${gen.audio_outs.map(name=>nodes[name].src).join(", ")} }; gen.perform(inputs, outputs, size); - ${daisy.gpio_outs - .filter(name => nodes[name].src || nodes[name].from.length > 0) - .map(name => nodes[name].src ? ` - ${name} = ${nodes[name].src};` : ` - ${name} = ${nodes[name].from.map(name=>name+"[size-1]").join(" + ")};`).join("")} - ${daisy.gpio_outs_audio - .filter(name => nodes[name].src || nodes[name].from.length > 0) - .map(name => nodes[name].src ? ` - ${name} = ${nodes[name].src};` : ` - ${name} = ${nodes[name].from.map(name=>name+"[size-1]").join(" + ")};`).join("")} - ${daisy.gpio_outs_audio - .filter(name => nodes[name].src || nodes[name].from.length) - .map((name, i)=>` - ${interpolate(nodes[name].setter, nodes[name])};`).join("")} + ${daisy.device_outs.map(name => nodes[name]) + .filter(node => node.src || node.from.length) + .map(node => node.src ? ` + ${node.name} = ${node.src};` : ` + ${node.name} = ${node.from.map(name=>name+"[size-1]").join(" + ")};`).join("")} + ${daisy.device_outs.map(name => nodes[name]) + .filter(node => node.src || node.from.length) + .filter(node => node.config.where == "audio") + .map(node=>` + ${interpolate(node.config.setter, node)};`).join("")} ${app.has_midi_out ? daisy.midi_outs.map(name=>nodes[name].from.map(name=>` oopsy::midi.postperform(${name}, size);`).join("")).join("") : ''} } diff --git a/templates/oopsy_petal.maxpat b/templates/oopsy_petal.maxpat index 957cb48..b19b1ad 100644 --- a/templates/oopsy_petal.maxpat +++ b/templates/oopsy_petal.maxpat @@ -313,6 +313,42 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-13", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 77.0, 221.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { + "box" : { + "id" : "obj-12", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 77.0, 178.0, 37.0, 22.0 ], + "text" : "noise" + } + + } +, { + "box" : { + "id" : "obj-10", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 77.0, 264.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { "box" : { "id" : "obj-26", "maxclass" : "newobj", @@ -634,6 +670,36 @@ "source" : [ "obj-1", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "order" : 1, + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "order" : 0, + "source" : [ "obj-10", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-12", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-10", 0 ], + "source" : [ "obj-13", 0 ] + } + } , { "patchline" : { @@ -648,6 +714,20 @@ "source" : [ "obj-16", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-10", 1 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 1 ], + "source" : [ "obj-22", 0 ] + } + } , { "patchline" : { From ddbcdf1141c52a9446d1aabff2deeb064df364ef Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 11:27:31 -0500 Subject: [PATCH 43/58] fix for multi-app on petal --- source/daisy.petal.json | 2 +- source/genlib_daisy.h | 43 +++++++++++------------------------- templates/oopsy_patch.maxpat | 15 ++++++++++++- templates/oopsy_petal.maxpat | 21 +++++++++++++++++- 4 files changed, 48 insertions(+), 33 deletions(-) diff --git a/source/daisy.petal.json b/source/daisy.petal.json index bcf33f7..1da51fa 100644 --- a/source/daisy.petal.json +++ b/source/daisy.petal.json @@ -1,5 +1,5 @@ { - "max_apps":1, + "max_apps":8, "defines": { "OOPSY_TARGET_PETAL": 1 }, diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 39efbec..e301400 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -337,6 +337,11 @@ namespace oopsy { midi.mainloop(); #endif + if (menu_button_held_ms > OOPSY_LONG_PRESS_MS) { + // LONG PRESS + is_mode_selecting = 1; + } + // CLEAR DISPLAY #ifdef OOPSY_TARGET_HAS_OLED hardware.display.Fill(false); @@ -349,10 +354,9 @@ namespace oopsy { // has no mode selection is_mode_selecting = 0; #if defined(OOPSY_MULTI_APP) - // multi-app petal is always in menu mode: + // multi-app is always in menu mode: mode = MODE_MENU; #endif - for(int i = 0; i < 8; i++) { float white = (i == app_selecting || menu_button_released); hardware.SetRingLed((daisy::DaisyPetal::RingLed)i, @@ -367,10 +371,9 @@ namespace oopsy { // has no mode selection is_mode_selecting = 0; #if defined(OOPSY_MULTI_APP) - // multi-app petal is always in menu mode: + // multi-app is always in menu mode: mode = MODE_MENU; #endif - for(int i = 0; i < 4; i++) { float white = (i == app_selecting || menu_button_released); hardware.SetLed(i, @@ -381,13 +384,6 @@ namespace oopsy { } #endif //OOPSY_TARGET_VERSIO - if (menu_button_held_ms > OOPSY_LONG_PRESS_MS) { - // LONG PRESS - #ifndef OOPSY_TARGET_PETAL - is_mode_selecting = 1; - #endif - } - // Handle encoder increment actions: if (is_mode_selecting) { mode += menu_button_incr; @@ -424,14 +420,16 @@ namespace oopsy { // SHORT PRESS if (menu_button_released) { + menu_button_released = 0; if (is_mode_selecting) { is_mode_selecting = 0; #ifdef OOPSY_MULTI_APP } else if (mode == MODE_MENU) { if (app_selected != app_selecting) { app_selected = app_selecting; - appdefs[app_selected].load(); mode = mode_default; + appdefs[app_selected].load(); + continue; } #endif #ifdef OOPSY_TARGET_HAS_OLED @@ -440,10 +438,10 @@ namespace oopsy { #endif } } - menu_button_released = 0; + // OLED DISPLAY: + #ifdef OOPSY_TARGET_HAS_OLED switch(mode) { - #ifdef OOPSY_TARGET_HAS_OLED #ifdef OOPSY_MULTI_APP case MODE_MENU: { for (int i=0; i<8; i++) { @@ -533,27 +531,13 @@ namespace oopsy { console_display(); break; } - - #else // !OOPSY_TARGET_HAS_OLED - #ifdef OOPSY_MULTI_APP - case MODE_MENU: { - // TODO show menu selection via LEDs - - } break; - #endif - #endif //OOPSY_TARGET_HAS_OLED default: { } } - if (is_mode_selecting) { - #ifdef OOPSY_TARGET_HAS_OLED hardware.display.DrawRect(0, 0, SSD1309_WIDTH-1, SSD1309_HEIGHT-1, 1); - #endif } - #ifdef OOPSY_TARGET_HAS_OLED - if (mode != MODE_NONE) - { + if (mode != MODE_NONE) { int offset = 0; #ifdef OOPSY_TARGET_USES_MIDI_UART offset += snprintf(console_stats+offset, console_cols-offset, "%c%c", midi.in_active ? '<' : ' ', midi.out_active ? '>' : ' '); @@ -576,7 +560,6 @@ namespace oopsy { hardware.UpdateLeds(); #endif //(OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) - } // uitimer.ready } return 0; diff --git a/templates/oopsy_patch.maxpat b/templates/oopsy_patch.maxpat index 26cf9a7..c8fee48 100644 --- a/templates/oopsy_patch.maxpat +++ b/templates/oopsy_patch.maxpat @@ -802,7 +802,13 @@ } , "patching_rect" : [ 24.0, 267.0, 194.0, 35.0 ], - "text" : "gen~" + "saved_object_attributes" : { + "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/templates/", + "exportname" : "oopsy_patch" + } +, + "text" : "gen~", + "varname" : "oopsy_patch" } } @@ -1016,6 +1022,13 @@ "type" : "gDSP", "implicit" : 1 } +, { + "name" : "oopsy.gate.min.gendsp", + "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", + "patcherrelativepath" : "../code", + "type" : "gDSP", + "implicit" : 1 + } , { "name" : "oopsy.ctrl.smooth3.gendsp", "bootpath" : "~/Documents/Max 8/Packages/oopsy/code", diff --git a/templates/oopsy_petal.maxpat b/templates/oopsy_petal.maxpat index b19b1ad..2400000 100644 --- a/templates/oopsy_petal.maxpat +++ b/templates/oopsy_petal.maxpat @@ -10,7 +10,7 @@ } , "classnamespace" : "box", - "rect" : [ 869.0, 147.0, 496.0, 523.0 ], + "rect" : [ 672.0, 224.0, 496.0, 523.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -313,6 +313,18 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-28", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 628.0, 314.0, 46.0, 22.0 ], + "text" : "cycle 1" + } + + } +, { "box" : { "id" : "obj-13", "maxclass" : "newobj", @@ -728,6 +740,13 @@ "source" : [ "obj-22", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-25", 0 ], + "source" : [ "obj-28", 0 ] + } + } , { "patchline" : { From f4747ef0148535a0be88149c1c60e3edd54f9b63 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 12:17:38 -0500 Subject: [PATCH 44/58] pulse seed LED with PWM according to CPU usage --- source/genlib_daisy.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index e301400..44c098b 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -327,6 +327,9 @@ namespace oopsy { uint32_t t1 = dsy_system_getnow(); dt = t1-t; t = t1; + + // pulse seed LED for status according to CPU usage: + hardware.seed.SetLed((t % 100) <= (0.0001f*audioCpuUs*samplerate/blocksize)); // handle app-level code (e.g. for CV/gate outs) mainloopCallback(t, dt); From c87372dfeffdce980b6fcfa7e60386931514cb5d Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 12:18:50 -0500 Subject: [PATCH 45/58] pulse seed LED with PWM according to CPU usage --- source/genlib_daisy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 44c098b..19f7a00 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -329,7 +329,7 @@ namespace oopsy { t = t1; // pulse seed LED for status according to CPU usage: - hardware.seed.SetLed((t % 100) <= (0.0001f*audioCpuUs*samplerate/blocksize)); + hardware.seed.SetLed((t % 100) <= uint32_t(0.0001f*audioCpuUs*samplerate/blocksize)); // handle app-level code (e.g. for CV/gate outs) mainloopCallback(t, dt); From a841fb86d24ae3f0b927a6d1db651a26557efccd Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 12:23:18 -0500 Subject: [PATCH 46/58] pulse seed LED with PWM according to CPU usage --- source/genlib_daisy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 19f7a00..1dcc8aa 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -329,7 +329,7 @@ namespace oopsy { t = t1; // pulse seed LED for status according to CPU usage: - hardware.seed.SetLed((t % 100) <= uint32_t(0.0001f*audioCpuUs*samplerate/blocksize)); + hardware.seed.SetLed((t % 1000)/10 <= uint32_t(0.0001f*audioCpuUs*samplerate/blocksize)); // handle app-level code (e.g. for CV/gate outs) mainloopCallback(t, dt); From 0c805cafc723fe8cc3b7ace4f33e5c1e4156b9e1 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 12:31:06 -0500 Subject: [PATCH 47/58] silence hardware outs on nullaudiocallback to avoid noise when switching --- source/genlib_daisy.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 1dcc8aa..644e3ae 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -684,6 +684,10 @@ namespace oopsy { void GenDaisy::nullAudioCallback(float **hardware_ins, float **hardware_outs, size_t size) { daisy.nullAudioCallbackRunning = true; + // zero audio outs: + for (int i=0; i Date: Tue, 8 Dec 2020 12:36:15 -0500 Subject: [PATCH 48/58] stay in app menu mode after switching apps on oled devices --- source/genlib_daisy.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 644e3ae..e945822 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -430,7 +430,9 @@ namespace oopsy { } else if (mode == MODE_MENU) { if (app_selected != app_selecting) { app_selected = app_selecting; + #ifndef OOPSY_TARGET_HAS_OLED mode = mode_default; + #endif appdefs[app_selected].load(); continue; } From 83c3100da773f073bb200e213da03d00a55edfed Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 12:45:09 -0500 Subject: [PATCH 49/58] oled shows app selected with inverse text --- source/genlib_daisy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index e945822..97faab2 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -452,11 +452,11 @@ namespace oopsy { for (int i=0; i<8; i++) { if (i == app_selecting) { hardware.display.SetCursor(0, font.FontHeight * i); - hardware.display.WriteString((char *)">", font, true); + hardware.display.WriteString((char *)">", font, i != app_selected); } if (i < app_count) { hardware.display.SetCursor(font.FontWidth, font.FontHeight * i); - hardware.display.WriteString((char *)appdefs[i].name, font, true); + hardware.display.WriteString((char *)appdefs[i].name, font, i != app_selected); } } } break; From 9f54ca63e03d10e25579e3a8f82368f6ba0c3e02 Mon Sep 17 00:00:00 2001 From: stephenhensley Date: Tue, 8 Dec 2020 10:49:03 -0800 Subject: [PATCH 50/58] cleaned up the messiest parts of the verbose console output for Windows. --- source/oopsy.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/oopsy.js b/source/oopsy.js index a319391..83320c6 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -241,16 +241,13 @@ int main(void) { console.log(execSync("make clean", { cwd: build_path }).toString()) // TODO: make this cross-platform: if (os.platform() == "win32") { - //console.log(execSync("set PATH=%PATH%;/usr/local/bin && make", { cwd: build_path }).toString()) - // Gather up make output to run command per line as child process - // TODO: fix the awful output.. let build_cmd = execSync("make -n", { cwd: build_path }).toString().split(os.EOL) build_cmd.forEach(line => { + // Silently execute the commands line-by-line. if (line.length > 0) - console.log(execSync(line, { cwd: build_path }).toString()) + execSync(line, { cwd: build_path }).toString() }) - } else { console.log(execSync("export PATH=$PATH:/usr/local/bin && make", { cwd: build_path }).toString()) } From 75d5c5aa003752f80ef2f97ae9f645dce74e6735 Mon Sep 17 00:00:00 2001 From: stephenhensley Date: Tue, 8 Dec 2020 11:00:19 -0800 Subject: [PATCH 51/58] edited wet param to always be on ctrl1 --- examples/reverb.maxpat | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/reverb.maxpat b/examples/reverb.maxpat index 37cb233..7437c19 100644 --- a/examples/reverb.maxpat +++ b/examples/reverb.maxpat @@ -64,7 +64,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 191.5, 508.0, 337.0, 60.0 ], + "patching_rect" : [ 191.5, 508.0, 337.0, 62.0 ], "text" : "Adapted from the Dattoro reverb gen~ example included with Max, which is based on Jon Dattorro's Effect Design Part 1: Reverberator and Other Filters, located here: https://ccrma.stanford.edu/~dattorro/EffectDesignPart1.pdf" } @@ -113,7 +113,7 @@ } , "classnamespace" : "dsp.gen", - "rect" : [ 739.0, 102.0, 586.0, 703.0 ], + "rect" : [ 739.0, 102.0, 868.0, 840.0 ], "bglocked" : 0, "openinpresentation" : 0, "default_fontsize" : 12.0, @@ -172,8 +172,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 369.0, 585.0, 65.0, 22.0 ], - "text" : "param wet" + "patching_rect" : [ 482.0, 451.666655999999989, 94.0, 22.0 ], + "text" : "param ctrl1_wet" } } @@ -2974,7 +2974,7 @@ , "patching_rect" : [ 24.0, 272.0, 36.0, 22.0 ], "saved_object_attributes" : { - "exportfolder" : "Macintosh HD:/Users/grrrwaaa/Documents/Max 8/Packages/oopsy/examples/", + "exportfolder" : "C:/Users/shensley/Documents/Max 8/Packages/oopsy/examples/", "exportname" : "reverb" } , @@ -2991,7 +2991,7 @@ "maxclass" : "comment", "numinlets" : 1, "numoutlets" : 0, - "patching_rect" : [ 24.0, 26.0, 261.0, 33.0 ], + "patching_rect" : [ 24.0, 26.0, 261.0, 34.0 ], "text" : "Reverb" } From 4c3c256f2b15154b4c5543e89531b7190b76c341 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 14:10:24 -0500 Subject: [PATCH 52/58] first pass at pod LED outs --- source/daisy.pod.json | 14 ++++++- source/genlib_daisy.h | 2 +- templates/oopsy_pod.maxpat | 78 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 88 insertions(+), 6 deletions(-) diff --git a/source/daisy.pod.json b/source/daisy.pod.json index f7d20ee..fd2f48c 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -23,7 +23,10 @@ "press": "dsy_encoder_switch" }, "outs": { + "led1": "dsy_led1", + "led2": "dsy_led2", + "led": "dsy_led1" }, "datas": {} }, @@ -35,7 +38,16 @@ "dsy_encoder_incr": "(hardware.encoder.Increment())", "dsy_encoder_switch": "(hardware.encoder.Pressed())" }, - "outputs": {}, + "outputs": { + "dsy_led1": { + "where": "main", + "setter": "hardware.led1.Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f)" + }, + "dsy_led2": { + "where": "main", + "setter": "hardware.led2.Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f)" + } + }, "mainhandlers": {}, "audio_ins": [ "dsy_in1", diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 97faab2..a65bb4b 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -561,7 +561,7 @@ namespace oopsy { #ifdef OOPSY_TARGET_HAS_OLED hardware.display.Update(); #endif //OOPSY_TARGET_HAS_OLED - #if (OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) + #if (OOPSY_TARGET_POD || OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) hardware.UpdateLeds(); #endif //(OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) diff --git a/templates/oopsy_pod.maxpat b/templates/oopsy_pod.maxpat index c1a9ac5..b547185 100644 --- a/templates/oopsy_pod.maxpat +++ b/templates/oopsy_pod.maxpat @@ -43,8 +43,8 @@ "id" : "obj-1", "maxclass" : "newobj", "numinlets" : 3, - "numoutlets" : 2, - "outlettype" : [ "signal", "signal" ], + "numoutlets" : 4, + "outlettype" : [ "signal", "signal", "signal", "signal" ], "patcher" : { "fileversion" : 1, "appversion" : { @@ -85,6 +85,53 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-20", + "linecount" : 3, + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 225.5, 378.0, 186.0, 47.0 ], + "presentation_linecount" : 6, + "text" : "LED outputs range -1 to 1; where output will be green when positive and red when negative" + } + + } +, { + "box" : { + "id" : "obj-16", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 225.5, 313.0, 36.0, 22.0 ], + "text" : "cycle" + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 289.0, 350.0, 61.0, 22.0 ], + "text" : "out 4 led2" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 225.5, 350.0, 61.0, 22.0 ], + "text" : "out 3 led1" + } + + } +, { "box" : { "id" : "obj-10", "linecount" : 4, @@ -244,8 +291,8 @@ "numinlets" : 0, "numoutlets" : 1, "outlettype" : [ "" ], - "patching_rect" : [ 225.5, 96.0, 79.0, 22.0 ], - "text" : "param knob1" + "patching_rect" : [ 225.5, 96.0, 127.0, 22.0 ], + "text" : "param knob1 @max 1" } } @@ -324,6 +371,29 @@ "source" : [ "obj-1", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "order" : 1, + "source" : [ "obj-16", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-15", 0 ], + "order" : 0, + "source" : [ "obj-16", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-16", 0 ], + "source" : [ "obj-2", 0 ] + } + } , { "patchline" : { From 4ba9fbfcb1a1a8dd06278ad3bff8d886ae353620 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 14:11:52 -0500 Subject: [PATCH 53/58] first pass at pod LED outs --- source/genlib_daisy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index a65bb4b..692bfbf 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -349,7 +349,7 @@ namespace oopsy { #ifdef OOPSY_TARGET_HAS_OLED hardware.display.Fill(false); #endif - #ifdef OOPSY_TARGET_PETAL + #ifdef OOPSY_TARGET_PETAL || OOPSY_TARGET_POD hardware.ClearLeds(); #endif From ff02399bf29226e8c1e4e32223ed8511649a57b2 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 14:12:14 -0500 Subject: [PATCH 54/58] first pass at pod LED outs --- source/genlib_daisy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index 692bfbf..a65bb4b 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -349,7 +349,7 @@ namespace oopsy { #ifdef OOPSY_TARGET_HAS_OLED hardware.display.Fill(false); #endif - #ifdef OOPSY_TARGET_PETAL || OOPSY_TARGET_POD + #ifdef OOPSY_TARGET_PETAL hardware.ClearLeds(); #endif From 3ea538dc14a2486206a7ef95086f7edf8748878c Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 14:14:15 -0500 Subject: [PATCH 55/58] first pass at pod LED outs --- source/genlib_daisy.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/genlib_daisy.h b/source/genlib_daisy.h index a65bb4b..f110332 100644 --- a/source/genlib_daisy.h +++ b/source/genlib_daisy.h @@ -561,7 +561,7 @@ namespace oopsy { #ifdef OOPSY_TARGET_HAS_OLED hardware.display.Update(); #endif //OOPSY_TARGET_HAS_OLED - #if (OOPSY_TARGET_POD || OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) + #if (OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) hardware.UpdateLeds(); #endif //(OOPSY_TARGET_PETAL || OOPSY_TARGET_VERSIO) @@ -631,6 +631,9 @@ namespace oopsy { } } #endif + #if (OOPSY_TARGET_POD) + hardware.UpdateLeds(); + #endif } #ifdef OOPSY_TARGET_HAS_OLED From e80c6b7e0dd46681feefda0babe2026a612df38b Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 14:14:59 -0500 Subject: [PATCH 56/58] first pass at pod LED outs --- source/daisy.pod.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/daisy.pod.json b/source/daisy.pod.json index fd2f48c..fa258cf 100644 --- a/source/daisy.pod.json +++ b/source/daisy.pod.json @@ -40,11 +40,11 @@ }, "outputs": { "dsy_led1": { - "where": "main", + "where": "audio", "setter": "hardware.led1.Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f)" }, "dsy_led2": { - "where": "main", + "where": "audio", "setter": "hardware.led2.Set(clamp(-$, 0.f, 1.f), clamp($, 0.f, 1.f), 0.f)" } }, From b29beb1d9db27fe3a12b0becf00ac988c0e18493 Mon Sep 17 00:00:00 2001 From: Graham Wakefield Date: Tue, 8 Dec 2020 14:25:35 -0500 Subject: [PATCH 57/58] cleanup --- source/oopsy.js | 1 - templates/oopsy_pod.maxpat | 30 ++++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/source/oopsy.js b/source/oopsy.js index 83320c6..e973348 100755 --- a/source/oopsy.js +++ b/source/oopsy.js @@ -239,7 +239,6 @@ int main(void) { try { try { console.log(execSync("make clean", { cwd: build_path }).toString()) - // TODO: make this cross-platform: if (os.platform() == "win32") { // Gather up make output to run command per line as child process let build_cmd = execSync("make -n", { cwd: build_path }).toString().split(os.EOL) diff --git a/templates/oopsy_pod.maxpat b/templates/oopsy_pod.maxpat index b547185..dd07a4d 100644 --- a/templates/oopsy_pod.maxpat +++ b/templates/oopsy_pod.maxpat @@ -85,6 +85,18 @@ "subpatcher_template" : "", "assistshowspatchername" : 0, "boxes" : [ { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 284.5, 315.0, 29.5, 22.0 ], + "text" : "*" + } + + } +, { "box" : { "id" : "obj-20", "linecount" : 3, @@ -104,7 +116,7 @@ "numinlets" : 1, "numoutlets" : 2, "outlettype" : [ "", "" ], - "patching_rect" : [ 225.5, 313.0, 36.0, 22.0 ], + "patching_rect" : [ 225.5, 284.0, 36.0, 22.0 ], "text" : "cycle" } @@ -371,6 +383,13 @@ "source" : [ "obj-1", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-21", 1 ], + "source" : [ "obj-14", 0 ] + } + } , { "patchline" : { @@ -382,7 +401,7 @@ } , { "patchline" : { - "destination" : [ "obj-15", 0 ], + "destination" : [ "obj-21", 0 ], "order" : 0, "source" : [ "obj-16", 0 ] } @@ -394,6 +413,13 @@ "source" : [ "obj-2", 0 ] } + } +, { + "patchline" : { + "destination" : [ "obj-15", 0 ], + "source" : [ "obj-21", 0 ] + } + } , { "patchline" : { From f482b910dfd362d8e46783a03f1b6daa22f80fef Mon Sep 17 00:00:00 2001 From: stephenhensley Date: Tue, 8 Dec 2020 11:30:07 -0800 Subject: [PATCH 58/58] updated ref for libdaisy to latest master. --- source/libdaisy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libdaisy b/source/libdaisy index 09be57b..a2f2c78 160000 --- a/source/libdaisy +++ b/source/libdaisy @@ -1 +1 @@ -Subproject commit 09be57b1bd70321f309be332a44b8bf230799e62 +Subproject commit a2f2c780f6ce52d124d1b1286cc52507326390d6