Skip to content

Commit

Permalink
reset instrument names on execution
Browse files Browse the repository at this point in the history
  • Loading branch information
tmhglnd committed Aug 4, 2023
1 parent c12d65c commit 5ee9c4c
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 27 deletions.
17 changes: 12 additions & 5 deletions mercury_ide/code/mercury.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,10 @@ function mainParse(lines){
lines = lines.map(x => x.replace(/^\s+|\s+$/g, ''));
*/

// store rings and rest of code separately
// store rings, rest of code and parsed separately
let rings = [];
let other = [];
let parsed = [];

// regular expression to match rings/debug/seed/scale/tempo
let ring = /(ring\ |list\ |array\ ).+/;
Expand Down Expand Up @@ -628,8 +629,6 @@ function mainParse(lines){
params[0] = mapFunc(params[0]);
mainFunc.call(handlers, ...params);
}
// output the new variables dictionary
max.outlet(dict.items);

// max.post('code', other);
for (let o in other){
Expand Down Expand Up @@ -664,7 +663,9 @@ function mainParse(lines){
max.post('WARNING: '+expr.join(' ')+' needs at least 1 more argument');
} else {
post('@code', expr);
max.outlet('parsed', ...expr);
// stored in array with all parsed lines to be output at the end
parsed.push(expr);
// max.outlet('parsed', ...expr);
}

/*
Expand Down Expand Up @@ -749,7 +750,13 @@ function mainParse(lines){
post('@ast', def);
}*/
}

// output the new variables dictionary
max.outlet(dict.items);
// output the parsed lines
parsed.forEach((p) => {
max.outlet('parsed', ...p);
});
// done with parsing
max.outlet('done');

time = Date.now() - time;
Expand Down
6 changes: 3 additions & 3 deletions mercury_ide/patchers/_mercury_main.maxpat
Original file line number Diff line number Diff line change
Expand Up @@ -49384,6 +49384,8 @@
"saved_object_attributes" : {
"autostart" : 1,
"defer" : 0,
"node_bin_path" : "",
"npm_bin_path" : "",
"watch" : 1
}
,
Expand Down Expand Up @@ -52732,7 +52734,7 @@
, {
"box" : {
"id" : "obj-284",
"items" : [ "AU DLS Synth 1", ",", "IAC Driver Bus 1", ",", "M4", ",", "from Max 1", ",", "from Max 2" ],
"items" : [ "AU DLS Synth 1", ",", "IAC Driver Bus 1", ",", "from Max 1", ",", "from Max 2", ",", "PreSonus Studio 26" ],
"maxclass" : "umenu",
"numinlets" : 1,
"numoutlets" : 3,
Expand Down Expand Up @@ -56443,8 +56445,6 @@
"saved_object_attributes" : {
"autostart" : 0,
"defer" : 1,
"node_bin_path" : "",
"npm_bin_path" : "",
"watch" : 1
}
,
Expand Down
91 changes: 72 additions & 19 deletions mercury_ide/patchers/soundObject.maxpat
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,42 @@
"subpatcher_template" : "",
"assistshowspatchername" : 0,
"boxes" : [ {
"box" : {
"id" : "obj-78",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "no_name" ],
"patching_rect" : [ 324.666671999999892, 108.0, 65.0, 22.0 ],
"text" : "t no_name"
}

}
, {
"box" : {
"id" : "obj-77",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "no_group" ],
"patching_rect" : [ 423.416686999999968, 108.0, 66.0, 22.0 ],
"text" : "t no_group"
}

}
, {
"box" : {
"id" : "obj-76",
"maxclass" : "newobj",
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 324.666671999999892, 60.0, 65.0, 22.0 ],
"text" : "r #0_init"
}

}
, {
"box" : {
"id" : "obj-68",
"maxclass" : "newobj",
Expand Down Expand Up @@ -194,8 +230,7 @@
}

}
],
"autosave" : 0
]
}
,
"patching_rect" : [ 45.0, 105.0, 99.0, 22.0 ],
Expand Down Expand Up @@ -22566,7 +22601,7 @@
"numinlets" : 2,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 459.5, 150.0, 41.0, 22.0 ],
"patching_rect" : [ 450.0, 150.0, 41.0, 22.0 ],
"text" : "set $1"
}

Expand All @@ -22578,7 +22613,7 @@
"numinlets" : 1,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 459.5, 179.0, 47.0, 22.0 ],
"patching_rect" : [ 450.0, 179.0, 47.0, 22.0 ],
"text" : "receive"
}

Expand Down Expand Up @@ -23269,7 +23304,7 @@
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 2,
"outlettype" : [ "7342_", "" ],
"outlettype" : [ "7359_", "" ],
"patching_rect" : [ 237.499985000000038, 480.0, 71.0, 22.0 ],
"text" : "t #0_ l"
}
Expand Down Expand Up @@ -28572,7 +28607,7 @@
"numinlets" : 3,
"numoutlets" : 3,
"outlettype" : [ "", "", "" ],
"patching_rect" : [ 398.0, 106.0, 103.0, 22.0 ],
"patching_rect" : [ 398.0, 60.0, 103.0, 22.0 ],
"text" : "route name group"
}

Expand All @@ -28584,7 +28619,7 @@
"numinlets" : 0,
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 398.0, 76.0, 79.0, 22.0 ],
"patching_rect" : [ 398.0, 30.0, 79.0, 22.0 ],
"text" : "r #0_args"
}

Expand Down Expand Up @@ -31748,10 +31783,6 @@
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 235.0, 1455.0, 44.0, 22.0 ],
"saved_object_attributes" : {
"attr_comment" : ""
}
,
"text" : "out~ 2"
}

Expand All @@ -31763,10 +31794,6 @@
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 189.0, 1455.0, 44.0, 22.0 ],
"saved_object_attributes" : {
"attr_comment" : ""
}
,
"text" : "out~ 1"
}

Expand All @@ -31779,10 +31806,6 @@
"numoutlets" : 1,
"outlettype" : [ "" ],
"patching_rect" : [ 169.666672000000005, 30.0, 30.0, 22.0 ],
"saved_object_attributes" : {
"attr_comment" : ""
}
,
"text" : "in 1"
}

Expand Down Expand Up @@ -32766,6 +32789,36 @@
"source" : [ "obj-74", 1 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-77", 0 ],
"order" : 0,
"source" : [ "obj-76", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-78", 0 ],
"order" : 1,
"source" : [ "obj-76", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-97", 0 ],
"source" : [ "obj-77", 0 ]
}

}
, {
"patchline" : {
"destination" : [ "obj-123", 0 ],
"source" : [ "obj-78", 0 ]
}

}
, {
"patchline" : {
Expand Down

0 comments on commit 5ee9c4c

Please sign in to comment.