Network search, device ID, max level lock and the Channel settings tab
- network search: probes the local networks for DSPs (TCP 9761, asks for the device info) and adds them with one click - device ID (address byte, 1-250) under the device's advanced settings - the Link tab became "Channel settings": links, max level per channel and channel colours (colours moved here from the device settings); linked channels can't be selected again - max level: software lock for the gain faders, enforced by the server (API, test fader, copy) and the UI; a DSP turned up on the device can only be pulled down until it snaps in - global mute button only turns red (no text) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9473fc9eca
commit
52ecff85ce
8 files changed
+264
-49
No files matched your search
+114
-34
@@ -180,6 +180,12 @@ function custColor(d, kind, i) {
|
||||
return null;
|
||||
}
|
||||
const inColor = (d, i) => custColor(d, "in", i) || IN_COLORS[i];
|
||||
// software max level of a channel's gain (raw), null = none; above it a fader can only go down (see gain_cap in device.py)
|
||||
const maxGain = (d, kind, i) => (d && d.maxgain || {})[kind + i] ?? null;
|
||||
function gainCap(d, kind, i) {
|
||||
const lim = maxGain(d, kind, i);
|
||||
return lim == null ? null : Math.max(lim, chans(d, kind)[i].gain);
|
||||
}
|
||||
const ccStyle = (d, kind, i) => { const c = custColor(d, kind, i) || (kind === "in" ? IN_COLORS[i] : null); return c ? `--cc:${c}` : ""; };
|
||||
|
||||
function getPath(obj, path) {
|
||||
@@ -305,6 +311,7 @@ const sendTimers = new Map(), sendPending = new Map(), recentlySet = new Map();
|
||||
function setParam(kind, idx, param, value) {
|
||||
const d = dev();
|
||||
if (!d || !d.state) return;
|
||||
if (param === "gain") { const c = gainCap(d, kind, idx); if (c != null) value = Math.min(value, c); }
|
||||
setPath(chans(d, kind)[idx], param, value);
|
||||
const key = `${d.id}|${kind}|${idx}|${param}`;
|
||||
recentlySet.set(key, Date.now());
|
||||
@@ -359,6 +366,7 @@ function paramSlider(label, kind, idx, path, specName, onChange) {
|
||||
let dragging = false;
|
||||
const commit = v => {
|
||||
v = clamp(Math.round(v), spec.min, spec.max);
|
||||
if (path === "gain") { const c = gainCap(dev(), kind, idx); if (c != null) v = Math.min(v, c); } // software max level
|
||||
input.value = v;
|
||||
if (v === cur()) return;
|
||||
if (v === spec.zero) buzz();
|
||||
@@ -388,8 +396,10 @@ function paramSlider(label, kind, idx, path, specName, onChange) {
|
||||
const v = await askValue(label, spec, cur());
|
||||
if (v != null) commit(v);
|
||||
});
|
||||
const lim = path === "gain" ? maxGain(dev(), kind, idx) : null;
|
||||
const track = h("div", { class: "rangewrap" },
|
||||
spec.zero != null ? h("div", { class: "zmark", style: `--f:${(spec.zero - spec.min) / (spec.max - spec.min)}` }) : null, input);
|
||||
spec.zero != null ? h("div", { class: "zmark", style: `--f:${(spec.zero - spec.min) / (spec.max - spec.min)}` }) : null,
|
||||
lim != null ? h("div", { class: "limmark", style: `--f:${(lim - spec.min) / (spec.max - spec.min)}`, title: t("Max level") }) : null, input);
|
||||
wrap.append(
|
||||
h("div", { class: "lbl" }, h("span", {}, label),
|
||||
h("div", { class: "valbox" }, stepper(-1, d => commit(cur() + d)), val, stepper(1, d => commit(cur() + d)))),
|
||||
@@ -419,19 +429,21 @@ function toggleBtn(label, kind, idx, path, cls = "", onChange) {
|
||||
|
||||
// Vertical fader: drag the cap (relative), 0-dB detent, double tap on the cap = 0 dB, wheel, keyboard.
|
||||
// Touching the fader anywhere else does nothing, so a swipe there scrolls (e.g. the mixer sideways).
|
||||
function fader({ min, max, value, zero, ticks, label, onInput }) {
|
||||
const cap = h("div", { class: "cap" });
|
||||
function fader({ min, max, value, zero, ticks, label, onInput, cap, limit }) {
|
||||
const capEl = h("div", { class: "cap" });
|
||||
const tickEls = (ticks || []).map(([v, label]) => h("div", { class: "tick" + (v === zero ? " z" : ""), style: `--f:${(v - min) / (max - min)}` }, label ? h("span", {}, label) : null));
|
||||
const el = h("div", { class: "fader", tabindex: "0", role: "slider", "aria-label": label || "Fader",
|
||||
"aria-valuemin": min, "aria-valuemax": max }, h("div", { class: "track" }), tickEls, cap);
|
||||
"aria-valuemin": min, "aria-valuemax": max }, h("div", { class: "track" }), tickEls,
|
||||
limit != null ? h("div", { class: "limmark", style: `--f:${(limit - min) / (max - min)}`, title: t("Max level") }) : null, capEl);
|
||||
let cur = value;
|
||||
const place = () => {
|
||||
cap.style.setProperty("--f", (cur - min) / (max - min));
|
||||
capEl.style.setProperty("--f", (cur - min) / (max - min));
|
||||
el.setAttribute("aria-valuenow", cur);
|
||||
el.classList.toggle("atzero", cur === zero);
|
||||
};
|
||||
const set = (v, snap) => {
|
||||
v = clamp(Math.round(v), min, max);
|
||||
if (cap) { const c = cap(); if (c != null) v = Math.min(v, c); } // software max level
|
||||
if (v === cur) return;
|
||||
if (v === zero && snap !== false) buzz();
|
||||
cur = v; place(); onInput(v);
|
||||
@@ -624,26 +636,6 @@ function maybeAskUnlock(d) {
|
||||
setTimeout(() => unlockDialog(S.devices[d.id] || d), 50);
|
||||
}
|
||||
|
||||
const colorOpen = new Set();
|
||||
function colorSection(d) {
|
||||
const row = (kind, g) => {
|
||||
const c = custColor(d, kind, g[0]), label = g.map(j => chLabel(kind, j)).join(" + ");
|
||||
const name = d.state ? chans(d, kind)[g[0]].name : "";
|
||||
return h("button", { class: "colrow", type: "button", onclick: () => colorDialog(d, kind, g) },
|
||||
h("span", { class: "swatch" + (c ? "" : " none"), style: c ? `background:${c}` : "" }),
|
||||
h("span", { class: "grow" }, label, name ? h("small", {}, name) : null),
|
||||
g.length > 1 ? h("span", { class: "lnk" }, svgIcon(ICON.link)) : null);
|
||||
};
|
||||
const box = h("details", { class: "more full colorbox", open: colorOpen.has(d.id),
|
||||
ontoggle: () => box.open ? colorOpen.add(d.id) : colorOpen.delete(d.id) },
|
||||
h("summary", {}, t("Channel colours")),
|
||||
h("p", { class: "info" }, t("Shown on the mixer strips and in the channel view. Linked channels share one colour; every colour can only be used once per DSP.")),
|
||||
h("div", { class: "colgrid" },
|
||||
h("div", {}, h("div", { class: "sub" }, t("Inputs")), chanGroups(d, "in").map(g => row("in", g))),
|
||||
h("div", {}, h("div", { class: "sub" }, t("Outputs")), chanGroups(d, "out").map(g => row("out", g)))));
|
||||
return box;
|
||||
}
|
||||
|
||||
async function colorDialog(d, kind, members) {
|
||||
// colours already taken by other channels / groups of this DSP (also the hidden ones of linked members,
|
||||
// so no colour turns up twice when a group is dissolved again)
|
||||
@@ -857,6 +849,7 @@ function strip(d, kind, i) {
|
||||
const showDb = v => { db.textContent = sign(gainDb(v)); db.classList.toggle("z", v === 280); };
|
||||
const el = h("div", { class: `strip ${kind}` + (ch.mute ? " muted" : "") + (custColor(d, kind, i) ? " tinted" : ""), style: ccStyle(d, kind, i) });
|
||||
const f = fader({ min: 0, max: 400, value: ch.gain, zero: 280, ticks: GAIN_TICKS, label: `${chLabel(kind, i)} Gain`,
|
||||
cap: () => gainCap(dev(), kind, i), limit: maxGain(d, kind, i),
|
||||
onInput: v => { showDb(v); setParam(kind, i, "gain", v); } });
|
||||
onLive(kind, i, "gain", v => { f.setValue(v); showDb(v); });
|
||||
db.addEventListener("click", async () => {
|
||||
@@ -1324,11 +1317,11 @@ async function saveLinks(d, kind, groups, msg) {
|
||||
|
||||
function linkCard(d, kind) {
|
||||
const list = chans(d, kind), linked = linkedGroups(d, kind);
|
||||
const sel = S.linkSel[kind] = S.linkSel[kind].filter(i => i < list.length);
|
||||
const sel = S.linkSel[kind] = S.linkSel[kind].filter(i => i < list.length && !linkInfo(d, kind, i));
|
||||
const btns = list.map((ch, i) => {
|
||||
const l = linkInfo(d, kind, i), on = sel.includes(i);
|
||||
return h("button", { class: "lkch" + (on ? " sel" : ""), style: l ? `--lc:${l.color}` : "", "aria-pressed": String(on),
|
||||
disabled: S.linkBusy, onclick: () => { S.linkSel[kind] = on ? sel.filter(j => j !== i) : [...sel, i].sort((a, b) => a - b); render(); } },
|
||||
return h("button", { class: "lkch" + (on ? " sel" : "") + (l ? " taken" : ""), style: l ? `--lc:${l.color}` : "", "aria-pressed": String(on),
|
||||
title: l ? t("Already linked – unlink the group first") : "", disabled: S.linkBusy || !!l, onclick: () => { S.linkSel[kind] = on ? sel.filter(j => j !== i) : [...sel, i].sort((a, b) => a - b); render(); } },
|
||||
h("b", {}, chLabel(kind, i)), h("small", {}, ch.name || "\u00a0"),
|
||||
h("span", { class: "lkmark" }, l ? svgIcon(ICON.link) : null));
|
||||
});
|
||||
@@ -1353,11 +1346,64 @@ function linkCard(d, kind) {
|
||||
: h("p", { class: "info" }, t("No channels linked.")));
|
||||
}
|
||||
|
||||
// channel colours of the current DSP: one row per channel or link group
|
||||
function colorCard(d) {
|
||||
const row = (kind, g) => {
|
||||
const c = custColor(d, kind, g[0]), label = g.map(j => chLabel(kind, j)).join(" + "), name = chans(d, kind)[g[0]].name;
|
||||
return h("button", { class: "colrow", type: "button", onclick: () => colorDialog(d, kind, g) },
|
||||
h("span", { class: "swatch" + (c ? "" : " none"), style: c ? `background:${c}` : "" }),
|
||||
h("span", { class: "grow" }, label, name ? h("small", {}, name) : null),
|
||||
g.length > 1 ? h("span", { class: "lnk" }, svgIcon(ICON.link)) : null);
|
||||
};
|
||||
return h("div", { class: "card wide colorbox" }, h("h3", {}, t("Channel colours")),
|
||||
h("p", { class: "info" }, t("Shown on the mixer strips and in the channel view. Linked channels share one colour; every colour can only be used once per DSP.")),
|
||||
h("div", { class: "colgrid" },
|
||||
h("div", {}, h("div", { class: "sub" }, t("Inputs")), chanGroups(d, "in").map(g => row("in", g))),
|
||||
h("div", {}, h("div", { class: "sub" }, t("Outputs")), chanGroups(d, "out").map(g => row("out", g)))));
|
||||
}
|
||||
|
||||
// software max level per channel / link group
|
||||
function maxLevelCard(d) {
|
||||
const save = async next => {
|
||||
try { await api("POST", `/api/devices/${d.id}/maxgain`, { maxgain: next }); }
|
||||
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
|
||||
};
|
||||
const row = (kind, g) => {
|
||||
const lim = maxGain(d, kind, g[0]) ?? 400, label = g.map(j => chLabel(kind, j)).join(" + ");
|
||||
const val = h("span", { class: "mlval" + (lim < 400 ? " on" : "") }, lim < 400 ? `${sign(gainDb(lim))} dB` : t("no limit"));
|
||||
const input = h("input", { type: "range", min: 0, max: 400, step: 1, value: lim, "aria-label": `${label} – ${t("Max level")}` });
|
||||
let timer = null;
|
||||
input.addEventListener("input", () => {
|
||||
const v = +input.value;
|
||||
val.textContent = v < 400 ? `${sign(gainDb(v))} dB` : t("no limit"); val.classList.toggle("on", v < 400);
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => {
|
||||
const next = { ...(d.maxgain || {}) };
|
||||
for (const j of g) { if (v < 400) next[kind + j] = v; else delete next[kind + j]; }
|
||||
save(next);
|
||||
}, 300);
|
||||
});
|
||||
const over = chans(d, kind)[g[0]].gain > lim;
|
||||
return h("div", { class: "mlrow" }, h("span", { class: "mllabel" }, label, g.length > 1 ? h("span", { class: "lnk" }, svgIcon(ICON.link)) : null),
|
||||
input, val, over ? h("small", { class: "mlwarn" }, t("now above – set on the DSP")) : null);
|
||||
};
|
||||
return h("div", { class: "card wide" }, h("h3", {}, t("Max level")),
|
||||
h("p", { class: "info" }, t("Software lock for the gain faders: the app does not let them go higher. If the DSP itself is turned up further, the app shows it and the fader can only be pulled down until it snaps into the limit again.")),
|
||||
h("div", { class: "colgrid" },
|
||||
h("div", {}, h("div", { class: "sub" }, t("Inputs")), chanGroups(d, "in").map(g => row("in", g))),
|
||||
h("div", {}, h("div", { class: "sub" }, t("Outputs")), chanGroups(d, "out").map(g => row("out", g)))));
|
||||
}
|
||||
|
||||
function viewLink(d) {
|
||||
return [h("div", { class: "cards" }, linkCard(d, "in"), linkCard(d, "out")),
|
||||
return [h("h2", { class: "section" }, t("Links")),
|
||||
h("div", { class: "cards" }, linkCard(d, "in"), linkCard(d, "out")),
|
||||
h("p", { class: "info hint" }, t("Linked channels share all settings (gain, delay, filters, EQ, dynamics, mute) – ") +
|
||||
t("a change on one channel applies to the whole group. Name, routing and mix levels stay per channel. ") +
|
||||
t("The link is stored in the DSP and also applies in the Thomann editor."))];
|
||||
t("The link is stored in the DSP and also applies in the Thomann editor.")),
|
||||
h("h2", { class: "section" }, t("Max level")),
|
||||
h("div", { class: "cards" }, maxLevelCard(d)),
|
||||
h("h2", { class: "section" }, t("Colours")),
|
||||
h("div", { class: "cards" }, colorCard(d))];
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ limiter calculator
|
||||
@@ -1686,7 +1732,7 @@ function showMuteAll() {
|
||||
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));
|
||||
b.replaceChildren(svgIcon(ICON.muteall));
|
||||
}
|
||||
$("#btn-muteall").addEventListener("click", async () => {
|
||||
try {
|
||||
@@ -1771,6 +1817,7 @@ function deviceForm(d) {
|
||||
model: h("select", {}, [["auto", t("Automatic")], ["204", "DSP 204"], ["408", "DSP 408"]]
|
||||
.map(([v, label]) => h("option", { value: v, selected: d.model === v }, label))),
|
||||
autoconnect: h("input", { type: "checkbox", checked: d.autoconnect }),
|
||||
addr: h("input", { type: "number", min: 1, max: 250, value: d.addr || 1, class: "short" }),
|
||||
usb: h("select", { "aria-label": t("USB device") }),
|
||||
};
|
||||
let transport = d.transport || "tcp";
|
||||
@@ -1802,7 +1849,7 @@ function deviceForm(d) {
|
||||
setTransport(transport);
|
||||
const values = () => ({ name: f.name.value.trim() || (transport === "usb" ? "DSP (USB)" : f.host.value.trim()),
|
||||
host: f.host.value.trim(), port: +f.port.value || 9761, model: f.model.value, autoconnect: f.autoconnect.checked,
|
||||
transport, usb: f.usb.value });
|
||||
transport, usb: f.usb.value, addr: clamp(Math.round(+f.addr.value || 1), 1, 250) });
|
||||
const actions = isNew
|
||||
? [h("button", { class: "on", onclick: async () => {
|
||||
if (transport === "tcp" && !values().host) return toast(t("IP address missing"));
|
||||
@@ -1835,7 +1882,9 @@ function deviceForm(d) {
|
||||
...netRows, usbRow,
|
||||
h("label", {}, t("Model"), f.model),
|
||||
h("label", { class: "chk" }, f.autoconnect, t("Connect automatically")),
|
||||
isNew ? null : colorSection(d),
|
||||
h("details", { class: "more full" }, h("summary", {}, t("Advanced")),
|
||||
h("label", { class: "inline idrow" }, t("Device ID"), f.addr),
|
||||
h("p", { class: "info" }, t("Only needed if the ID was changed on the DSP (e.g. several DSPs on one RS-485 cable). Default 1."))),
|
||||
isNew ? null : lockSection(d)),
|
||||
h("div", { class: "actions" }, actions));
|
||||
}
|
||||
@@ -1994,18 +2043,49 @@ function langCard() {
|
||||
h("button", { class: k === LANG ? "on" : "", "aria-pressed": String(k === LANG), "data-view-ok": "", onclick: () => set(k) }, label))));
|
||||
}
|
||||
|
||||
async function scanDialog() {
|
||||
const box = h("div", { class: "scanres" }, h("div", { class: "empty small" }, h("div", { class: "spinner" }), t("Searching the network for DSPs…")));
|
||||
const done = modal({ title: t("Search network"), body: box, actions: [{ label: t("Close"), primary: true, value: () => true }] });
|
||||
try {
|
||||
const list = await api("POST", "/api/scan");
|
||||
const used = new Set(S.order.map(id => S.devices[id].host));
|
||||
box.replaceChildren(...(list.length ? list.map(x => {
|
||||
const title = x.model ? `DSP ${x.model}` : t("Unknown device");
|
||||
const add = async b => {
|
||||
b.disabled = true;
|
||||
try {
|
||||
await api("POST", "/api/devices", { name: `${title} (${x.host})`, host: x.host, port: x.port, model: x.model || "auto", autoconnect: true });
|
||||
b.textContent = t("Added"); toast(t("Added"));
|
||||
} catch (e) { toast(trMsg(e.message)); b.disabled = false; }
|
||||
};
|
||||
const btn = h("button", { class: "small on", disabled: !!x.known || used.has(x.host) });
|
||||
btn.textContent = x.known || used.has(x.host) ? t("in the list") : t("Add");
|
||||
btn.onclick = () => add(btn);
|
||||
return h("div", { class: "scanrow" }, h("span", { class: "dot " + (x.busy ? "online" : x.model ? "connecting" : "disconnected") }),
|
||||
h("div", { class: "grow" }, h("b", {}, title), h("small", {}, `${x.host}:${x.port}` + (x.info ? " · " + x.info : "") + (x.busy ? " · " + t("connected") : !x.info ? " · " + t("no answer (another program connected, or a different device ID)") : ""))),
|
||||
btn);
|
||||
}) : [h("p", { class: "info" }, t("No DSP found. Is it in the same network and switched on? Close the Thomann editor – a DSP accepts only one connection."))]));
|
||||
} catch (e) { box.replaceChildren(h("p", { class: "err" }, trMsg(e.message))); }
|
||||
await done;
|
||||
}
|
||||
|
||||
function addDeviceCard() {
|
||||
if (S.addDev) return deviceForm(null);
|
||||
return h("button", { class: "card addcard devadd", onclick: () => { S.addDev = true; render(); } },
|
||||
h("span", { class: "plus" }, "+"), h("b", {}, t("Add a DSP")),
|
||||
h("small", {}, t("Over the network or with a USB cable")));
|
||||
}
|
||||
function scanCard() {
|
||||
return h("button", { class: "card addcard devadd", onclick: scanDialog },
|
||||
h("span", { class: "plus" }, svgIcon('<circle cx="11" cy="11" r="6"/><path d="M20 20l-4.5-4.5"/>')), h("b", {}, t("Search network")),
|
||||
h("small", {}, t("Finds DSPs in your network automatically")));
|
||||
}
|
||||
|
||||
function viewSettings() {
|
||||
const sections = [
|
||||
["general", t("General"), t("Language, demo mode and your logo."), "", [langCard(), demoCard(), logoCard()]],
|
||||
["devices", t("Devices"), t("Several DSPs can be connected at the same time – pick one at the top. A DSP accepts only one connection: close the Thomann editor first."),
|
||||
"wide", [...S.order.filter(id => !S.devices[id].demo).map(id => deviceForm(S.devices[id])), addDeviceCard()]],
|
||||
"wide", [...S.order.filter(id => !S.devices[id].demo).map(id => deviceForm(S.devices[id])), scanCard(), addDeviceCard()]],
|
||||
["access", S.isApp ? t("Remote access") : t("Security"), S.isApp ? t("Let phones and tablets in your network control this computer – they log in with the PIN.") : t("Who may use this web interface."),
|
||||
"wide", [S.isApp ? remoteCard() : null, pinCard()]],
|
||||
["backup", t("Backup"), t("Save and restore the settings of this app."), "wide", [backupCard()]],
|
||||
|
||||
Reference in new issue
Block a user