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:
GivouandClaude Opus 5.5 committed 2026-11-01 23:29:41 +01:00
1 parent 9473fc9eca
commit 52ecff85ce
8 files changed
+264 -49

No files matched your search

+12 -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):
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"))