From f87e6cad70c1e68825db57ef995079f2f5203865 Mon Sep 17 00:00:00 2001 From: Givou Date: Sun, 1 Nov 2026 22:59:38 +0100 Subject: [PATCH] SoundField stacks (top on a distance pole on a sub), DSP selection as drop-down - a top dropped onto a free sub stands on it (same spot, pole height); the stack moves as one, is drawn as one symbol and can be detached in the editor; "+ Stack" and a ground-stack quick start; centre cluster and height suggestions know about stacks - the DSP tabs became one button with a drop-down menu (status dots of the other DSPs), so many devices fit Co-Authored-By: Claude Opus 5.5 --- README.md | 6 ++- server.py | 8 ++++ static/app.js | 44 ++++++++++++----- static/i18n.js | 16 +++++++ static/soundfield.js | 109 ++++++++++++++++++++++++++++++++++++------- static/style.css | 21 ++++++++- 6 files changed, 173 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 5aed1d5..1536717 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ Control both devices at the same time from your phone, tablet or computer – ov ## Features -* **Several devices at once** – switch with the tabs at the top; the model is detected automatically +* **Several devices at once** – pick the DSP from the drop-down at the top (small dots show the status of the others); + the model is detected automatically * **Mixer** – faders, mute and live meters for all inputs and outputs, limiter LED on every output (status read from the DSP) * **Channel** – name, gain, delay, polarity, high/low pass, 8/9-band PEQ with a draggable curve; the curve shows @@ -30,7 +31,8 @@ Control both devices at the same time from your phone, tablet or computer – ov * **Limiter calculator** – enter your amplifiers' datasheet values (power at 8/4/2 Ω, sensitivity or gain), assign outputs, and see the resulting power when the limiter engages, the clipping headroom and the speaker load. "Limit to … W" calculates the threshold. Attack/release presets per band (infra, sub, kick, mid, high) -* **SoundField** – top view of the room: place mains, subs, delays and fills by dragging, see a level map, a sub +* **SoundField** – top view of the room: place mains, subs, delays and fills by dragging (tops can stand on a sub with a + distance pole – drop the top onto the sub), see a level map, a sub map at a chosen frequency (phase-correct, shows cancellation lanes) and a timing map for delay speakers. It suggests aiming, height, delay lines, sub placement and front fills (one click to apply), calculates the delays from the speed of sound and writes them to the assigned DSP outputs diff --git a/server.py b/server.py index 29ad6f0..b797145 100644 --- a/server.py +++ b/server.py @@ -114,7 +114,15 @@ def clean_soundfield(data) -> dict: "spl": _num(s.get("spl"), 80, 160, 128), "tx": _num(s.get("tx"), 0, w, w / 2), "ty": _num(s.get("ty"), 0, d, d / 2), "outs": [o for o in (s.get("outs") or [])[:8] if re.fullmatch(r"[\w-]+:\d{1,2}", str(o))], + "mount": re.sub(r"[^\w-]", "", str(s.get("mount") or ""))[:16], # id of the sub this top stands on (pole) }) + ids = {s["id"]: s for s in speakers} + for s in speakers: # a mount must be an existing sub, and the top stands exactly on it + m = ids.get(s["mount"]) + if not m or m["role"] != "sub" or s["role"] == "sub": + s["mount"] = "" + else: + s["x"], s["y"] = m["x"], m["y"] return { "room": {"w": w, "d": d}, "stage": {"w": _num(stage.get("w"), 0, w, min(8, w)), "d": _num(stage.get("d"), 0, d / 2, 4)}, diff --git a/static/app.js b/static/app.js index b43f264..5883131 100644 --- a/static/app.js +++ b/static/app.js @@ -533,20 +533,38 @@ requestAnimationFrame(meterFrame); // ------------------------------------------------------------------ header / status +// DSP selection: one button with the current DSP, the others in a drop-down menu (room for many devices) function renderTabs() { const tabs = $("#devtabs"); - const order = [...S.order].sort((a, b) => !!S.devices[b].demo - !!S.devices[a].demo); // demo tab first - tabs.replaceChildren(...order.map(id => { - const d = S.devices[id]; - const model = d.detected_model || (d.model !== "auto" ? d.model : ""); - const paused = S.demo.enabled && !d.demo; // demo mode: the real DSPs are disconnected - return h("button", { class: "devtab" + (id === S.cur && !S.settings ? " active" : "") + (paused ? " paused" : "") + (d.demo ? " demo" : ""), - title: paused ? t("Disconnected while demo mode is on") : d.demo ? t("Demo mode – simulated DSP") : `${d.name} · ${where(d)}`, - disabled: paused, onclick: () => { S.cur = id; S.settings = false; store.set("dsp.cur", id); render(); } }, - h("span", { class: "dot " + d.status }), h("span", { class: "dn" }, d.name), - testOn(d) ? h("small", { class: "test-badge" }, "TEST") : d.demo ? h("small", { class: "demo-badge" }, "DEMO") : model ? h("small", {}, model) : null); - })); + const order = [...S.order].sort((a, b) => !!S.devices[b].demo - !!S.devices[a].demo); // demo first const testLock = testOn(dev()); + const badge = d => { + const model = d.detected_model || (d.model !== "auto" ? d.model : ""); + return testOn(d) ? h("small", { class: "test-badge" }, "TEST") : d.demo ? h("small", { class: "demo-badge" }, "DEMO") : model ? h("small", {}, model) : null; + }; + const cur = S.devices[S.cur]; + if (!cur) { + S.devMenu = false; + tabs.replaceChildren(h("button", { class: "devtab devpick", onclick: () => { S.settings = true; render(); } }, h("span", { class: "dn" }, t("Add a DSP…")))); + } else { + const others = order.filter(id => id !== S.cur).slice(0, 8); + const pick = h("button", { class: "devtab devpick" + (S.settings ? "" : " active") + (cur.demo ? " demo" : ""), "aria-haspopup": "listbox", + "aria-expanded": String(!!S.devMenu), title: cur.demo ? t("Demo mode – simulated DSP") : `${cur.name} · ${where(cur)}`, + onclick: e => { e.stopPropagation(); S.devMenu = !S.devMenu; renderTabs(); } }, + h("span", { class: "dot " + cur.status }), h("span", { class: "dn" }, cur.name), badge(cur), + others.length ? h("span", { class: "minidots", "aria-hidden": "true" }, others.map(id => h("i", { class: "dot " + S.devices[id].status }))) : null, + h("span", { class: "chev" }, S.devMenu ? "▴" : "▾")); + const menu = S.devMenu ? h("div", { class: "devmenu", role: "listbox" }, order.map(id => { + const d = S.devices[id], paused = S.demo.enabled && !d.demo; // demo mode: the real DSPs are disconnected + return h("button", { class: "devitem" + (id === S.cur ? " on" : "") + (paused ? " paused" : ""), role: "option", "aria-selected": String(id === S.cur), + disabled: paused || (testLock && id !== S.cur), + title: paused ? t("Disconnected while demo mode is on") : `${d.name} · ${where(d)}`, + onclick: () => { S.devMenu = false; S.cur = id; S.settings = false; store.set("dsp.cur", id); render(); } }, + h("span", { class: "dot " + d.status }), h("span", { class: "dn" }, d.name), + h("span", { class: "where" }, d.demo ? t("simulated") : STATUS_TEXT[d.status] || d.status), badge(d)); + })) : null; + tabs.replaceChildren(...[pick, menu].filter(Boolean)); + } document.body.classList.toggle("testlock", testLock); $("#btn-settings").classList.toggle("on", S.settings); $("#btn-settings").disabled = testLock; @@ -554,8 +572,10 @@ function renderTabs() { b.classList.toggle("active", !S.settings && b.dataset.view === S.view); b.disabled = testLock && b.dataset.view !== "test"; }); - if (testLock) tabs.querySelectorAll(".devtab:not(.active)").forEach(b => (b.disabled = true)); } +// close the DSP menu on a click elsewhere or Escape +document.addEventListener("pointerdown", e => { if (S.devMenu && !e.target.closest("#devtabs")) { S.devMenu = false; renderTabs(); } }); +document.addEventListener("keydown", e => { if (S.devMenu && e.key === "Escape") { S.devMenu = false; renderTabs(); } }); const STATUS_TEXT = { disconnected: t("Disconnected"), connecting: t("Connecting…"), loading: t("Loading configuration…"), locked: t("Locked with a code"), online: "Online", error: t("Error") }; diff --git a/static/i18n.js b/static/i18n.js index f2a1fa7..1f3b673 100644 --- a/static/i18n.js +++ b/static/i18n.js @@ -439,6 +439,22 @@ const DE = { "Colour for {ch}": "Farbe für {ch}", "Linked channels always share their colour.": "Verknüpfte Kanäle teilen sich immer ihre Farbe.", "Default": "Standard", + // SoundField stacks + "Or ground stacks: a sub left and right with the top on a distance pole.": "Oder als Stacks: links und rechts ein Sub mit dem Top auf einer Distanzstange.", + "Stacks": "Stacks", + "Stack": "Stack", + "The tops then stay where they are on their own stands.": "Die Tops bleiben dann auf eigenen Stativen, wo sie sind.", + "{top} now stands on {sub} (distance pole)": "{top} steht jetzt auf {sub} (Distanzstange)", + "Own stand / flown": "Eigenes Stativ / geflogen", + "On a pole on {sub}": "Auf Distanzstange auf {sub}", + "Stand": "Aufstellung", + "Edit {name}": "{name} bearbeiten", + "{top} stands on this sub (distance pole).": "{top} steht auf diesem Sub (Distanzstange).", + "Detach": "Abnehmen", + "Height on the pole (m)": "Höhe auf der Stange (m)", + "Sub with a top on a distance pole": "Sub mit Top auf Distanzstange", + "Add a DSP…": "DSP hinzufügen…", + "simulated": "simuliert", }; const DE_PATTERNS = [ diff --git a/static/soundfield.js b/static/soundfield.js index 1db7f5a..e7d15e4 100644 --- a/static/soundfield.js +++ b/static/soundfield.js @@ -50,6 +50,26 @@ function sfDirectivity(s, x, y) { } const sfLevel = (p, s, x, y) => s.spl - 20 * Math.log10(sfR(p, s, x, y)) + sfDirectivity(s, x, y); +// stacks: a top on a distance pole stands on a sub (same spot, higher up) +const SF_POLE = 1.8; // acoustic centre of a top on a pole, above the sub's +const sfOnSub = (p, s) => s.mount && p.speakers.find(x => x.id === s.mount && x.role === "sub"); +const sfTopOf = (p, sub) => p.speakers.find(x => x.mount === sub.id); +function sfMount(p, top, sub) { + top.mount = sub.id; top.x = sub.x; top.y = sub.y; + top.h = Math.max(top.h, +(sub.h + SF_POLE).toFixed(1)); +} +function sfMoveTo(p, s, x, y) { // move a speaker; a stack moves as one, delay/fill targets move along + const base = sfOnSub(p, s) || s; + const dx = x - base.x, dy = y - base.y; + for (const m of [base, ...p.speakers.filter(t2 => t2.mount === base.id)]) { + m.x = clamp(m.x + dx, 0, p.room.w); m.y = clamp(m.y + dy, 0, p.room.d); + if (m.role === "delay" || m.role === "fill") { m.tx = clamp(m.tx + dx, 0, p.room.w); m.ty = clamp(m.ty + dy, 0, p.room.d); } + } +} +// free sub close to (x, y) a top could be put on +const sfSnapSub = (p, top, x, y) => top.role === "sub" ? null : p.speakers.find(u => u.role === "sub" && Math.hypot(u.x - x, u.y - y) < 0.8 && + (!sfTopOf(p, u) || sfTopOf(p, u) === top)); + function sfSave() { sf.savedAt = Date.now(); clearTimeout(sf.saveTimer); @@ -163,6 +183,15 @@ function sfSuggestions(p) { sfNew(q, "sub18", W / 2, Math.min(D - 1, sd + 0.6), "Sub")); sfAimMains(q); }, t("Quick start")); + add("tip", t("Or ground stacks: a sub left and right with the top on a distance pole."), q => { + const off = Math.max(2, q.stage.w / 2), y = Math.min(D - 1, sd + 0.5); + for (const [x, side] of [[W / 2 - off, "L"], [W / 2 + off, "R"]]) { + const sub = sfNew(q, "sub18", x, y, `Sub ${side}`), top = sfNew(q, "top12", x, y, t(side === "L" ? "Main L" : "Main R")); + sfMount(q, top, sub); + q.speakers.push(sub, top); + } + sfAimMains(q); + }, t("Stacks")); return out; } // 1. aim of the mains: towards ⅔ of the audience depth on the centre line @@ -175,7 +204,8 @@ function sfSuggestions(p) { const fb = h => { const m = mains.map(s => ({ ...s, h })); return sfMainLevel(p, W / 2, sd + 1, m) - sfMainLevel(p, W / 2, D - 1, m); }; const hNow = mains.reduce((a, s) => a + s.h, 0) / mains.length, now = fb(hNow); let best = hNow, bestV = now; - for (let h = 2; h <= 5.01; h += 0.5) { const v = fb(h); if (v < bestV - 0.01) { bestV = v; best = h; } } + const hMax = mains.some(s => sfOnSub(p, s)) ? 3 : 5; // tops on poles: no higher than about 3 m + for (let h = 2; h <= hMax + 0.01; h += 0.5) { const v = fb(h); if (v < bestV - 0.01) { bestV = v; best = h; } } if (best > hNow + 0.3 && now - bestV >= 1.5) add("tip", t("Raise the mains to {h} m: front-to-back difference {a} dB → {b} dB.", { h: best.toFixed(1), a: now.toFixed(1), b: bestV.toFixed(1) }), q => q.speakers.forEach(s => { if (s.role === "main") s.h = best; }), t("Raise")); @@ -199,8 +229,9 @@ function sfSuggestions(p) { const xs = subs.map(s => s.x), spread = Math.max(...xs) - Math.min(...xs), half = sfSpeed(p) / 80 / 2; if (spread > half) add("warn", t("The subs are {m} m apart – at 80 Hz that causes cancellation lanes through the room (power alley). A centre cluster sounds even everywhere.", - { m: spread.toFixed(1) }), q => { + { m: spread.toFixed(1) }) + (subs.some(u => sfTopOf(p, u)) ? " " + t("The tops then stay where they are on their own stands.") : ""), q => { const ss = q.speakers.filter(s => s.role === "sub"); + q.speakers.forEach(s => { s.mount = ""; }); // tops on poles stay where they are, on their own stands ss.forEach((s, i) => Object.assign(s, { x: W / 2 + (i - (ss.length - 1) / 2) * 0.7, y: Math.min(D - 1, sd + 0.6), aim: 0 })); }, t("Centre cluster")); } @@ -238,6 +269,7 @@ function sfNew(q, type, x, y, name) { const s = { id: Math.random().toString(36).slice(2, 10), name: name || sfTypeLabel(type), role: d.role || "main", type, x: clamp(x, 0, q.room.w), y: clamp(y, 0, q.room.d), h: d.h ?? 2, aim: 0, cov: d.cov ?? 90, spl: d.spl ?? 125, outs: [] }; s.tx = s.x; s.ty = Math.min(q.room.d, s.y + 6); + s.mount = ""; return s; } @@ -310,8 +342,14 @@ function sfDraw() { } // speakers (names step aside when boxes stand close together) const labels = []; - for (const s of p.speakers) { - const col = SF_ROLE_COLOR[s.role], sel = s.id === sf.sel, x = X(s.x), y = Y(s.y); + const order = [...p.speakers].sort((a, b) => (b.role === "sub") - (a.role === "sub")); // tops drawn on top of subs + if (sf.snap) { // a top dragged over a free sub: show where it would land + const u = p.speakers.find(x => x.id === sf.snap); + if (u) { g.strokeStyle = "#fff"; g.setLineDash([3, 3]); g.lineWidth = 1.5; g.beginPath(); g.arc(X(u.x), Y(u.y), 18, 0, 2 * Math.PI); g.stroke(); g.setLineDash([]); } + } + for (const s of order) { + const col = SF_ROLE_COLOR[s.role], sel = s.id === sf.sel || (s.role === "sub" && sfTopOf(p, s)?.id === sf.sel), x = X(s.x), y = Y(s.y); + const top = s.role === "sub" && sfTopOf(p, s), onSub = sfOnSub(p, s); if (s.cov < 360) { // coverage wedge const r = Math.max(40, 3 * sc), a0 = Math.PI / 2 - (s.aim + s.cov / 2) * Math.PI / 180, a1 = Math.PI / 2 - (s.aim - s.cov / 2) * Math.PI / 180; g.beginPath(); g.moveTo(x, y); g.arc(x, y, r, a0, a1); g.closePath(); @@ -319,15 +357,18 @@ function sfDraw() { } g.fillStyle = col; g.strokeStyle = sel ? "#fff" : "#0b0c0f"; g.lineWidth = sel ? 2.5 : 1.5; g.beginPath(); - if (s.role === "sub") g.rect(x - 9, y - 9, 18, 18); + if (s.role === "sub") { const r = top ? 12 : 9; g.rect(x - r, y - r, 2 * r, 2 * r); } else { const [dx, dy] = sfDir(s); g.moveTo(x + dx * 11, y + dy * 11); g.lineTo(x - dy * 9 - dx * 7, y + dx * 9 - dy * 7); g.lineTo(x + dy * 9 - dx * 7, y - dx * 9 - dy * 7); g.closePath(); } g.fill(); g.stroke(); + if (onSub) { g.fillStyle = "#0b0c0f"; g.beginPath(); g.arc(x, y, 2.5, 0, 2 * Math.PI); g.fill(); } // the pole + if (top) continue; // the stack is labelled by its top + const label = onSub ? `${s.name} + ${onSub.name}` : s.name; g.fillStyle = "#e8edf3"; g.font = (sel ? "600 " : "") + "11px system-ui"; g.textAlign = "center"; - const lw = g.measureText(s.name).width + 6; + const lw = g.measureText(label).width + 6; let ly = y + 24; for (let k = 0; k < 4 && labels.some(b => Math.abs(b.x - x) < (b.w + lw) / 2 && Math.abs(b.y - ly) < 13); k++) ly = k % 2 ? y + 24 + 13 * (k + 1) / 2 : y - 16 - 13 * k / 2; labels.push({ x, y: ly, w: lw }); - g.fillText(s.name, x, ly); g.textAlign = "start"; + g.fillText(label, x, ly); g.textAlign = "start"; if (sel && s.cov < 360) { // rotation handle const [dx, dy] = sfDir(s), hr = Math.max(34, 1.6 * sc); g.strokeStyle = "#ffffffaa"; g.lineWidth = 1.5; g.beginPath(); g.moveTo(x, y); g.lineTo(x + dx * hr, y + dy * hr); g.stroke(); @@ -366,7 +407,9 @@ function sfHit(px, py) { const [dx, dy] = sfDir(sel), hr = Math.max(34, 1.6 * sc); if (Math.hypot(px - (X(sel.x) + dx * hr), py - (Y(sel.y) + dy * hr)) < 12) return { kind: "rot", s: sel }; } - for (const s of [...p.speakers].reverse()) if (Math.hypot(px - X(s.x), py - Y(s.y)) < 15) return { kind: "move", s }; + const near = p.speakers.filter(s => Math.hypot(px - X(s.x), py - Y(s.y)) < 15); + const hit = near.find(s => s.role !== "sub") || near[near.length - 1]; // a stack is grabbed by its top + if (hit) return { kind: "move", s: hit }; for (const s of p.speakers) if ((s.role === "delay" || s.role === "fill") && Math.hypot(px - X(s.tx), py - Y(s.ty)) < 10) return { kind: "target", s }; if (Math.hypot(px - X(p.ref.x), py - Y(p.ref.y)) < 14) return { kind: "ref" }; return null; @@ -392,7 +435,12 @@ function sfBindCanvas(cv) { if (e.pointerId !== sf.drag.id) return; const p = sfPlan(), [mx, my] = sf.geo.toM(px, py), x = clamp(snap(mx), 0, p.room.w), y = clamp(snap(my), 0, p.room.d); const d = sf.drag; - if (d.kind === "move") { const dx = x - d.s.x, dy = y - d.s.y; d.s.x = x; d.s.y = y; if (d.s.role === "delay" || d.s.role === "fill") { d.s.tx = clamp(snap(d.s.tx + dx), 0, p.room.w); d.s.ty = clamp(snap(d.s.ty + dy), 0, p.room.d); } } + if (d.kind === "move") { + if (d.s.mount && !sfOnSub(p, d.s)) d.s.mount = ""; + sfMoveTo(p, d.s, x, y); + const u = !d.s.mount && sfSnapSub(p, d.s, x, y); + sf.snap = u ? u.id : null; + } else if (d.kind === "rot") { let a = Math.atan2(mx - d.s.x, my - d.s.y) * 180 / Math.PI; if (!e.shiftKey) a = Math.round(a); else a = Math.round(a / 15) * 15; d.s.aim = a; } else if (d.kind === "target") { d.s.tx = x; d.s.ty = y; } else if (d.kind === "ref") { p.ref.x = x; p.ref.y = y; } @@ -401,10 +449,15 @@ function sfBindCanvas(cv) { }); const end = e => { if (!sf.drag || e.pointerId !== sf.drag.id) return; - const moved = sf.drag.moved; + const moved = sf.drag.moved, d = sf.drag; sf.drag = null; + if (sf.snap && d.kind === "move") { // dropped onto a free sub: put it on the pole + const p = sfPlan(), u = p.speakers.find(x => x.id === sf.snap); + if (u) { sfMount(p, d.s, u); toast(t("{top} now stands on {sub} (distance pole)", { top: d.s.name, sub: u.name })); } + } + sf.snap = null; endBusy(); - if (moved) { sfSave(); sfPanels(); } + if (moved) { sfSave(); sfDraw(); sfPanels(); } }; cv.addEventListener("pointerup", end); cv.addEventListener("pointercancel", end); @@ -437,7 +490,7 @@ function sfChange(fn, full = true) { // change the plan from a panel if (full) sfPanels(); } function sfRemove(id) { - sfChange(p => { p.speakers = p.speakers.filter(s => s.id !== id); }); + sfChange(p => { p.speakers = p.speakers.filter(s => s.id !== id); p.speakers.forEach(s => { if (s.mount === id) s.mount = ""; }); }); if (sf.sel === id) { sf.sel = null; sfPanels(); } } @@ -473,18 +526,35 @@ function sfEditor() { return h("button", { class: "chip" + (on ? " on" : ""), "aria-pressed": String(on), onclick: () => sfChange(() => { s.outs = s.outs.includes(key) ? s.outs.filter(x => x !== key) : [...s.outs, key]; }) }, `Out ${o + 1}`); })))); + const base = sfOnSub(p, s), topOn = s.role === "sub" && sfTopOf(p, s); + let stand = null; + if (s.role !== "sub") { // top: free, or on the pole of a sub + const subs = p.speakers.filter(u => u.role === "sub" && (!sfTopOf(p, u) || u.id === s.mount)); + const standSel = h("select", { onchange: () => sfChange(q => { + const u = q.speakers.find(x => x.id === standSel.value); + if (u) sfMount(q, s, u); else { s.mount = ""; sfMoveTo(q, s, clamp(s.x + 1, 0, q.room.w), s.y); } + }) }, h("option", { value: "" }, t("Own stand / flown")), + subs.map(u => h("option", { value: u.id, selected: s.mount === u.id }, t("On a pole on {sub}", { sub: u.name })))); + stand = h("div", { class: "row sfstand" }, h("label", { class: "grow" }, t("Stand"), standSel), + base ? h("button", { class: "small", onclick: () => { sf.sel = base.id; sfRefresh(); } }, t("Edit {name}", { name: base.name })) : null); + } else if (topOn) { + stand = h("div", { class: "row sfstand" }, h("span", { class: "grow info" }, t("{top} stands on this sub (distance pole).", { top: topOn.name })), + h("button", { class: "small", onclick: () => { sf.sel = topOn.id; sfRefresh(); } }, t("Edit {name}", { name: topOn.name })), + h("button", { class: "small", onclick: () => sfChange(q => { topOn.mount = ""; sfMoveTo(q, topOn, clamp(topOn.x + 1, 0, q.room.w), topOn.y); }) }, t("Detach"))); + } return h("div", { class: "card sfedit", style: `--rc:${SF_ROLE_COLOR[s.role]}` }, h("h3", {}, h("span", { class: "dotc" }), h("span", { class: "grow" }, s.name), h("button", { class: "small danger", onclick: () => sfRemove(s.id) }, t("Remove"))), h("div", { class: "sfgrid" }, h("label", { class: "full" }, "Name", name), h("label", {}, t("Type"), typeSel), h("label", {}, t("Role"), roleSel), - h("label", {}, "x (m)", sfNum(s.x, 0.1, up("x", v => clamp(v, 0, p.room.w)))), - h("label", {}, "y (m)", sfNum(s.y, 0.1, up("y", v => clamp(v, 0, p.room.d)))), - h("label", {}, t("Height (m)"), sfNum(s.h, 0.1, up("h", v => clamp(v, 0, 30)))), + h("label", {}, "x (m)", sfNum(s.x, 0.1, v => sfChange(q => sfMoveTo(q, s, clamp(v, 0, q.room.w), s.y)))), + h("label", {}, "y (m)", sfNum(s.y, 0.1, v => sfChange(q => sfMoveTo(q, s, s.x, clamp(v, 0, q.room.d))))), + h("label", {}, base ? t("Height on the pole (m)") : t("Height (m)"), sfNum(s.h, 0.1, up("h", v => clamp(v, 0, 30)))), h("label", {}, t("Aim (°)"), sfNum(s.aim, 1, up("aim", v => ((v + 540) % 360) - 180))), h("label", {}, t("Coverage (°)"), sfNum(s.cov, 5, up("cov", v => clamp(v, 20, 360)))), h("label", {}, t("Max SPL @1 m (dB)"), sfNum(s.spl, 1, up("spl", v => clamp(v, 80, 160))))), + stand, s.role === "delay" || s.role === "fill" ? h("p", { class: "info" }, t("Its delay is aligned at the dashed target point (drag it to the middle of the area this speaker covers).")) : null, h("div", { class: "sub" }, t("DSP outputs")), outs.length ? outs : h("p", { class: "info" }, t("No DSP in the device list yet."))); } @@ -494,6 +564,7 @@ function sfRoomCard() { const set = (fn) => v => sfChange(q => { fn(q, v); for (const s of q.speakers) { s.x = clamp(s.x, 0, q.room.w); s.y = clamp(s.y, 0, q.room.d); s.tx = clamp(s.tx, 0, q.room.w); s.ty = clamp(s.ty, 0, q.room.d); } + for (const s of q.speakers) { const u = sfOnSub(q, s); if (u) { s.x = u.x; s.y = u.y; } } q.ref.x = clamp(q.ref.x, 0, q.room.w); q.ref.y = clamp(q.ref.y, 0, q.room.d); }); return h("div", { class: "card" }, h("h3", {}, t("Room")), @@ -594,7 +665,13 @@ function viewSoundField() { h("div", { class: "card sfmain" }, h("div", { class: "sfbar" }, h("h3", {}, "SoundField"), - h("div", { class: "sfadd" }, addBtn("top12", "main", t("Main")), addBtn("sub18", "sub", "Sub"), addBtn("top12", "delay", "Delay"), addBtn("fill8", "fill", "Fill")), + h("div", { class: "sfadd" }, addBtn("top12", "main", t("Main")), addBtn("sub18", "sub", "Sub"), + h("button", { class: "small", title: t("Sub with a top on a distance pole"), onclick: () => sfChange(q => { + const n = q.speakers.filter(x => x.role === "sub").length + 1, x = clamp(q.room.w / 2 + (n - 1) * 1.5, 0, q.room.w), y = Math.min(q.room.d, q.stage.d + 0.5); + const sub = sfNew(q, "sub18", x, y, `Sub ${n}`), top = sfNew(q, "top12", x, y, `${t("Main")} ${q.speakers.filter(z => z.role === "main").length + 1}`); + sfMount(q, top, sub); q.speakers.push(sub, top); sf.sel = top.id; + }) }, "+ " + t("Stack")), + addBtn("top12", "delay", "Delay"), addBtn("fill8", "fill", "Fill")), h("div", { class: "sfmode" }, modeSeg, hzSel)), cv, h("div", { class: "sffoot" }, sf.panels.legend, sf.panels.readout), h("p", { class: "info" }, t("A planning aid: free field without reflections, coverage from the nominal angle. Check the result by ear or measurement."))), diff --git a/static/style.css b/static/style.css index 93412e8..cacba72 100644 --- a/static/style.css +++ b/static/style.css @@ -67,7 +67,7 @@ label.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; co border-bottom: 1px solid var(--line); } .brand { display: flex; flex: none; } -#devtabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; } +#devtabs { display: flex; gap: 6px; flex: 0 1 auto; min-width: 0; position: relative; } #devtabs::-webkit-scrollbar { display: none; } .devtab { white-space: nowrap; flex: none; max-width: 220px; background: var(--panel); } .devtab .dn { overflow: hidden; text-overflow: ellipsis; } @@ -583,3 +583,22 @@ button.swatch.big:disabled { opacity: .25; cursor: not-allowed; .coldlg .custom { margin-top: 12px; align-items: center; } .coldlg input[type=color] { width: 56px; height: 34px; padding: 2px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); } .coldlg .custom input[type=color] { flex: none; width: 56px; } +.sfstand { align-items: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; } +.sfstand label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); } + +/* ---- DSP drop-down */ +.devpick { max-width: 320px; gap: 8px; } +.devpick .chev { color: var(--dim); font-size: 11px; margin-left: 2px; } +.devpick .minidots { display: inline-flex; gap: 3px; margin-left: 2px; padding-left: 8px; border-left: 1px solid var(--line); } +.devpick .minidots .dot { width: 6px; height: 6px; box-shadow: none; animation: none; } +.devmenu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 280px; max-width: min(420px, 92vw); + max-height: 60vh; overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; + box-shadow: 0 12px 40px #000a; display: flex; flex-direction: column; gap: 4px; } +button.devitem { display: flex; align-items: center; gap: 8px; width: 100%; justify-content: flex-start; text-transform: none; letter-spacing: 0; + font-weight: 500; background: transparent; border-color: transparent; padding: 9px 10px; } +button.devitem:hover:not(:disabled) { background: var(--panel2); } +button.devitem.on { background: var(--panel3); border-color: var(--accent); } +button.devitem .dn { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +button.devitem .where { font-size: 11px; color: var(--dim); } +button.devitem small { font-size: 11px; color: var(--dim); background: var(--panel3); border-radius: 5px; padding: 1px 5px; } +button.devitem.paused, button.devitem:disabled { opacity: .45; cursor: not-allowed; }