From 51767ff05834cf638888e65fd393348953c938a4 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 21 Jul 2025 16:14:12 +0200 Subject: [PATCH] setting viewMode directly from Max --- ModEnum.maxpat | 307 +++++++------------------------------------------ lfogui.js | 11 ++ 2 files changed, 52 insertions(+), 266 deletions(-) diff --git a/ModEnum.maxpat b/ModEnum.maxpat index ae80983..d99bcd8 100644 --- a/ModEnum.maxpat +++ b/ModEnum.maxpat @@ -2,42 +2,19 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 6, + "major" : 9, + "minor" : 0, "revision" : 5, "architecture" : "x64", "modernui" : 1 } , "classnamespace" : "box", - "rect" : [ 47.0, 165.0, 884.0, 704.0 ], + "rect" : [ 53.0, 190.0, 1417.0, 704.0 ], "bglocked" : 1, "openinpresentation" : 1, - "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" : 15, - "tallnewobj" : 0, - "boxanimatetime" : 200, - "enablehscroll" : 1, - "enablevscroll" : 1, - "devicewidth" : 0.0, - "description" : "", - "digest" : "", - "tags" : "", - "style" : "", - "subpatcher_template" : "", - "assistshowspatchername" : 0, "boxes" : [ { "box" : { "id" : "obj-5", @@ -76,11 +53,11 @@ "box" : { "id" : "obj-46", "maxclass" : "newobj", - "numinlets" : 3, - "numoutlets" : 3, - "outlettype" : [ "", "", "" ], - "patching_rect" : [ 207.5, 93.827167987823486, 135.0, 22.0 ], - "text" : "routepass param reload" + "numinlets" : 4, + "numoutlets" : 4, + "outlettype" : [ "", "", "", "" ], + "patching_rect" : [ 207.5, 93.827167987823486, 193.0, 22.0 ], + "text" : "routepass param reload viewMode" } } @@ -432,8 +409,8 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 6, + "major" : 9, + "minor" : 0, "revision" : 5, "architecture" : "x64", "modernui" : 1 @@ -441,33 +418,7 @@ , "classnamespace" : "box", "rect" : [ 59.0, 119.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-106", @@ -603,17 +554,11 @@ } } - ] + ], + "originid" : "pat-180" } , "patching_rect" : [ 724.0, 1441.0, 95.0, 22.0 ], - "saved_object_attributes" : { - "description" : "", - "digest" : "", - "globalpatchername" : "", - "tags" : "" - } -, "text" : "p dumpFunction" } @@ -686,8 +631,8 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 6, + "major" : 9, + "minor" : 0, "revision" : 5, "architecture" : "x64", "modernui" : 1 @@ -695,33 +640,7 @@ , "classnamespace" : "box", "rect" : [ 59.0, 119.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-106", @@ -857,17 +776,11 @@ } } - ] + ], + "originid" : "pat-182" } , "patching_rect" : [ 510.0, 1441.0, 95.0, 22.0 ], - "saved_object_attributes" : { - "description" : "", - "digest" : "", - "globalpatchername" : "", - "tags" : "" - } -, "text" : "p dumpFunction" } @@ -939,8 +852,8 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 6, + "major" : 9, + "minor" : 0, "revision" : 5, "architecture" : "x64", "modernui" : 1 @@ -948,33 +861,7 @@ , "classnamespace" : "box", "rect" : [ 59.0, 119.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-106", @@ -1110,17 +997,11 @@ } } - ] + ], + "originid" : "pat-184" } , "patching_rect" : [ 296.0, 1441.0, 95.0, 22.0 ], - "saved_object_attributes" : { - "description" : "", - "digest" : "", - "globalpatchername" : "", - "tags" : "" - } -, "text" : "p dumpFunction" } @@ -1205,8 +1086,8 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 6, + "major" : 9, + "minor" : 0, "revision" : 5, "architecture" : "x64", "modernui" : 1 @@ -1214,33 +1095,7 @@ , "classnamespace" : "box", "rect" : [ 59.0, 119.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-106", @@ -1376,17 +1231,11 @@ } } - ] + ], + "originid" : "pat-186" } , "patching_rect" : [ 82.0, 1441.0, 95.0, 22.0 ], - "saved_object_attributes" : { - "description" : "", - "digest" : "", - "globalpatchername" : "", - "tags" : "" - } -, "text" : "p dumpFunction" } @@ -1656,8 +1505,8 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 6, + "major" : 9, + "minor" : 0, "revision" : 5, "architecture" : "x64", "modernui" : 1 @@ -1665,33 +1514,7 @@ , "classnamespace" : "box", "rect" : [ 59.0, 119.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-12", @@ -1956,17 +1779,11 @@ } } - ] + ], + "originid" : "pat-188" } , "patching_rect" : [ 517.0, 1267.0, 129.0, 22.0 ], - "saved_object_attributes" : { - "description" : "", - "digest" : "", - "globalpatchername" : "", - "tags" : "" - } -, "text" : "p toggle-wave-function" } @@ -2168,8 +1985,8 @@ "patcher" : { "fileversion" : 1, "appversion" : { - "major" : 8, - "minor" : 6, + "major" : 9, + "minor" : 0, "revision" : 5, "architecture" : "x64", "modernui" : 1 @@ -2177,33 +1994,7 @@ , "classnamespace" : "box", "rect" : [ 59.0, 119.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" : { "fontname" : "Arial", @@ -2322,17 +2113,11 @@ } } - ] + ], + "originid" : "pat-190" } , "patching_rect" : [ 619.0, 89.0, 66.0, 22.0 ], - "saved_object_attributes" : { - "description" : "", - "digest" : "", - "globalpatchername" : "", - "tags" : "" - } -, "text" : "p transport" } @@ -2348,18 +2133,6 @@ "patching_rect" : [ 144.0, 1123.0, 24.0, 24.0 ] } - } -, { - "box" : { - "id" : "obj-13", - "maxclass" : "message", - "numinlets" : 2, - "numoutlets" : 1, - "outlettype" : [ "" ], - "patching_rect" : [ 469.0, 170.0, 56.0, 22.0 ], - "text" : "dumpNN" - } - } , { "box" : { @@ -2589,6 +2362,7 @@ } , { "box" : { + "disablefind" : 0, "id" : "obj-2", "maxclass" : "jweb", "numinlets" : 1, @@ -2754,13 +2528,6 @@ "source" : [ "obj-126", 0 ] } - } -, { - "patchline" : { - "destination" : [ "obj-2", 0 ], - "source" : [ "obj-13", 0 ] - } - } , { "patchline" : { @@ -3154,6 +2921,13 @@ "source" : [ "obj-46", 1 ] } + } +, { + "patchline" : { + "destination" : [ "obj-2", 0 ], + "source" : [ "obj-46", 2 ] + } + } , { "patchline" : { @@ -3548,6 +3322,7 @@ } ], + "originid" : "pat-178", "parameters" : { "obj-25" : [ "dict", "dict", 0 ], "parameterbanks" : { diff --git a/lfogui.js b/lfogui.js index 3006427..3a1c2db 100644 --- a/lfogui.js +++ b/lfogui.js @@ -282,6 +282,11 @@ function MasterLfoHandler() { setTicks(event.detail); } + function handleChangeViewMode(event){ + setEnabled(true); + setViewMode(event.detail); + } + function setNN(event) { for (let i = 0; i < MAXLFOS; i++) { @@ -352,6 +357,7 @@ function MasterLfoHandler() { window.addEventListener('userFunction', handleChangeUserFunction); window.addEventListener('userDefinedType', handleChangeUserDefinedType); window.addEventListener('maxTicks', handleMaxTicks); + window.addEventListener('viewMode', handleChangeViewMode); return () => { window.removeEventListener('loadDict', handleLoad); @@ -366,6 +372,7 @@ function MasterLfoHandler() { window.removeEventListener('userFunction', handleChangeUserFunction); window.removeEventListener('userDefinedType', handleChangeUserDefinedType); window.removeEventListener('maxTicks', handleMaxTicks); + window.removeEventListener('viewMode', handleChangeViewMode); }; }, [...allModArrays, ...allEnumArrays, ...allEnumMats, userDefinedWaves, userDefinedFunctions, userDefinedTypes, modCenterVals, render, beatsInMeasure, ticks]); @@ -628,6 +635,10 @@ if (!DEBUG) { window.dispatchEvent(new CustomEvent('userWave', { 'detail': data })); }); + window.max.bindInlet("viewMode", (mode) => { + window.dispatchEvent(new CustomEvent('viewMode', { 'detail': parseInt(mode) })); + }); + window.max.bindInlet("userFunction", (index, ...points) => { //list of 101 points between 0-100 let data = { points, index }; -- 2.45.2