Names for link groups, shown as coloured brackets above the mixer strips

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 00:05:55 +01:00
1 parent 83548c9620
commit 4b33fc2665
7 files changed
+97 -14

No files matched your search

+2
View File
@@ -45,6 +45,8 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
* **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`).
* **Link group names** – `Device.linknames` (app-side, like the colours), keyed by kind and members (`"out:0,1"`), so a
changed group starts without a name. The mixer draws them as brackets in row 1 of the `.strips` grid (`linkBands`).
* **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
+2 -1
View File
@@ -35,7 +35,8 @@ 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 settings** tab – link channels into groups (the DSP mirrors changes within the group), set a **max level**
* **Channel settings** tab – link channels into groups (the DSP mirrors changes within the group) and give each group a
name – the mixer shows it as a bracket in the group's colour above its strips –, 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
+3 -2
View File
@@ -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, maxgain: dict | None = None):
colors: dict | None = None, maxgain: dict | None = None, linknames: 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.linknames: dict[str, str] = linknames or {} # names of link groups, e.g. {"out:0,1": "Tops"}
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
@@ -74,7 +75,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, "maxgain": self.maxgain}
"colors": self.colors, "maxgain": self.maxgain, "linknames": self.linknames}
def snapshot(self) -> dict:
cfg = self.config()
+16 -1
View File
@@ -154,6 +154,16 @@ def clean_colors(v) -> dict:
return out
def clean_linknames(v) -> dict:
"""Names of link groups, keyed by kind and members: {"out:0,1": "Tops"}. A changed group loses its name."""
out = {}
for k, n in (v.items() if isinstance(v, dict) else []):
n = "".join(c for c in str(n) if c.isprintable()).strip()[:16]
if n and re.fullmatch(r"(in|out):\d{1,2}(,\d{1,2})+", str(k)):
out[str(k)] = n
return out
def clean_maxgain(v) -> dict:
"""Software gain limits per channel: {"in0": raw 0..399} (400 = +12 dB would be no limit)."""
out = {}
@@ -327,7 +337,7 @@ class App:
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")),
maxgain=clean_maxgain(d.get("maxgain")))
maxgain=clean_maxgain(d.get("maxgain")), linknames=clean_linknames(d.get("linknames")))
dev.on_online = self.device_online
self.devices[dev_id] = dev
if dev.autoconnect:
@@ -861,6 +871,11 @@ class App:
self.save()
self.broadcast({"type": "device", "device": dev.id, "data": dev.snapshot()})
return {"ok": True, "colors": dev.colors}
if action == "linknames": # display only, like the colours
dev.linknames = clean_linknames(body.get("linknames"))
self.save()
self.broadcast({"type": "device", "device": dev.id, "data": dev.snapshot()})
return {"ok": True, "linknames": dev.linknames}
if action == "test":
return await self.audio_test(dev, body)
if action == "testlevel":
+47 -8
View File
@@ -154,9 +154,12 @@ function linkInfo(d, kind, i) { // {group, color} if the channel is linked, el
const gs = linkedGroups(d, kind), n = gs.findIndex(g => g.includes(i));
return n < 0 ? null : { group: gs[n], color: LINK_COLORS[n % LINK_COLORS.length] };
}
// group names are kept by the app, keyed by the members (a changed group starts without a name)
const linkKey = (kind, g) => `${kind}:${g.join(",")}`;
const linkName = (d, kind, g) => (d.linknames || {})[linkKey(kind, g)] || "";
const linkBadge = (d, kind, i) => {
const l = linkInfo(d, kind, i);
return l ? h("span", { class: "lnk", style: `--lc:${l.color}`, title: t("Linked: ") + l.group.map(j => chLabel(kind, j)).join(" + ") },
return l ? h("span", { class: "lnk", style: `--lc:${custColor(d, kind, i) || l.color}`, title: t("Linked: ") + l.group.map(j => chLabel(kind, j)).join(" + ") },
svgIcon(ICON.link)) : null;
};
// polarity inverted ("Phase Ø" in the channel view)
@@ -884,7 +887,7 @@ function strip(d, kind, i) {
const ch = chans(d, kind)[i];
const db = h("button", { class: "db" + (ch.gain === 280 ? " z" : ""), title: t("Enter value") }, sign(gainDb(ch.gain)));
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 el = h("div", { class: `strip ${kind}` + (ch.mute ? " muted" : "") + (custColor(d, kind, i) ? " tinted" : ""), style: `${ccStyle(d, kind, i)};grid-column:${i + 1}` });
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); } });
@@ -905,10 +908,29 @@ function strip(d, kind, i) {
return el;
}
// bracket over a run of neighbouring strips of one link group (a group with gaps gets one per run)
function linkBands(d, kind) {
const bands = [];
linkedGroups(d, kind).forEach(g => {
const color = custColor(d, kind, g[0]) || linkInfo(d, kind, g[0]).color, name = linkName(d, kind, g);
const title = (name ? name + " · " : "") + g.map(j => chLabel(kind, j)).join(" + ");
g.forEach((j, n) => {
if (n && g[n - 1] === j - 1) return;
let len = 1;
while (g.includes(j + len)) len++;
bands.push(h("div", { class: "lkband" + (len === 1 ? " single" : ""), style: `--lc:${color};grid-column:${j + 1} / span ${len}`, title },
h("span", { class: "lkname" + (name ? "" : " anon") }, svgIcon(ICON.link), name ? h("b", {}, name) : null)));
});
});
return bands;
}
function viewMixer(d) {
const group = (kind, title) => h("section", { class: "mgroup", style: `flex-grow:${chans(d, kind).length}` },
h("h4", {}, title), h("div", { class: "strips" }, chans(d, kind).map((_, i) => strip(d, kind, i))));
return [h("div", { class: "mixer" }, group("in", t("Inputs")), group("out", t("Outputs"))),
h("h4", {}, title), h("div", { class: "strips", style: `--n:${chans(d, kind).length}` },
linkBands(d, kind), chans(d, kind).map((_, i) => strip(d, kind, i))));
const bands = linkedGroups(d, "in").length + linkedGroups(d, "out").length > 0;
return [h("div", { class: "mixer" + (bands ? " hasbands" : "") }, group("in", t("Inputs")), group("out", t("Outputs"))),
h("p", { class: "info hint" }, t("Drag a fader by its knob · snaps at 0 dB · double-tap the knob = 0 dB · tap the dB value to type one · tap the name = edit channel"))];
}
@@ -1354,12 +1376,28 @@ async function saveLinks(d, kind, groups, msg) {
S.linkBusy = false; S.linkSel[kind] = []; render();
}
function linkNameInput(d, kind, g) {
const input = h("input", { type: "text", class: "lkname-in", maxlength: 16, value: linkName(d, kind, g),
placeholder: t("Group name"), "aria-label": t("Group name"), autocomplete: "off", spellcheck: "false", enterkeyhint: "done" });
const save = async () => {
const v = input.value.trim();
if (v === linkName(dev(), kind, g)) return;
const next = { ...(dev().linknames || {}) };
if (v) next[linkKey(kind, g)] = v; else delete next[linkKey(kind, g)];
try { await api("POST", `/api/devices/${d.id}/linknames`, { linknames: next }); toast(v ? t("Group name saved") : t("Group name removed")); }
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
};
input.addEventListener("change", save);
input.addEventListener("keydown", e => { if (e.key === "Enter") input.blur(); });
return input;
}
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 && !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" : "") + (l ? " taken" : ""), style: l ? `--lc:${l.color}` : "", "aria-pressed": String(on),
return h("button", { class: "lkch" + (on ? " sel" : "") + (l ? " taken" : ""), style: l ? `--lc:${custColor(d, kind, i) || 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));
@@ -1379,9 +1417,10 @@ function linkCard(d, kind) {
h("span", { class: "grow info" }, sel.length < 2 ? t("Tap at least two channels") : t("{n} channels selected", { n: sel.length })),
h("button", { class: "on", disabled: sel.length < 2 || S.linkBusy, onclick: link }, t("Link"))),
linked.length ? h("div", { class: "lkgroups" }, linked.map((g, n) =>
h("div", { class: "row lkgroup", style: `--lc:${LINK_COLORS[n % LINK_COLORS.length]}` },
svgIcon(ICON.link), h("span", { class: "grow" }, g.map(i => chLabel(kind, i)).join(" + ")),
h("button", { class: "small", disabled: S.linkBusy, onclick: () => unlink(g) }, t("Unlink")))))
h("div", { class: "lkgroup", style: `--lc:${custColor(d, kind, g[0]) || LINK_COLORS[n % LINK_COLORS.length]}` },
h("div", { class: "row" }, svgIcon(ICON.link), h("span", { class: "grow lkmembers" }, g.map(i => chLabel(kind, i)).join(" + ")),
h("button", { class: "small", disabled: S.linkBusy, onclick: () => unlink(g) }, t("Unlink"))),
linkNameInput(d, kind, g))))
: h("p", { class: "info" }, t("No channels linked.")));
}
+3
View File
@@ -501,6 +501,9 @@ const DE = {
"Above the max level of {lim} – press Apply twice to set it anyway.": "Über dem max. Pegel von {lim} – zum Setzen trotzdem zweimal Übernehmen drücken.",
"Max level: {lim}": "Max. Pegel: {lim}",
"Set anyway": "Trotzdem setzen",
"Group name": "Gruppenname",
"Group name saved": "Gruppenname gespeichert",
"Group name removed": "Gruppenname entfernt",
};
const DE_PATTERNS = [
+24 -2
View File
@@ -190,7 +190,28 @@ input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius:
.mixer { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.mgroup { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.mgroup h4 { margin: 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 600; }
.strips { display: flex; gap: 6px; }
/* strips sit in row 2 of a grid; row 1 holds the brackets of link groups (spanning their strips) */
.strips { display: grid; grid-template-columns: repeat(var(--n), 92px); grid-template-rows: 0 auto; gap: 0 6px; }
.mixer.hasbands .strips { grid-template-rows: 30px auto; }
.strips > .strip { grid-row: 2; }
.lkband { --lc: var(--warn); grid-row: 1; position: relative; align-self: end; height: 13px; margin: 0 14px 5px;
border: 2px solid var(--lc); border-bottom: 0; border-radius: 14px 14px 0 0;
filter: drop-shadow(0 0 5px color-mix(in srgb, var(--lc) 55%, transparent)); }
.lkband::before, .lkband::after { content: ""; position: absolute; bottom: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--lc); }
.lkband::before { left: -4px; } .lkband::after { right: -4px; }
.lkband.single { margin: 0 16px 5px; }
.lkband.single .lkname { max-width: calc(100% + 30px); padding: 1px 7px; }
.lkname { position: absolute; left: 50%; top: -1px; transform: translate(-50%, -50%); max-width: calc(100% - 20px);
display: flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; white-space: nowrap;
background: var(--bg); border: 1px solid color-mix(in srgb, var(--lc) 60%, transparent); color: var(--lc);
font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.lkname b { overflow: hidden; text-overflow: ellipsis; font-weight: inherit; }
.lkname svg { flex: none; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.lkname.anon { padding: 2px 6px; }
.lkgroup { display: flex; flex-direction: column; gap: 6px; padding-right: 8px; }
.lkgroup > .row { flex-wrap: nowrap; }
.lkgroup .lkmembers { min-width: 0; font-weight: 600; }
.lkgroup .lkname-in { width: 100%; height: 34px; padding: 4px 10px; font-size: 13px; }
.strip { --cc: var(--warn); flex: none; width: 92px; background: linear-gradient(var(--panel), var(--bg2)); border: 1px solid var(--line);
border-radius: var(--radius); padding: 0 6px 8px; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
scroll-snap-align: start; position: relative; overflow: hidden; }
@@ -209,7 +230,8 @@ button.mute.on { background: var(--mute); border-color: #f87171; color: #fff; bo
.strip.muted { background: linear-gradient(#1f1517, var(--bg2)); }
@media (min-width: 1200px) {
.mgroup { flex-shrink: 1; flex-basis: 0; }
.strip { flex: 1 1 92px; max-width: 128px; }
.strips { grid-template-columns: repeat(var(--n), minmax(92px, 128px)); }
.strip { width: auto; max-width: 128px; }
}
/* ------------------------------------------------------------- channel view */