Add SoundField room planner, copy channel settings and global mute

SoundField (new tab, static/soundfield.js):
- top view of the room with stage, speakers placed by dragging and aimed with a handle,
  type presets, height, coverage, max SPL and DSP output assignment
- level map (tops by energy), sub map with phase at a chosen frequency, timing map
  for delay/fill speakers, audience statistics
- suggestions with one-click apply: aiming, main height, delay line, sub centre cluster
  (power alley), front fills, quick start layout
- delays from the speed of sound and temperature, written to the assigned DSP outputs
- plan stored by the server (shared, part of the settings backup)

Copy channel settings: level/filters/EQ/dynamics/routing to any channels of all connected DSPs.
Mute all: mutes every channel of every connected DSP and unmutes only what was open before,
also on DSPs that reconnect later; works while the app window is locked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-01 22:38:49 +01:00
1 parent ffb6c05d47
commit a7ee66d761
8 files changed
+998 -12

No files matched your search

+74 -4
View File
@@ -61,6 +61,7 @@ const S = {
routeOpen: null, es: null, linkSel: { in: [], out: [] },
lim: { amps: [], assign: {}, ref: {} },
demo: { enabled: false, model: "408" },
muteAll: false,
};
const $ = sel => document.querySelector(sel);
const main = $("#main");
@@ -85,6 +86,7 @@ const ICON = {
back: '<path d="M14 6v4h6v4h-6v4l-7-6z"/>',
lock: '<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',
unlock: '<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 7.5-2"/>',
muteall: '<path d="M4 9v6h4l5 4V5L8 9z"/><path d="M16.5 9.5l5 5M21.5 9.5l-5 5"/>',
link: '<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>',
};
@@ -1107,7 +1109,8 @@ function viewChannel(d) {
const redrawPeq = () => { const c = main.querySelector("canvas.curve"); c && drawCurve(c, chans(dev(), k)[i], S.band); };
const li = linkInfo(d, k, i);
const basics = h("div", { class: "card" }, h("h3", {}, t("Channel")),
const basics = h("div", { class: "card" }, h("h3", {}, h("span", { class: "grow" }, t("Channel")),
h("button", { class: "small", onclick: () => copyDialog(d, k, i) }, t("Copy to…"))),
li ? h("p", { class: "info linknote", style: `--lc:${li.color}` }, svgIcon(ICON.link),
" " + t(k === "out" ? "Linked with {list} – changes apply to all of them (except name, routing and mix levels)."
: "Linked with {list} – changes apply to all of them (except the name).", { list: li.group.filter(j => j !== i).map(j => chLabel(k, j)).join(", ") })) : null,
@@ -1532,6 +1535,64 @@ function viewLimiter(d) {
];
}
// ------------------------------------------------------------------ copy channel settings
const COPY_GROUPS = kind => [["level", t("Gain, delay, polarity")], ["filters", t("High / low pass")],
["eq", kind === "in" ? t("PEQ + GEQ") : "PEQ"], ["dynamics", kind === "in" ? "Noise gate" : t("Compressor + limiter")],
...(kind === "out" ? [["routing", t("Routing + mix levels")]] : [])];
async function copyDialog(d, kind, idx) {
const groups = new Set(store.get("dsp.copygroups." + kind)?.split(",").filter(Boolean) || ["eq", "filters", "dynamics"]);
const targets = new Set();
const groupBoxes = COPY_GROUPS(kind).map(([g, label]) => {
const cb = h("input", { type: "checkbox", checked: groups.has(g), onchange: () => cb.checked ? groups.add(g) : groups.delete(g) });
return h("label", { class: "chk" }, cb, label);
});
const devs = S.order.map(id => S.devices[id]).filter(x => x.status === "online" && x.state);
const targetRows = devs.map(x => {
const chips = chans(x, kind).map((_, j) => {
if (x.id === d.id && j === idx) return null;
const key = `${x.id}|${j}`;
const b = h("button", { class: "chip", "aria-pressed": "false",
onclick: () => { const on = !targets.has(key); on ? targets.add(key) : targets.delete(key); b.classList.toggle("on", on); b.setAttribute("aria-pressed", String(on)); } },
chLabel(kind, j) + (chans(x, kind)[j].name ? " · " + chans(x, kind)[j].name : ""));
return b;
}).filter(Boolean);
return h("div", { class: "copydev" }, devs.length > 1 ? h("div", { class: "sub" }, x.name) : null, h("div", { class: "chips" }, chips));
});
const res = await modal({
title: t("Copy {ch} to…", { ch: chTitle(d, kind, idx) }),
body: h("div", { class: "copydlg" }, h("div", { class: "sub" }, t("What")), h("div", { class: "copygroups" }, groupBoxes),
h("div", { class: "sub" }, t("To")), targetRows,
h("p", { class: "info" }, t("The name stays. Linked target channels take the values for their whole group."))),
actions: [{ label: t("Cancel") }, { label: t("Copy"), primary: true, value: () => (groups.size && targets.size ? true : undefined) }],
});
if (!res) return;
store.set("dsp.copygroups." + kind, [...groups].join(","));
try {
const r = await api("POST", "/api/copy", { device: d.id, kind, idx, groups: [...groups],
targets: [...targets].map(k => { const [device, j] = k.split("|"); return { device, idx: +j }; }) });
toast(r.changed ? t("{n} values copied", { n: r.changed }) : t("Nothing to change – the settings are already the same"));
} catch (e) { toast(t("Error: ") + trMsg(e.message)); }
}
// ------------------------------------------------------------------ global mute (all channels of all connected DSPs)
function showMuteAll() {
const b = $("#btn-muteall");
b.classList.toggle("on", !!S.muteAll);
b.title = S.muteAll ? t("All muted – click to unmute what was open before") : t("Mute all channels of all connected DSPs");
b.setAttribute("aria-label", b.title);
b.replaceChildren(...[svgIcon(ICON.muteall), S.muteAll ? h("span", {}, t("MUTED")) : null].filter(Boolean));
}
$("#btn-muteall").addEventListener("click", async () => {
try {
const r = await api("POST", "/api/muteall", { mute: !S.muteAll });
S.muteAll = r.active; showMuteAll();
toast(r.active ? t("All channels muted") : t("Unmuted – channels that were muted before stay muted"));
} catch (e) { toast(t("Error: ") + trMsg(e.message)); }
});
// ------------------------------------------------------------------ audio test (test generator of the DSP)
const testOn = d => !!(d && d.state && d.state.test && d.state.test.source);
@@ -1807,8 +1868,10 @@ function render() {
live.clear();
let content;
const d = dev();
document.body.dataset.view = S.settings || !d ? "settings" : S.view;
if (S.settings || !d) content = viewSettings();
const field = !S.settings && S.view === "soundfield"; // the room plan works without a connected DSP
document.body.dataset.view = field ? "soundfield" : S.settings || !d ? "settings" : S.view;
if (field) content = viewSoundField();
else if (S.settings || !d) content = viewSettings();
else if (d.status !== "online" || !d.state)
content = h("div", { class: "empty" }, h("div", { class: "spinner" + (["loading", "connecting"].includes(d.status) ? "" : " off") }),
d.status === "loading" ? t("Loading the configuration from the DSP…")
@@ -1875,7 +1938,7 @@ $("#btn-lock").addEventListener("click", async () => {
});
// While locked, everything that would change a value is swallowed; navigating and looking still works.
const VIEW_OK = ".chsel, .nav, .strip-head, .xout, .band, [data-view-ok]";
const VIEW_OK = ".chsel, .nav, .strip-head, .xout, .band, #btn-muteall, [data-view-ok]";
for (const type of ["pointerdown", "mousedown", "click", "dblclick", "keydown", "wheel"]) {
document.addEventListener(type, e => {
if (!S.locked || !(e.target instanceof Element)) return;
@@ -1906,6 +1969,8 @@ function connectEvents() {
setDevices(ev.devices);
if (ev.limiter) S.lim = ev.limiter;
if (ev.demo) S.demo = ev.demo;
if (ev.muteall) { S.muteAll = ev.muteall.active; showMuteAll(); }
if (ev.soundfield) S.sf = ev.soundfield;
if (S.demo.enabled && S.devices.demo && !S.devices[S.cur]?.demo) S.cur = "demo";
S.order.forEach(id => maybeAskUnlock(S.devices[id]));
if (!S.order.length) S.settings = true;
@@ -1933,6 +1998,10 @@ function connectEvents() {
maybeAskUnlock(d);
break;
}
case "soundfield":
sfOnRemote(ev.data); break;
case "muteall":
S.muteAll = ev.data.active; showMuteAll(); break;
case "demo":
S.demo = ev.data;
if (!S.demo.enabled && S.cur === "demo") S.cur = S.order.find(id => id !== "demo") || null;
@@ -2042,6 +2111,7 @@ async function startApp() {
}
S.locked = !!a.locked;
showLock();
showMuteAll();
if (S.isApp) S.remote = await api("GET", "/api/remote");
} catch { /* plain web UI */ }
connectEvents();