feat(matrix): autofill name on load
CI build oscope-of / build-check (push) Has been cancelled

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:
L'électron rare
2026-06-30 09:25:08 +02:00
parent f635240df9
commit ce00b90f43
2 changed files with 13 additions and 2 deletions
+7 -2
View File
@@ -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');
+6
View File
@@ -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"));
});