gen-rack

Create VCV Rack modules from gen~ exports
Log | Files | Refs | README | LICENSE

commit 4312c5c04496669e3c250ffeb9a4854999f97ab5
parent ee4e60b8992ff5f97f2283015e921fe6a19bc30e
Author: Isabel Kaspriskie <ikaspriskie@gmail.com>
Date:   Sat,  8 May 2021 20:30:04 -0500

more templating

Diffstat:
MTODO.md | 17+++++++----------
Agen/new-project.js | 19+++++++++++++++++++
Agen/new-project.maxpat | 187+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dgen/projects/example/exporter.maxpat | 752-------------------------------------------------------------------------------
Dgen/projects/example/gen-rack.js | 33---------------------------------
Agen/projects/template/builder.js | 36++++++++++++++++++++++++++++++++++++
Agen/projects/template/builder.maxpat | 744+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rgen/projects/example/path-helper.js -> gen/projects/template/path-helper.js | 0
Msrc/plugin.cpp | 5+----
9 files changed, 994 insertions(+), 799 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -1,13 +1,10 @@ - [x] handle dynamic layout for ports and parameters -- [ ] fix crashes (probably due to buffer allocation?) -- [ ] make sure inputs and outputs are scaled properly -- [ ] write generate new project script (copies and renames /gen/_starter directory) +- [x] fix crashes (probably due to buffer allocation?) +- [x] make sure inputs and outputs are scaled properly +- [x] write generate new project script (copies and renames /gen/projects/template directory) - [ ] write post-export script - - [ ] copy and fill in module source code template - - [ ] add to plugin.hpp + - [x] copy and fill in module source code template + - [x] add to plugin.hpp - [ ] add to plugin.cpp - - [ ] update plugin.json - - [ ] run `make install` - [ ] buffer resizing -- [ ] handle sample rate change handling -- [ ] implement inheritance for less templating? -\ No newline at end of file +- [ ] handle sample rate change handling +\ No newline at end of file diff --git a/gen/new-project.js b/gen/new-project.js @@ -0,0 +1,18 @@ +const maxApi = require('max-api'); +const exec = require('child_process'); + +maxApi.addHandlers({ + // copy and rename /gen/projects/example + newProject: async (name) => { + // let cmd = 'cd .. && mkdir ' + name + ' && sleep 1 && cp -R example ' + name; + let cmd = 'cp -R projects/template projects/' + name; + exec.exec(cmd, (error, stdout, stderr) => { + if (error) { + maxApi.post(error); + } + if (stderr) { + maxApi.post(stderr); + } + }); + } +}); +\ No newline at end of file diff --git a/gen/new-project.maxpat b/gen/new-project.maxpat @@ -0,0 +1,187 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 10, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 1007.0, 464.0, 663.0, 445.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", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 171.0, 45.0, 267.0, 20.0 ], + "text" : "Create the gen project in gen/projects/myModule" + } + + } +, { + "box" : { + "id" : "obj-14", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 83.5, 112.0, 63.0, 22.0 ], + "text" : "script stop" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 42.0, 45.0, 127.0, 22.0 ], + "text" : "newProject myModule" + } + + } +, { + "box" : { + "id" : "obj-9", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 83.5, 88.0, 64.0, 22.0 ], + "text" : "script start" + } + + } +, { + "box" : { + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-3", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "n4m.monitor.maxpat", + "numinlets" : 1, + "numoutlets" : 1, + "offset" : [ 0.0, 0.0 ], + "outlettype" : [ "bang" ], + "patching_rect" : [ 240.0, 191.0, 400.0, 220.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 42.0, 159.0, 217.0, 22.0 ], + "saved_object_attributes" : { + "autostart" : 1, + "defer" : 0, + "node_bin_path" : "", + "npm_bin_path" : "", + "watch" : 0 + } +, + "text" : "node.script new-project.js @autostart 1" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-13", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-14", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-2", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-9", 0 ] + } + + } + ], + "dependency_cache" : [ { + "name" : "new-project.js", + "bootpath" : "~/dev/vcv/gen-rack/gen", + "patcherrelativepath" : ".", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "n4m.monitor.maxpat", + "bootpath" : "C74:/packages/Node For Max/patchers/debug-monitor", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "resize_n4m_monitor_patcher.js", + "bootpath" : "C74:/packages/Node For Max/patchers/debug-monitor", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "fit_jweb_to_bounds.js", + "bootpath" : "C74:/packages/Node For Max/patchers/debug-monitor", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} diff --git a/gen/projects/example/exporter.maxpat b/gen/projects/example/exporter.maxpat @@ -1,752 +0,0 @@ -{ - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 10, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "box", - "rect" : [ 564.0, 471.0, 885.0, 491.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-16", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 288.0, 127.0, 93.0, 22.0 ], - "text" : "build myModule" - } - - } -, { - "box" : { - "id" : "obj-15", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 288.0, 101.0, 101.0, 22.0 ], - "text" : "create myModule" - } - - } -, { - "box" : { - "id" : "obj-9", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 249.0, 62.0, 64.0, 22.0 ], - "text" : "script start" - } - - } -, { - "box" : { - "bgmode" : 0, - "border" : 0, - "clickthrough" : 0, - "enablehscroll" : 0, - "enablevscroll" : 0, - "id" : "obj-3", - "lockeddragscroll" : 0, - "maxclass" : "bpatcher", - "name" : "n4m.monitor.maxpat", - "numinlets" : 1, - "numoutlets" : 1, - "offset" : [ 0.0, 0.0 ], - "outlettype" : [ "bang" ], - "patching_rect" : [ 431.0, 204.0, 400.0, 220.0 ], - "viewvisibility" : 1 - } - - } -, { - "box" : { - "id" : "obj-2", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 249.0, 173.0, 201.0, 22.0 ], - "saved_object_attributes" : { - "autostart" : 1, - "defer" : 0, - "node_bin_path" : "", - "npm_bin_path" : "", - "watch" : 0 - } -, - "text" : "node.script gen-rack.js @autostart 1" - } - - } -, { - "box" : { - "bubble" : 1, - "id" : "obj-10", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 120.0, 264.0, 139.0, 24.0 ], - "text" : "Build gen code here" - } - - } -, { - "box" : { - "id" : "obj-8", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 31.5, 86.0, 72.0, 22.0 ], - "text" : "prepend set" - } - - } -, { - "box" : { - "id" : "obj-6", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 31.5, 55.0, 110.0, 22.0 ], - "text" : "loadmess gen-rack" - } - - } -, { - "box" : { - "id" : "obj-5", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 107.5, 214.5, 68.0, 22.0 ], - "text" : "exportcode" - } - - } -, { - "box" : { - "id" : "obj-27", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 10, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "box", - "rect" : [ 1079.0, 348.0, 302.0, 412.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", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "bang" ], - "patching_rect" : [ 112.0, 92.0, 22.0, 22.0 ], - "text" : "t b" - } - - } -, { - "box" : { - "id" : "obj-3", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 112.0, 123.0, 32.0, 22.0 ], - "text" : "path" - } - - } -, { - "box" : { - "id" : "obj-8", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 112.0, 152.0, 67.0, 22.0 ], - "save" : [ "#N", "thispatcher", ";", "#Q", "end", ";" ], - "text" : "thispatcher" - } - - } -, { - "box" : { - "id" : "obj-22", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 72.0, 296.0, 119.0, 22.0 ], - "text" : "prepend exportfolder" - } - - } -, { - "box" : { - "id" : "obj-21", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 26.0, 263.0, 119.0, 22.0 ], - "text" : "prepend exportname" - } - - } -, { - "box" : { - "id" : "obj-19", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 26.0, 156.0, 57.0, 22.0 ], - "text" : "tosymbol" - } - - } -, { - "box" : { - "id" : "obj-18", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 2, - "outlettype" : [ "", "" ], - "patching_rect" : [ 26.0, 125.0, 59.0, 22.0 ], - "text" : "route text" - } - - } -, { - "box" : { - "id" : "obj-15", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 160.0, 189.0, 49.0, 22.0 ], - "text" : "path $1" - } - - } -, { - "box" : { - "id" : "obj-13", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 26.0, 189.0, 55.0, 22.0 ], - "text" : "name $1" - } - - } -, { - "box" : { - "id" : "obj-11", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 26.0, 229.0, 93.0, 22.0 ], - "saved_object_attributes" : { - "filename" : "path-helper.js", - "parameter_enable" : 0 - } -, - "text" : "js path-helper.js" - } - - } -, { - "box" : { - "comment" : "name", - "id" : "obj-25", - "index" : 1, - "maxclass" : "inlet", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 26.0, 29.0, 30.0, 30.0 ] - } - - } -, { - "box" : { - "comment" : "", - "id" : "obj-26", - "index" : 1, - "maxclass" : "outlet", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 26.0, 355.0, 30.0, 30.0 ] - } - - } - ], - "lines" : [ { - "patchline" : { - "destination" : [ "obj-21", 0 ], - "source" : [ "obj-11", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-11", 0 ], - "source" : [ "obj-13", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-11", 0 ], - "source" : [ "obj-15", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-19", 0 ], - "source" : [ "obj-18", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-13", 0 ], - "source" : [ "obj-19", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-3", 0 ], - "source" : [ "obj-2", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-26", 0 ], - "source" : [ "obj-21", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-26", 0 ], - "source" : [ "obj-22", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-18", 0 ], - "order" : 1, - "source" : [ "obj-25", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-2", 0 ], - "order" : 0, - "source" : [ "obj-25", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-8", 0 ], - "source" : [ "obj-3", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-15", 0 ], - "source" : [ "obj-8", 1 ] - } - - } - ] - } -, - "patching_rect" : [ 31.5, 172.0, 79.0, 22.0 ], - "saved_object_attributes" : { - "description" : "", - "digest" : "", - "globalpatchername" : "", - "tags" : "" - } -, - "text" : "p export-help" - } - - } -, { - "box" : { - "id" : "obj-24", - "maxclass" : "comment", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 75.5, 119.5, 39.0, 20.0 ], - "text" : "name" - } - - } -, { - "box" : { - "id" : "obj-17", - "keymode" : 1, - "lines" : 1, - "maxclass" : "textedit", - "numinlets" : 1, - "numoutlets" : 4, - "outlettype" : [ "", "int", "", "" ], - "parameter_enable" : 0, - "patching_rect" : [ 31.5, 141.5, 92.0, 22.0 ], - "text" : "gen-rack", - "wordwrap" : 0 - } - - } -, { - "box" : { - "id" : "obj-7", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 64.5, 214.5, 35.0, 22.0 ], - "text" : "open" - } - - } -, { - "box" : { - "id" : "obj-1", - "maxclass" : "newobj", - "numinlets" : 2, - "numoutlets" : 2, - "outlettype" : [ "signal", "signal" ], - "patcher" : { - "fileversion" : 1, - "appversion" : { - "major" : 8, - "minor" : 1, - "revision" : 10, - "architecture" : "x64", - "modernui" : 1 - } -, - "classnamespace" : "dsp.gen", - "rect" : [ 279.0, 334.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-5", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 301.5, 405.0, 35.0, 22.0 ], - "text" : "out 2" - } - - } -, { - "box" : { - "id" : "obj-1", - "maxclass" : "newobj", - "numinlets" : 0, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 50.0, 14.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" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 176.0, 149.0, 29.5, 22.0 ], - "text" : "+" - } - - } -, { - "box" : { - "id" : "obj-4", - "maxclass" : "newobj", - "numinlets" : 1, - "numoutlets" : 0, - "patching_rect" : [ 56.0, 405.0, 35.0, 22.0 ], - "text" : "out 1" - } - - } - ], - "lines" : [ { - "patchline" : { - "destination" : [ "obj-3", 0 ], - "source" : [ "obj-1", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-3", 1 ], - "source" : [ "obj-2", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-4", 0 ], - "order" : 1, - "source" : [ "obj-3", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-5", 0 ], - "order" : 0, - "source" : [ "obj-3", 0 ] - } - - } - ] - } -, - "patching_rect" : [ 31.5, 264.0, 79.0, 22.0 ], - "saved_object_attributes" : { - "exportfolder" : "C:/Users/Isabel Kaspriskie/dev/vcv/gen-rack/gen/exports/", - "exportname" : "test" - } -, - "text" : "gen~" - } - - } - ], - "lines" : [ { - "patchline" : { - "destination" : [ "obj-2", 0 ], - "source" : [ "obj-15", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-2", 0 ], - "source" : [ "obj-16", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-27", 0 ], - "source" : [ "obj-17", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-3", 0 ], - "source" : [ "obj-2", 1 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-1", 0 ], - "source" : [ "obj-27", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-1", 0 ], - "source" : [ "obj-5", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-8", 0 ], - "source" : [ "obj-6", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-1", 0 ], - "source" : [ "obj-7", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-17", 0 ], - "source" : [ "obj-8", 0 ] - } - - } -, { - "patchline" : { - "destination" : [ "obj-2", 0 ], - "source" : [ "obj-9", 0 ] - } - - } - ], - "dependency_cache" : [ { - "name" : "gen-rack.js", - "bootpath" : "~/dev/vcv/gen-rack/gen/projects/example", - "patcherrelativepath" : ".", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "n4m.monitor.maxpat", - "bootpath" : "C74:/packages/Node For Max/patchers/debug-monitor", - "type" : "JSON", - "implicit" : 1 - } -, { - "name" : "resize_n4m_monitor_patcher.js", - "bootpath" : "C74:/packages/Node For Max/patchers/debug-monitor", - "type" : "TEXT", - "implicit" : 1 - } -, { - "name" : "fit_jweb_to_bounds.js", - "bootpath" : "C74:/packages/Node For Max/patchers/debug-monitor", - "type" : "TEXT", - "implicit" : 1 - } - ], - "autosave" : 0 - } - -} diff --git a/gen/projects/example/gen-rack.js b/gen/projects/example/gen-rack.js @@ -1,32 +0,0 @@ -const maxApi = require('max-api'); -const fs = require('fs'); - -maxApi.addHandlers({ - // Write the .cpp file - create: async (name) => { - let basedir = process.cwd() + '/../../../'; // => /gen-rack - - // Replace GEN_RACK_DISPLAY_NAME with all lowercase name - // Replace GEN_RACK_NAME with name with the first letter capitalized - fs.readFile(basedir + 'src/module.in', 'utf8', function (err, data) { - if (err) { - maxApi.post('Error reading module.in.'); - return; - } - let result = data.split('GEN_RACK_DISPLAY_NAME').join(name.toLowerCase()); - result = result.split('GEN_RACK_NAME').join(name.charAt(0).toUpperCase() + name.slice(1)); - - fs.writeFile(basedir + 'src/' + name + '.cpp', result, 'utf8', function (err) { - if (err) { - maxApi.post('Error writing .cpp'); - } - }) - }); - // TODO - Add to plugin.cpp, plugin.hpp, and plugin.json - }, - - // TODO - Run `make install` - build: async (name) => { - - } -}); -\ No newline at end of file diff --git a/gen/projects/template/builder.js b/gen/projects/template/builder.js @@ -0,0 +1,35 @@ +const maxApi = require('max-api'); +const fs = require('fs'); + +maxApi.addHandlers({ + // Write the .cpp file + create: async (name) => { + let basedir = process.cwd() + '/../../../'; // => /gen-rack + + // Replace GEN_RACK_DISPLAY_NAME with all lowercase name + // Replace GEN_RACK_NAME with name with the first letter capitalized + fs.readFile(basedir + 'src/module.in', 'utf8', function (err, data) { + if (err) { + maxApi.post('Error reading module.in.'); + return; + } + let result = data.split('GEN_RACK_DISPLAY_NAME').join(name.toLowerCase()); + result = result.split('GEN_RACK_NAME').join(name.charAt(0).toUpperCase() + name.slice(1)); + + fs.writeFile(basedir + 'src/' + name + '.cpp', result, 'utf8', function (err) { + if (err) { + maxApi.post('Error writing .cpp'); + } + }); + }); + + let pluginFile = basedir + 'src/plugin.cpp'; + // line before end: + // 'p->addModel(model' + name.charAt(0).toUpperCase() + name.slice(1) + ');'; + + let headerFile = basedir + 'src/plugin.hpp'; + // 'extern Model* model' + name.charAt(0).toUpperCase() + name.slice(1) + ';'; + fs.appendFileSync(headerFile, 'extern Model* model' + name.charAt(0).toUpperCase() + name.slice(1) + ';\n'); + }, + +}); +\ No newline at end of file diff --git a/gen/projects/template/builder.maxpat b/gen/projects/template/builder.maxpat @@ -0,0 +1,744 @@ +{ + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 10, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 1019.0, 468.0, 848.0, 419.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-14", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 249.0, 62.0, 63.0, 22.0 ], + "text" : "script stop" + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 299.0, 102.0, 101.0, 22.0 ], + "text" : "create myModule" + } + + } +, { + "box" : { + "id" : "obj-9", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 249.0, 38.0, 64.0, 22.0 ], + "text" : "script start" + } + + } +, { + "box" : { + "bgmode" : 0, + "border" : 0, + "clickthrough" : 0, + "enablehscroll" : 0, + "enablevscroll" : 0, + "id" : "obj-3", + "lockeddragscroll" : 0, + "maxclass" : "bpatcher", + "name" : "n4m.monitor.maxpat", + "numinlets" : 1, + "numoutlets" : 1, + "offset" : [ 0.0, 0.0 ], + "outlettype" : [ "bang" ], + "patching_rect" : [ 431.0, 166.0, 400.0, 220.0 ], + "viewvisibility" : 1 + } + + } +, { + "box" : { + "id" : "obj-2", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 249.0, 135.0, 190.0, 22.0 ], + "text" : "node.script builder.js @autostart 1" + } + + } +, { + "box" : { + "bubble" : 1, + "id" : "obj-10", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 148.0, 315.0, 139.0, 24.0 ], + "text" : "Build gen code here" + } + + } +, { + "box" : { + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 59.5, 137.0, 72.0, 22.0 ], + "text" : "prepend set" + } + + } +, { + "box" : { + "id" : "obj-6", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 59.5, 106.0, 119.0, 22.0 ], + "text" : "loadmess myModule" + } + + } +, { + "box" : { + "id" : "obj-5", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 135.5, 265.5, 68.0, 22.0 ], + "text" : "exportcode" + } + + } +, { + "box" : { + "id" : "obj-27", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 10, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "box", + "rect" : [ 1079.0, 348.0, 302.0, 412.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", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "bang" ], + "patching_rect" : [ 112.0, 92.0, 22.0, 22.0 ], + "text" : "t b" + } + + } +, { + "box" : { + "id" : "obj-3", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 112.0, 123.0, 32.0, 22.0 ], + "text" : "path" + } + + } +, { + "box" : { + "id" : "obj-8", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 112.0, 152.0, 67.0, 22.0 ], + "save" : [ "#N", "thispatcher", ";", "#Q", "end", ";" ], + "text" : "thispatcher" + } + + } +, { + "box" : { + "id" : "obj-22", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 72.0, 296.0, 119.0, 22.0 ], + "text" : "prepend exportfolder" + } + + } +, { + "box" : { + "id" : "obj-21", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 26.0, 263.0, 119.0, 22.0 ], + "text" : "prepend exportname" + } + + } +, { + "box" : { + "id" : "obj-19", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 26.0, 156.0, 57.0, 22.0 ], + "text" : "tosymbol" + } + + } +, { + "box" : { + "id" : "obj-18", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 26.0, 125.0, 59.0, 22.0 ], + "text" : "route text" + } + + } +, { + "box" : { + "id" : "obj-15", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 160.0, 189.0, 49.0, 22.0 ], + "text" : "path $1" + } + + } +, { + "box" : { + "id" : "obj-13", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 26.0, 189.0, 55.0, 22.0 ], + "text" : "name $1" + } + + } +, { + "box" : { + "id" : "obj-11", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 2, + "outlettype" : [ "", "" ], + "patching_rect" : [ 26.0, 229.0, 93.0, 22.0 ], + "saved_object_attributes" : { + "filename" : "path-helper.js", + "parameter_enable" : 0 + } +, + "text" : "js path-helper.js" + } + + } +, { + "box" : { + "comment" : "name", + "id" : "obj-25", + "index" : 1, + "maxclass" : "inlet", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 26.0, 29.0, 30.0, 30.0 ] + } + + } +, { + "box" : { + "comment" : "", + "id" : "obj-26", + "index" : 1, + "maxclass" : "outlet", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 26.0, 355.0, 30.0, 30.0 ] + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-21", 0 ], + "source" : [ "obj-11", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 0 ], + "source" : [ "obj-13", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-11", 0 ], + "source" : [ "obj-15", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-19", 0 ], + "source" : [ "obj-18", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-13", 0 ], + "source" : [ "obj-19", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-26", 0 ], + "source" : [ "obj-21", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-26", 0 ], + "source" : [ "obj-22", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-18", 0 ], + "order" : 1, + "source" : [ "obj-25", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "order" : 0, + "source" : [ "obj-25", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-8", 0 ], + "source" : [ "obj-3", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-15", 0 ], + "source" : [ "obj-8", 1 ] + } + + } + ] + } +, + "patching_rect" : [ 59.5, 223.0, 79.0, 22.0 ], + "saved_object_attributes" : { + "description" : "", + "digest" : "", + "globalpatchername" : "", + "tags" : "" + } +, + "text" : "p export-help" + } + + } +, { + "box" : { + "id" : "obj-24", + "maxclass" : "comment", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 156.5, 192.5, 39.0, 20.0 ], + "text" : "name" + } + + } +, { + "box" : { + "id" : "obj-17", + "keymode" : 1, + "lines" : 1, + "maxclass" : "textedit", + "numinlets" : 1, + "numoutlets" : 4, + "outlettype" : [ "", "int", "", "" ], + "parameter_enable" : 0, + "patching_rect" : [ 59.5, 192.5, 92.0, 22.0 ], + "text" : "myModule", + "wordwrap" : 0 + } + + } +, { + "box" : { + "id" : "obj-7", + "maxclass" : "message", + "numinlets" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 92.5, 265.5, 35.0, 22.0 ], + "text" : "open" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 2, + "numoutlets" : 2, + "outlettype" : [ "signal", "signal" ], + "patcher" : { + "fileversion" : 1, + "appversion" : { + "major" : 8, + "minor" : 1, + "revision" : 10, + "architecture" : "x64", + "modernui" : 1 + } +, + "classnamespace" : "dsp.gen", + "rect" : [ 279.0, 334.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-5", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 301.5, 405.0, 35.0, 22.0 ], + "text" : "out 2" + } + + } +, { + "box" : { + "id" : "obj-1", + "maxclass" : "newobj", + "numinlets" : 0, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 50.0, 14.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" : 2, + "numoutlets" : 1, + "outlettype" : [ "" ], + "patching_rect" : [ 176.0, 149.0, 29.5, 22.0 ], + "text" : "+" + } + + } +, { + "box" : { + "id" : "obj-4", + "maxclass" : "newobj", + "numinlets" : 1, + "numoutlets" : 0, + "patching_rect" : [ 56.0, 405.0, 35.0, 22.0 ], + "text" : "out 1" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-1", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 1 ], + "source" : [ "obj-2", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-4", 0 ], + "order" : 1, + "source" : [ "obj-3", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-5", 0 ], + "order" : 0, + "source" : [ "obj-3", 0 ] + } + + } + ] + } +, + "patching_rect" : [ 59.5, 315.0, 79.0, 22.0 ], + "saved_object_attributes" : { + "exportfolder" : "C:/Users/Isabel Kaspriskie/dev/vcv/gen-rack/gen/exports/", + "exportname" : "test" + } +, + "text" : "gen~" + } + + } + ], + "lines" : [ { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-14", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-15", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-27", 0 ], + "source" : [ "obj-17", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-3", 0 ], + "source" : [ "obj-2", 1 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-27", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-5", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-8", 0 ], + "source" : [ "obj-6", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-1", 0 ], + "source" : [ "obj-7", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-17", 0 ], + "source" : [ "obj-8", 0 ] + } + + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-9", 0 ] + } + + } + ], + "dependency_cache" : [ { + "name" : "path-helper.js", + "bootpath" : "~/dev/vcv/gen-rack/gen/projects/example", + "patcherrelativepath" : ".", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "n4m.monitor.maxpat", + "bootpath" : "C74:/packages/Node For Max/patchers/debug-monitor", + "type" : "JSON", + "implicit" : 1 + } +, { + "name" : "resize_n4m_monitor_patcher.js", + "bootpath" : "C74:/packages/Node For Max/patchers/debug-monitor", + "type" : "TEXT", + "implicit" : 1 + } +, { + "name" : "fit_jweb_to_bounds.js", + "bootpath" : "C74:/packages/Node For Max/patchers/debug-monitor", + "type" : "TEXT", + "implicit" : 1 + } + ], + "autosave" : 0 + } + +} diff --git a/gen/projects/example/path-helper.js b/gen/projects/template/path-helper.js diff --git a/src/plugin.cpp b/src/plugin.cpp @@ -5,9 +5,6 @@ Plugin* pluginInstance; void init(Plugin* p) { pluginInstance = p; - // Add modules here + // GENRACK: add modules here p->addModel(modelGigaverb); - - // Any other plugin initialization may go here. - // As an alternative, consider lazy-loading assets and lookup tables when your module is created to reduce startup times of Rack. } \ No newline at end of file