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
@@ -42,6 +42,11 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
|
||||
with phase at the chosen frequency. Delays: mains/subs aligned at the reference point, delay/fill speakers at their
|
||||
target point plus the precedence offset. The canvas is only redrawn while dragging (never rebuilt), the side panels
|
||||
are rebuilt after a change; the local plan object stays the one being edited (a save does not replace it).
|
||||
* **Max level** – `Device.maxgain` (raw gain per channel, app-side) and `Device.gain_cap`: every gain the server sets
|
||||
(API, test fader, copy) is capped at max(limit, current value), so a DSP turned up on the device can only go down
|
||||
until it is below the limit again. The client mirrors this in `gainCap` (faders, sliders, `setParam`).
|
||||
* **Network search** – `App.scan_network` probes the local /24 networks on TCP 9761 (handshake + device info),
|
||||
skipping DSPs this app is connected to.
|
||||
* **Copy settings / mute all** – `App.copy_settings` (`POST /api/copy`, groups level/filters/eq/dynamics/routing) and
|
||||
`App.set_mute_all` (`POST /api/muteall`; remembers per device which channels were open, persisted in `config.json`
|
||||
as `mute_all`, released devices that were offline are unmuted when they reconnect; allowed while the app is locked).
|
||||
|
||||
@@ -24,7 +24,9 @@ Control both devices at the same time from your phone, tablet or computer – ov
|
||||
sub/top crossover; **EQ Bypass** switches all PEQ bands off at once
|
||||
* **Inputs** – noise gate, 31-band GEQ with **GEQ Bypass** · **Outputs** – compressor, limiter, input routing with mix levels
|
||||
* **Routing matrix**, recall and store presets
|
||||
* **Channel links** – link channels into groups; the DSP mirrors changes within the group, the app shows them live
|
||||
* **Channel settings** tab – link channels into groups (the DSP mirrors changes within the group), set a **max level**
|
||||
per channel (software lock: the fader can't go higher; if the DSP itself is turned up, it can only be pulled down until
|
||||
it snaps into the limit again) and pick channel colours
|
||||
* **Preset files** – export the current DSP state to a file and import it again. An import only changes the active
|
||||
state (stored presets stay untouched), writes only what actually differs and makes an automatic backup first
|
||||
("Undo import")
|
||||
@@ -38,8 +40,10 @@ Control both devices at the same time from your phone, tablet or computer – ov
|
||||
from the speed of sound and writes them to the assigned DSP outputs
|
||||
* **Copy channel settings** – level/delay/polarity, filters, EQ, dynamics and routing from one channel to any number
|
||||
of channels on all connected DSPs
|
||||
* **Channel colours** – pick a colour per channel in the settings (line and lightly tinted name in the mixer, channel view,
|
||||
routing and curve overlays); linked channels share one colour, every colour is used once per DSP
|
||||
* **Channel colours** – line and lightly tinted name in the mixer, channel view, routing and curve overlays; linked
|
||||
channels share one colour, every colour is used once per DSP
|
||||
* **Network search** – finds DSPs in the local network and adds them with one click; the device ID (address byte,
|
||||
default 1) is under the device's advanced settings
|
||||
* **Custom logo** – your own logo top left and as the browser icon (settings → Logo; PNG/JPG/WebP/SVG, ideally square, ≥ 64×64 px)
|
||||
* **Fits every screen** – menu in the top bar on wide screens, a sidebar when the window gets narrow, a bottom bar on phones
|
||||
* **Mute all** – one button mutes every channel of every connected DSP; releasing it unmutes only what was open before
|
||||
|
||||
+12
-2
@@ -22,7 +22,7 @@ class Device:
|
||||
def __init__(self, dev_id: str, name: str, host: str, port: int = P.PORT, model: str = "auto",
|
||||
addr: int = 1, autoconnect: bool = True, on_event=None, transport: str = "tcp", usb: str = "",
|
||||
lock_code: str = "", auto_unlock: bool = False, test_saved: list | None = None,
|
||||
colors: dict | None = None):
|
||||
colors: dict | None = None, maxgain: dict | None = None):
|
||||
self.id = dev_id
|
||||
self.name = name
|
||||
self.host = host
|
||||
@@ -38,6 +38,7 @@ class Device:
|
||||
self.auto_unlock = auto_unlock
|
||||
self.demo = False # in-process simulator of the demo mode, never saved
|
||||
self.colors: dict[str, str] = colors or {} # channel colours chosen in the app, e.g. {"in0": "#38bdf8"}
|
||||
self.maxgain: dict[str, int] = maxgain or {} # software limit of the gain fader per channel (raw), e.g. {"out0": 260}
|
||||
# audio test: output gains from before the test (restored when it ends) and the test fader level
|
||||
self.test_saved: list[int] | None = test_saved if isinstance(test_saved, list) else None
|
||||
self.test_level = -50.0
|
||||
@@ -73,7 +74,7 @@ class Device:
|
||||
"model": self.model_key, "addr": self.addr, "autoconnect": self.autoconnect,
|
||||
"transport": self.transport, "usb": self.usb,
|
||||
"lock_code": self.lock_code, "auto_unlock": self.auto_unlock, "test_saved": self.test_saved,
|
||||
"colors": self.colors}
|
||||
"colors": self.colors, "maxgain": self.maxgain}
|
||||
|
||||
def snapshot(self) -> dict:
|
||||
cfg = self.config()
|
||||
@@ -136,6 +137,15 @@ class Device:
|
||||
await asyncio.sleep(0.3)
|
||||
await self.refresh()
|
||||
|
||||
def gain_cap(self, kind: str, idx: int, value: int) -> int:
|
||||
"""Software limit of a channel's gain: never above the limit - unless the DSP itself is set higher,
|
||||
then only downwards (it snaps back into the limit once it is below)."""
|
||||
lim = self.maxgain.get(f"{kind}{idx}")
|
||||
if lim is None or not self.state:
|
||||
return value
|
||||
cur = self.state["inputs" if kind == "in" else "outputs"][idx]["gain"]
|
||||
return min(value, max(lim, cur))
|
||||
|
||||
@property
|
||||
def test_active(self) -> bool:
|
||||
return bool(self.state and self.state.get("test", {}).get("source"))
|
||||
|
||||
@@ -154,6 +154,17 @@ def clean_colors(v) -> dict:
|
||||
return out
|
||||
|
||||
|
||||
def clean_maxgain(v) -> dict:
|
||||
"""Software gain limits per channel: {"in0": raw 0..399} (400 = +12 dB would be no limit)."""
|
||||
out = {}
|
||||
for k, g in (v.items() if isinstance(v, dict) else []):
|
||||
if re.fullmatch(r"(in|out)\d{1,2}", str(k)):
|
||||
g = int(_num(g, 0, 400, 400))
|
||||
if g < 400:
|
||||
out[str(k)] = g
|
||||
return out
|
||||
|
||||
|
||||
def clean_gains(v) -> list[int] | None:
|
||||
"""Saved output gains of an interrupted audio test (from config.json)."""
|
||||
if not isinstance(v, list) or not v or len(v) > 8:
|
||||
@@ -315,7 +326,8 @@ class App:
|
||||
bool(d.get("autoconnect", True)), on_event=self.broadcast,
|
||||
transport="usb" if usb else "tcp", usb=str(d.get("usb") or ""),
|
||||
lock_code=str(d.get("lock_code") or ""), auto_unlock=bool(d.get("auto_unlock")),
|
||||
test_saved=clean_gains(d.get("test_saved")), colors=clean_colors(d.get("colors")))
|
||||
test_saved=clean_gains(d.get("test_saved")), colors=clean_colors(d.get("colors")),
|
||||
maxgain=clean_maxgain(d.get("maxgain")))
|
||||
dev.on_online = self.device_online
|
||||
self.devices[dev_id] = dev
|
||||
if dev.autoconnect:
|
||||
@@ -334,7 +346,7 @@ class App:
|
||||
dev.test_level = _num(db, -60, TEST_MAX, TEST_LEVEL)
|
||||
raw = P.db_to_gain(dev.test_level)
|
||||
for i in range(len(dev.state["outputs"])):
|
||||
dev.set_param("out", i, "gain", raw)
|
||||
dev.set_param("out", i, "gain", dev.gain_cap("out", i, raw))
|
||||
|
||||
def restore_gains(self, dev: Device):
|
||||
for i, g in enumerate((dev.test_saved or [])[: len(dev.state["outputs"])]):
|
||||
@@ -436,6 +448,8 @@ class App:
|
||||
params += [f"mix.{k}" for k in range(min(len(sch["mix"]), len(tch["mix"])))]
|
||||
for p in params:
|
||||
v = copy.deepcopy(self._get(sch, p))
|
||||
if p == "gain":
|
||||
v = dev.gain_cap(kind, idx, v)
|
||||
if self._get(tch, p) != v:
|
||||
dev.set_param(kind, idx, p, v)
|
||||
changed += 1
|
||||
@@ -472,6 +486,52 @@ class App:
|
||||
except Exception as e: # noqa: BLE001 - connection lost meanwhile: checked again on the next connect
|
||||
log.warning("%s: audio test check failed: %s", dev.name, e)
|
||||
|
||||
# ------------------------------------------------------------ network search
|
||||
|
||||
async def scan_network(self) -> list[dict]:
|
||||
"""Look for DSPs (TCP 9761) in the local /24 networks and ask them who they are.
|
||||
DSPs this app is connected to are skipped: a DSP takes only one connection."""
|
||||
busy = {d.host for d in self.real_devices() if d.transport == "tcp" and d.status in ("connecting", "loading", "locked", "online")}
|
||||
known = {d.host: d for d in self.real_devices() if d.transport == "tcp"}
|
||||
nets = []
|
||||
for ip in local_ips():
|
||||
net = ip.rsplit(".", 1)[0]
|
||||
if not ip.startswith("127.") and net not in nets:
|
||||
nets.append(net)
|
||||
sem = asyncio.Semaphore(96)
|
||||
|
||||
async def probe(ip: str):
|
||||
if ip in busy:
|
||||
d = known[ip]
|
||||
return {"host": ip, "port": P.PORT, "info": d.info, "model": d.model_name or None, "known": d.name, "busy": True}
|
||||
async with sem:
|
||||
try:
|
||||
r, w = await asyncio.wait_for(asyncio.open_connection(ip, P.PORT), 0.7)
|
||||
except (OSError, asyncio.TimeoutError):
|
||||
return None
|
||||
info = ""
|
||||
try:
|
||||
w.write(P.build_frame(P.CMD_HANDSHAKE) + P.build_frame(P.CMD_DEVICE_INFO))
|
||||
await w.drain()
|
||||
parser, end = P.FrameParser(), time.monotonic() + 1.2
|
||||
while not info and time.monotonic() < end:
|
||||
data = await asyncio.wait_for(r.read(512), max(0.05, end - time.monotonic()))
|
||||
if not data:
|
||||
break
|
||||
for f in parser.feed(data):
|
||||
if f.cmd == P.CMD_DEVICE_INFO:
|
||||
info = f.payload.split(b"\x00")[0].decode("latin1", "replace").strip()
|
||||
except (OSError, asyncio.TimeoutError):
|
||||
pass
|
||||
finally:
|
||||
w.close()
|
||||
d = known.get(ip)
|
||||
return {"host": ip, "port": P.PORT, "info": info, "model": P.detect_model(info), "known": d.name if d else "", "busy": False}
|
||||
|
||||
hosts = [f"{net}.{i}" for net in nets[:2] for i in range(1, 255)]
|
||||
found = [x for x in await asyncio.gather(*(probe(h) for h in hosts)) if x]
|
||||
return sorted(found, key=lambda x: tuple(int(p) for p in x["host"].split(".")))
|
||||
|
||||
def real_devices(self) -> list[Device]:
|
||||
return [d for d in self.devices.values() if not d.demo]
|
||||
|
||||
@@ -702,6 +762,8 @@ class App:
|
||||
return self.copy_settings(body)
|
||||
if path == "/api/demo":
|
||||
return await self.set_demo(body) if method == "PUT" else self.demo_info()
|
||||
if path == "/api/scan" and method == "POST":
|
||||
return await self.scan_network()
|
||||
if path == "/api/usb" and method == "GET":
|
||||
return await asyncio.to_thread(usbhid.list_devices)
|
||||
if path == "/api/limiter" and method == "GET":
|
||||
@@ -738,9 +800,10 @@ class App:
|
||||
setattr(dev, "model_key" if k == "model" else k, str(body[k]))
|
||||
if "transport" in body:
|
||||
dev.transport = "usb" if body["transport"] == "usb" else "tcp"
|
||||
for k in ("port", "addr"):
|
||||
if k in body:
|
||||
setattr(dev, k, int(body[k]))
|
||||
if "port" in body:
|
||||
dev.port = int(_num(body["port"], 1, 65535, P.PORT))
|
||||
if "addr" in body: # device ID of the DSP (address byte of every frame)
|
||||
dev.addr = int(_num(body["addr"], 1, 250, 1))
|
||||
if "autoconnect" in body:
|
||||
dev.autoconnect = bool(body["autoconnect"])
|
||||
if "auto_unlock" in body:
|
||||
@@ -761,8 +824,16 @@ class App:
|
||||
await dev.stop()
|
||||
return {"ok": True}
|
||||
if action == "set":
|
||||
dev.set_param(body["kind"], int(body["idx"]), body["param"], body["value"])
|
||||
return {"ok": True}
|
||||
kind, idx, value = body["kind"], int(body["idx"]), body["value"]
|
||||
if body["param"] == "gain":
|
||||
value = dev.gain_cap(kind, idx, int(value)) # software max level
|
||||
dev.set_param(kind, idx, body["param"], value)
|
||||
return {"ok": True, "value": value}
|
||||
if action == "maxgain": # app-side setting, the DSP doesn't know it
|
||||
dev.maxgain = clean_maxgain(body.get("maxgain"))
|
||||
self.save()
|
||||
self.broadcast({"type": "device", "device": dev.id, "data": dev.snapshot()})
|
||||
return {"ok": True, "maxgain": dev.maxgain}
|
||||
if action == "preset/recall":
|
||||
await dev.recall_preset(int(body["index"]))
|
||||
return {"ok": True}
|
||||
|
||||
+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()]],
|
||||
|
||||
@@ -476,6 +476,28 @@ const DE = {
|
||||
"Let phones and tablets in your network control this computer – they log in with the PIN.": "Handys und Tablets im Netzwerk können diesen Computer fernsteuern – sie melden sich mit der PIN an.",
|
||||
"Who may use this web interface.": "Wer diese Weboberfläche benutzen darf.",
|
||||
"Save and restore the settings of this app.": "Einstellungen dieser App sichern und wiederherstellen.",
|
||||
// network search, device ID, links
|
||||
"Already linked – unlink the group first": "Bereits verknüpft – zuerst die Gruppe trennen",
|
||||
"Advanced": "Erweitert",
|
||||
"Device ID": "Geräte-ID",
|
||||
"Only needed if the ID was changed on the DSP (e.g. several DSPs on one RS-485 cable). Default 1.": "Nur nötig, wenn die ID am DSP geändert wurde (z. B. mehrere DSPs an einem RS-485-Kabel). Standard 1.",
|
||||
"Searching the network for DSPs…": "Suche DSPs im Netzwerk…",
|
||||
"Search network": "Im Netzwerk suchen",
|
||||
"Unknown device": "Unbekanntes Gerät",
|
||||
"in the list": "in der Liste",
|
||||
"connected": "verbunden",
|
||||
"no answer (another program connected, or a different device ID)": "keine Antwort (anderes Programm verbunden oder andere Geräte-ID)",
|
||||
"No DSP found. Is it in the same network and switched on? Close the Thomann editor – a DSP accepts only one connection.": "Kein DSP gefunden. Ist er im selben Netzwerk und eingeschaltet? Den Thomann-Editor schließen – ein DSP erlaubt nur eine Verbindung.",
|
||||
"Finds DSPs in your network automatically": "Findet DSPs in deinem Netzwerk automatisch",
|
||||
"Channel settings": "Kanaleinstellungen",
|
||||
"Channels": "Kanäle",
|
||||
"Links": "Verknüpfungen",
|
||||
"Colours": "Farben",
|
||||
// max level
|
||||
"Max level": "Max. Pegel",
|
||||
"no limit": "keine Grenze",
|
||||
"now above – set on the DSP": "liegt gerade darüber – am DSP eingestellt",
|
||||
"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.": "Software-Sperre für die Gain-Fader: Die App lässt sie nicht höher. Wird am DSP selbst weiter aufgedreht, zeigt die App das an, und der Fader lässt sich nur nach unten ziehen, bis er wieder in die Grenze einrastet.",
|
||||
};
|
||||
|
||||
const DE_PATTERNS = [
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
<button data-view="mixer"><svg viewBox="0 0 24 24"><path d="M6 3v18M12 3v18M18 3v18"/><rect x="3.5" y="13" width="5" height="3" rx="1"/><rect x="9.5" y="7" width="5" height="3" rx="1"/><rect x="15.5" y="10" width="5" height="3" rx="1"/></svg><span>Mixer</span></button>
|
||||
<button data-view="channel"><svg viewBox="0 0 24 24"><path d="M2 14c3 0 3-7 6-7s3 10 6 10 3-6 6-6h2"/></svg><span data-t="Channel">Channel</span></button>
|
||||
<button data-view="routing"><svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16M8 3v18M16 3v18"/><circle cx="8" cy="6" r="2.2" class="f"/><circle cx="16" cy="12" r="2.2" class="f"/><circle cx="8" cy="18" r="2.2" class="f"/></svg><span>Routing</span></button>
|
||||
<button data-view="link"><svg viewBox="0 0 24 24"><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"/></svg><span>Link</span></button>
|
||||
<button data-view="link"><svg viewBox="0 0 24 24"><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"/></svg><span data-t="Channel settings">Channel settings</span><span class="short" data-t="Channels">Channels</span></button>
|
||||
<button data-view="limiter"><svg viewBox="0 0 24 24"><path d="M2 7h20" stroke-dasharray="2.5 2.5"/><path d="M2 14c2 0 3-7 5-7h3c2 0 3 11 6 11s3-5 6-5"/></svg><span>Limiter</span></button>
|
||||
<button data-view="soundfield"><svg viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M8 7l-2 2 2 2M16 7l2 2-2 2"/><path d="M7 15.5a7 7 0 0 1 10 0" stroke-dasharray="2 2"/><circle cx="12" cy="18" r="1.2" class="f"/></svg><span>SoundField</span><span class="short">Field</span></button>
|
||||
<button data-view="test"><svg viewBox="0 0 24 24"><path d="M4 9v6h4l5 4V5L8 9z"/><path d="M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12"/></svg><span data-t="Audio test">Audio test</span><span class="short" data-t="Test">Test</span></button>
|
||||
|
||||
+25
-2
@@ -515,8 +515,7 @@ body.testlock #viewtabs button:disabled, body.testlock #btn-settings:disabled, b
|
||||
|
||||
/* ---- global mute */
|
||||
#btn-muteall svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
||||
#btn-muteall.on { width: auto; padding: 0 12px; gap: 6px; background: #991b1b; border-color: var(--bad); color: #fff; font-weight: 700;
|
||||
letter-spacing: .06em; animation: mutepulse 1.6s ease-in-out infinite; }
|
||||
#btn-muteall.on { background: #991b1b; border-color: var(--bad); color: #fff; animation: mutepulse 1.6s ease-in-out infinite; }
|
||||
@keyframes mutepulse { 50% { box-shadow: 0 0 14px #ef4444aa; } }
|
||||
|
||||
/* ---- copy dialog */
|
||||
@@ -674,3 +673,27 @@ button.devadd b { font-size: 15px; color: var(--text); }
|
||||
.devpick { min-width: 0; max-width: min(320px, 100%); }
|
||||
.devpick .dn { min-width: 0; }
|
||||
@media (max-width: 480px) { .devpick .minidots, .devpick small { display: none; } }
|
||||
|
||||
/* ---- link tab: channels already in a link */
|
||||
.lkch.taken { cursor: not-allowed; opacity: .55; }
|
||||
.lkch.taken:hover { background: inherit; }
|
||||
/* ---- device ID, network search */
|
||||
.idrow { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 13px; color: var(--text); }
|
||||
.idrow input.short { width: 80px; }
|
||||
button.devadd .plus svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
|
||||
.scanres { display: flex; flex-direction: column; gap: 6px; min-width: min(460px, 80vw); max-height: 55vh; overflow-y: auto; }
|
||||
.scanres .empty.small { padding: 24px 8px; }
|
||||
.scanrow { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; background: var(--panel2); }
|
||||
.scanrow small { display: block; color: var(--dim); font-size: 12px; }
|
||||
|
||||
/* ---- software max level */
|
||||
.fader .limmark { position: absolute; left: 50%; width: 30px; height: 3px; margin-left: -15px; border-radius: 2px; background: var(--bad);
|
||||
box-shadow: 0 0 6px #ef4444aa; bottom: calc(12px + var(--f) * (100% - 24px)); transform: translateY(50%); pointer-events: none; z-index: 1; }
|
||||
.rangewrap { position: relative; }
|
||||
.rangewrap .limmark { position: absolute; top: 50%; width: 3px; height: 18px; margin-top: -9px; border-radius: 2px; background: var(--bad);
|
||||
left: calc(13px + var(--f) * (100% - 26px)); transform: translateX(-50%); pointer-events: none; z-index: 1; }
|
||||
.mlrow { display: grid; grid-template-columns: 110px minmax(0, 1fr) 84px; align-items: center; gap: 10px; margin-top: 8px; }
|
||||
.mllabel { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
|
||||
.mlval { font-size: 12px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
|
||||
.mlval.on { color: var(--bad); font-weight: 600; }
|
||||
.mlwarn { grid-column: 2 / -1; color: var(--warn); font-size: 11px; margin-top: -4px; }
|
||||
Reference in new issue
Block a user