Emit /matrix/loaded <name> at each user-facing load point (the /matrix/load OSCdef, the queued branch of ~matWrapStep firing at the wrap, and the not-playing fallback in /matrix/loadnext) - not from the shared ~matLoad, to avoid spamming during the boot autoload. The web fills #matrix-name from it, so SAUVER updates the loaded matrix in place. For CHARGER SUIVANT the name tracks the actual swap (at the wrap), never the merely-armed preset. VALIDATE 84/84, test_matnames PASS, node --check + 29 web tests pass.
This commit is contained in:
@@ -410,8 +410,10 @@ File.exists(~matDir).not.if({ ("mkdir -p " ++ ~matDir.quote).systemCmd });
|
||||
// ÉVOLUE mutates it; otherwise evolve mutates as before. --
|
||||
~matWrapStep = {
|
||||
~matQueuedLoad.notNil.if({
|
||||
~matLoad.(~matQueuedLoad);
|
||||
var name = ~matQueuedLoad;
|
||||
~matLoad.(name);
|
||||
~matQueuedLoad = nil;
|
||||
~toscSend !? { ~toscSend.("/matrix/loaded", name) }; // name tracks the actual swap
|
||||
~toscSend !? { ~toscSend.("/matrix/queued", "") };
|
||||
}, {
|
||||
~matEvolve.if({ ~matEvolveStep.() });
|
||||
@@ -961,8 +963,10 @@ OSCdef(\mat_save, { |msg, time, addr|
|
||||
}, '/matrix/save');
|
||||
|
||||
OSCdef(\mat_load, { |msg, time, addr|
|
||||
var name = msg[1].asString;
|
||||
~toscTouch !? { ~toscTouch.(addr) };
|
||||
~matLoad.(msg[1].asString)
|
||||
~matLoad.(name);
|
||||
~toscSend !? { ~toscSend.("/matrix/loaded", name) }; // web: track loaded name
|
||||
}, '/matrix/load');
|
||||
|
||||
OSCdef(\mat_loadnext, { |msg, time, addr|
|
||||
@@ -973,6 +977,7 @@ OSCdef(\mat_loadnext, { |msg, time, addr|
|
||||
~toscSend !? { ~toscSend.("/matrix/queued", name) };
|
||||
}, {
|
||||
~matLoad.(name); // not playing -> load now
|
||||
~toscSend !? { ~toscSend.("/matrix/loaded", name) };
|
||||
~toscSend !? { ~toscSend.("/matrix/queued", "") };
|
||||
});
|
||||
}, '/matrix/loadnext');
|
||||
|
||||
@@ -129,6 +129,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
matLoadNext.textContent = name.length > 0 ? "SUIVANT → " + name : "SUIVANT";
|
||||
}
|
||||
});
|
||||
// A loaded matrix fills the name field, so SAUVER updates it in place.
|
||||
on("/matrix/loaded", (args) => {
|
||||
const name = (args && args[0] != null) ? String(args[0]) : "";
|
||||
const nameInput = document.getElementById("matrix-name");
|
||||
if (nameInput && name.length > 0) nameInput.value = name;
|
||||
});
|
||||
const matRefresh = document.getElementById("matrix-refresh");
|
||||
if (matRefresh) matRefresh.addEventListener("click", () => send("/matrix/list"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user