Add audio test tab with test generator, test fader and output mutes

- switch the DSP's test generator (pink/white noise, sine 20 Hz-20 kHz, command 0x39)
- entering lowers all outputs to -50 dB before the generator starts; one test fader
  raises them together; mute buttons for every output
- presets cannot be stored, recalled, imported or exported while the test runs
- leaving switches the generator off first, then restores every output gain
- a DSP found playing a test signal on connect goes straight into the audio test;
  saved gains survive an app restart (config.json)
- simulator and memory-image support for the test signal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-01 21:33:01 +01:00
1 parent 61400df667
commit 66f988cf08
12 files changed
+280 -12

No files matched your search

+7
View File
@@ -25,6 +25,11 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
* **`dsp/protocol.py`** – frames, checksum, value scales, model layouts (`MODELS["204"|"408"]`), memory image ↔ state
dict (`parse_state` / `build_state_buffer`), parameter → command (`param_command`), link masks, meter/limiter decoding.
State values are **raw device values**; conversion to dB/Hz/ms happens in the UI (`SPEC` in `app.js`).
* **Audio test** – `App.audio_test` / `set_test_level` / `check_audio_test` in `server.py`: entering saves the output
gains (`Device.test_saved`, persisted in `config.json` so an interrupted test is undone on the next connect),
lowers every output to −50 dB, flushes the queue and only then starts the generator (`0x39`); leaving switches the
generator off first, then restores the gains. While `Device.test_active`, preset store/recall/import/export are
refused. The state field is `state["test"] = {source, freq}`.
* **`dsp/preset.py`** – preset files (`dsp-control-preset` JSON with state + raw image), validation, and the minimal
command sequence for an import. Undo backups go to `backups/` next to `config.json` (last 20 per device).
* **`dsp/usbhid.py`** – HID via ctypes only: Windows `hid.dll`/SetupAPI, macOS IOKit, Linux `/dev/hidraw*`.
@@ -86,6 +91,8 @@ Not verified yet – ask for a log (`python server.py -v`) from real hardware be
* USB on Windows and Linux against a real DSP (only tested against a fake HID device)
* Where the PEQ bypass flag lives in the memory image; format of the set-command acknowledgement; where the number
of preset slots comes from (20 is assumed when the `0x2C` answer carries the lock state)
* Test signal command `0x39` and its position in the memory image – derived from the control software, simulator
only; whether the generator is pre or post input gain is unknown (the app therefore only lowers the outputs)
* Device lock (`0x2C` byte 5, `0x2D`, `0x2F`, `0x11`) – implemented from the control software's behaviour and
tested against the simulator only; no command to remove a lock is known
* Limiter calculator reference level (assumes limiter 0 dB = 0 dBu at the output; adjustable per device)
+5 -1
View File
@@ -87,6 +87,7 @@ All 16-bit words are little endian.
| `41` | Mix level (outputs) | `[ch][input][u16 level]` |
| `3D` | Channel name | `[ch][name 8]` (printable ASCII) |
| `3B` | Link | `[ch][u16 link mask]` (see [Channel links](#channel-links)) |
| `39` | Test signal | `[source][freq]` – source 0 = analog inputs, 1 = pink noise, 2 = white noise, 3 = sine; freq = index 0–30 of the 1/3-octave frequencies 20 Hz…20 kHz (as the GEQ) |
| `15` | Delay unit | `[unit]` (display only) |
The format of the acknowledgement the DSP sends after a set command is not fully understood yet.
@@ -166,7 +167,10 @@ Chunk `n` carries bytes `n·50 … n·50+49` of the device memory image.
… comp: ratio, attack, release, knee, threshold (5×u16)
… limit: attack, release, knee, threshold (4×u16)
… u16 gain, u16 polarity, u16 delay, u16 link mask
u16 input mute bit mask, u16 output mute bit mask, then unknown fields
u16 input mute bit mask, u16 output mute bit mask
u16[nIn + nOut] unknown
u16 test signal source, u16 test signal frequency index (see command 39)
8 bytes unknown
```
Total size: DSP 204 = 724 bytes (15 chunks), DSP 408 = 1448 bytes (29 chunks).
+4
View File
@@ -31,6 +31,10 @@ Control both devices at the same time from your phone, tablet or computer – ov
* **Settings backup** – devices, amplifier data, PIN and remote access in one file
* **Device lock** – DSPs locked with their 4-character code (e.g. `A1BA`) are detected on connect and the app asks
for the code; optionally it remembers the code and unlocks automatically. A new code can be set under ⚙
* **Audio test** – switch the DSP's test generator (pink noise, white noise, sine 20 Hz–20 kHz) on and off. All
outputs drop to −50 dB first and a single test fader raises them together; mute buttons for every output.
Presets can't be saved or recalled meanwhile, and stopping the test switches the noise off before every fader
returns to its previous value. A DSP found playing a test signal on connect goes straight into this mode
* **Demo mode** – one switch under ⚙ starts a simulated DSP 204 or 408 inside the app to try everything; the real
DSPs are disconnected meanwhile and nothing is sent to them
* **Many phones at once** – every change is pushed live to all connected clients
+29 -2
View File
@@ -21,7 +21,7 @@ LINK_RESYNC_DELAY = 1.5 # re-read the config this long after the last change on
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):
lock_code: str = "", auto_unlock: bool = False, test_saved: list | None = None):
self.id = dev_id
self.name = name
self.host = host
@@ -36,6 +36,10 @@ class Device:
self.lock_code = lock_code if P.LOCK_CODE.fullmatch(lock_code or "") else ""
self.auto_unlock = auto_unlock
self.demo = False # in-process simulator of the demo mode, never saved
# 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
self.on_online = None # async callback(device) once a connection is fully loaded
self.status = "disconnected" # disconnected | connecting | loading | locked | online | error
self.error = ""
@@ -66,11 +70,12 @@ class Device:
return {"id": self.id, "name": self.name, "host": self.host, "port": self.port,
"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}
"lock_code": self.lock_code, "auto_unlock": self.auto_unlock, "test_saved": self.test_saved}
def snapshot(self) -> dict:
cfg = self.config()
cfg["lock_code"] = bool(self.lock_code) # clients only learn whether a code is remembered
cfg["test_level"] = self.test_level
return {**cfg, "demo": self.demo, "status": self.status, "error": self.error, "info": self.info,
"detected_model": self.model_name or None,
"n_in": self.model.n_in if self.model else 0,
@@ -128,6 +133,26 @@ class Device:
await asyncio.sleep(0.3)
await self.refresh()
@property
def test_active(self) -> bool:
return bool(self.state and self.state.get("test", {}).get("source"))
async def set_test_signal(self, source: int, freq: int):
"""Switch the inputs to a test generator (1 pink, 2 white, 3 sine) or back to the analog inputs (0)."""
if self.status != "online" or not self.state:
raise RuntimeError("DSP is not connected")
await self.flush() # queued changes (e.g. lowered faders) reach the DSP first
await self._request(P.CMD_TEST_SIGNAL, bytes([source, freq]))
self.state["test"] = {"source": source, "freq": freq}
self.on_event({"type": "test", "device": self.id, "test": self.state["test"]})
async def flush(self):
"""Wait until every queued parameter change has been sent."""
while self._pending:
await asyncio.sleep(0.01)
async with self._lock: # the last one may still wait for its answer
pass
async def unlock(self, code: str) -> bool:
"""Try a lock code while the DSP waits for it. True if the DSP accepted it."""
code = str(code or "").strip().upper()
@@ -255,6 +280,8 @@ class Device:
self._set_status("online")
self._emit_state()
self._tasks += [asyncio.create_task(self._write_loop()), asyncio.create_task(self._meter_loop())]
if self.on_online:
asyncio.create_task(self.on_online(self))
done, _ = await asyncio.wait(self._tasks, return_when=asyncio.FIRST_COMPLETED)
for t in done:
if t.exception():
+16 -1
View File
@@ -25,6 +25,7 @@ CMD_PRESET_NAME = 0x29
CMD_PRESET_COUNT = 0x2C # answer: [time lock][4 bytes time lock data][device lock] (see device_locked)
CMD_UNLOCK = 0x2D # [0][code 4] -> answer [0][1 = unlocked, 0 = wrong code]
CMD_SET_LOCK_CODE = 0x2F # [code 4]
CMD_TEST_SIGNAL = 0x39 # [source][freq index]: 0 = analog input, 1 = pink noise, 2 = white noise, 3 = sine
CMD_METER = 0x40
# Parameter commands
@@ -45,6 +46,7 @@ CMD_GEQ = 0x48
CMD_LINK = 0x3B # [ch][u16 link mask], see link_masks()
CHUNK_SIZE = 50
TEST_SOURCES = ("analog", "pink", "white", "sine")
LOCK_CODE = re.compile(r"[A-Z0-9]{4}") # device lock code: 4 characters, digits and upper-case letters
@@ -222,6 +224,11 @@ class Model:
def globals_base(self) -> int:
return self.out_base + self.n_out * self.out_size
@property
def test_base(self) -> int:
"""Test signal (source, sine frequency index), after the mute masks and one word per channel."""
return self.globals_base + 4 + 2 * self.n_in + 2 * self.n_out
@property
def size(self) -> int:
return self.globals_base + 4 + 2 * self.n_in + 2 * self.n_out + 12
@@ -315,7 +322,9 @@ def parse_state(model: Model, buf: bytes) -> dict:
"link": u16(p + 84),
"mute": bool(out_mute >> i & 1),
})
return {"preset_name": _name(buf[2:16]), "inputs": inputs, "outputs": outputs}
source, freq = struct.unpack_from("<HH", buf, model.test_base)
test = {"source": source if source < len(TEST_SOURCES) else 0, "freq": freq if freq < 31 else 0}
return {"preset_name": _name(buf[2:16]), "inputs": inputs, "outputs": outputs, "test": test}
def build_state_buffer(model: Model, state: dict) -> bytearray:
@@ -359,6 +368,8 @@ def build_state_buffer(model: Model, state: dict) -> bytearray:
struct.pack_into("<4H", buf, p + 78, ch["gain"], int(ch["polarity"]), ch["delay"], ch.get("link", 1 << i))
out_mute |= int(ch["mute"]) << i
struct.pack_into("<HH", buf, model.globals_base, in_mute, out_mute)
test = state.get("test") or {}
struct.pack_into("<HH", buf, model.test_base, test.get("source", 0), test.get("freq", 0))
return buf
@@ -380,6 +391,7 @@ def default_state(model: Model) -> dict:
"limit": {"attack": 49, "release": 499, "knee": 0, "threshold": 220},
"gain": 280, "polarity": False, "delay": 0, "mute": False, "link": 1 << i,
} for i in range(model.n_out)],
"test": {"source": 0, "freq": 17},
}
@@ -500,6 +512,9 @@ def apply_command(model: Model, state: dict, cmd: int, p: bytes):
"""Update state from an incoming set command (used by the simulator)."""
if not p:
return
if cmd == CMD_TEST_SIGNAL:
state["test"] = {"source": p[0], "freq": p[1] if len(p) > 1 else 0}
return
c = p[0]
kind, idx = ("in", c) if c < model.n_in else ("out", c - model.n_in)
chans = state["inputs" if kind == "in" else "outputs"]
+77 -1
View File
@@ -23,6 +23,7 @@ from urllib.parse import parse_qs, urlsplit
import sim
from dsp import preset, usbhid
from dsp import protocol as P
from dsp.device import Device
ROOT = Path(__file__).resolve().parent
@@ -35,6 +36,8 @@ MAX_SESSIONS = 50
COOKIE = "dspsess"
CONFIG_FORMAT = "dsp-control-config"
MAX_UNDO = 20 # automatic backups kept per DSP before each import
TEST_LEVEL = -50.0 # dB all outputs start at when an audio test begins (noise generators are loud)
TEST_MAX = 0.0 # highest level the test fader can set
def _num(v, lo: float, hi: float, default: float = 0.0) -> float:
@@ -86,6 +89,13 @@ def clean_limiter(data: dict) -> dict:
return {"amps": amps, "assign": assign, "ref": ref}
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:
return None
return [int(_num(g, 0, 400, 280)) for g in v]
def hash_pin(pin: str, salt: str) -> str:
return hashlib.pbkdf2_hmac("sha256", pin.encode(), bytes.fromhex(salt), 100_000).hex()
@@ -222,7 +232,9 @@ class App:
int(d.get("port", 9761)), str(d.get("model", "auto")), int(d.get("addr", 1)),
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")))
lock_code=str(d.get("lock_code") or ""), auto_unlock=bool(d.get("auto_unlock")),
test_saved=clean_gains(d.get("test_saved")))
dev.on_online = self.check_audio_test
self.devices[dev_id] = dev
if dev.autoconnect:
if self.demo["enabled"]:
@@ -233,6 +245,60 @@ class App:
self.save()
return dev
# ------------------------------------------------------------ audio test
def set_test_level(self, dev: Device, db: float):
"""Every output to the same level (the test fader)."""
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)
def restore_gains(self, dev: Device):
for i, g in enumerate((dev.test_saved or [])[: len(dev.state["outputs"])]):
dev.set_param("out", i, "gain", g)
dev.test_saved = None
async def audio_test(self, dev: Device, body: dict) -> dict:
source = int(_num(body.get("source"), 0, len(P.TEST_SOURCES) - 1, 0))
freq = int(_num(body.get("freq"), 0, 30, dev.state["test"]["freq"] if dev.state else 17))
if not dev.state or dev.status != "online":
raise RuntimeError("DSP is not connected")
if source:
if not dev.test_active: # entering: lower every output before the generator starts
if dev.test_saved is None:
dev.test_saved = [ch["gain"] for ch in dev.state["outputs"]]
self.save()
self.set_test_level(dev, TEST_LEVEL)
await dev.set_test_signal(source, freq)
else: # leaving: generator off first, then the faders go back
await dev.set_test_signal(0, freq)
if dev.test_saved is not None:
self.restore_gains(dev)
await dev.flush()
self.save()
self.broadcast({"type": "device", "device": dev.id, "data": dev.snapshot()})
return {"ok": True}
async def check_audio_test(self, dev: Device):
"""On connect: a DSP still playing a test signal goes straight into the audio test (outputs lowered);
one back on its analog inputs gets the faders saved by an interrupted test back."""
try:
if dev.test_active:
if dev.test_saved is None:
dev.test_saved = [ch["gain"] for ch in dev.state["outputs"]]
self.set_test_level(dev, TEST_LEVEL)
elif dev.test_saved is not None:
self.restore_gains(dev)
else:
return
await dev.flush()
if not dev.demo:
self.save()
self.broadcast({"type": "device", "device": dev.id, "data": dev.snapshot()})
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)
def real_devices(self) -> list[Device]:
return [d for d in self.devices.values() if not d.demo]
@@ -265,6 +331,7 @@ class App:
port = self.demo_server.sockets[0].getsockname()[1]
dev = Device("demo", f"Demo DSP {model}", "127.0.0.1", port, model, autoconnect=False, on_event=self.broadcast)
dev.demo = True
dev.on_online = self.check_audio_test
self.devices[dev.id] = dev
self.demo["enabled"] = True
self.broadcast({"type": "device", "device": dev.id, "data": dev.snapshot()})
@@ -456,6 +523,8 @@ class App:
action = "/".join(g for g in m.groups()[1:] if g)
if dev.demo and (method in ("DELETE", "PUT") or action in ("unlock", "lockcode")):
raise RuntimeError("Not available for the demo device")
if dev.test_active and action in ("preset/recall", "preset/store", "export", "import", "undo"):
raise RuntimeError("Audio test is on – switch it off first")
if self.demo["enabled"] and not dev.demo and action == "connect":
raise RuntimeError("Demo mode is on – switch it off to connect the real DSPs")
if method == "DELETE" and not action:
@@ -519,6 +588,13 @@ class App:
if action == "refresh":
await dev.refresh()
return {"ok": True}
if action == "test":
return await self.audio_test(dev, body)
if action == "testlevel":
if not dev.test_active:
raise RuntimeError("Audio test is off")
self.set_test_level(dev, body.get("db"))
return {"ok": True, "db": dev.test_level}
if action == "unlock": # hardware lock of the DSP, independent of the app lock
code = str(body.get("code") or "").strip().upper()
ok = await dev.unlock(code)
+3 -1
View File
@@ -54,9 +54,11 @@ class SimDSP:
if cmd == P.CMD_METER:
t = time.monotonic()
levels = [0.0] * 12
noise = self.state.get("test", {}).get("source", 0) # test generator instead of the analog inputs
for i in range(m.n_in):
ch = self.state["inputs"][i]
lv = 0.0 if ch["mute"] else 0.25 * (1 + math.sin(t * (1.3 + i))) * 10 ** (P.gain_to_db(ch["gain"]) / 20)
src = 0.7 + 0.05 * math.sin(t * 40 + i) if noise else 0.25 * (1 + math.sin(t * (1.3 + i)))
lv = 0.0 if ch["mute"] else src * 10 ** (P.gain_to_db(ch["gain"]) / 20)
levels[m.meter_index("in", i)] = lv
flags = 0
for o in range(m.n_out):
+79 -6
View File
@@ -520,7 +520,7 @@ function renderTabs() {
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),
d.demo ? h("small", { class: "demo-badge" }, "DEMO") : model ? h("small", {}, model) : null);
testOn(d) ? h("small", { class: "test-badge" }, "TEST") : d.demo ? h("small", { class: "demo-badge" }, "DEMO") : model ? h("small", {}, model) : null);
}));
$("#btn-settings").classList.toggle("on", S.settings);
document.querySelectorAll("#viewtabs button").forEach(b => b.classList.toggle("active", !S.settings && b.dataset.view === S.view));
@@ -712,6 +712,8 @@ function renderStatus() {
const presetSel = h("select", { "aria-label": t("Recall preset") },
h("option", { value: "" }, t("Recall preset…")),
d.presets.map((p, i) => h("option", { value: i, disabled: !p }, `U${String(i + 1).padStart(2, "0")} ${p || "—"}`)));
const testing = testOn(d);
presetSel.disabled = testing;
presetSel.addEventListener("change", async () => {
if (presetSel.value === "") return;
const i = +presetSel.value;
@@ -724,8 +726,8 @@ function renderStatus() {
});
bar.replaceChildren(
h("div", { class: "preset" }, h("small", {}, d.demo ? t("Demo mode · simulated DSP") : `${d.info || d.name} · ${where(d)}`), h("b", {}, d.state.preset_name || "—")),
h("div", { class: "presetrow" }, presetSel, h("button", { onclick: () => storePresetDialog(d) }, t("Save")),
h("button", { onclick: () => presetFileDialog(d), title: t("Export / import preset"), "data-view-ok": "" }, t("File…"))));
h("div", { class: "presetrow" }, presetSel, h("button", { disabled: testing, title: testing ? t("Not possible during the audio test") : "", onclick: () => storePresetDialog(d) }, t("Save")),
h("button", { disabled: testing, onclick: () => presetFileDialog(d), title: testing ? t("Not possible during the audio test") : t("Export / import preset"), "data-view-ok": "" }, t("File…"))));
}
// ------------------------------------------------------------------ mixer
@@ -1396,6 +1398,68 @@ function viewLimiter(d) {
];
}
// ------------------------------------------------------------------ audio test (test generator of the DSP)
const testOn = d => !!(d && d.state && d.state.test && d.state.test.source);
const TEST_SRC = () => [[0, t("Analog input"), t("normal operation")], [1, t("Pink noise"), ""], [2, t("White noise"), ""], [3, t("Sine"), ""]];
const LVL_MIN = -60, LVL_MAX = 0; // test fader range in dB (all outputs at the same level)
async function setTestSignal(d, source, freq) {
try { await api("POST", `/api/devices/${d.id}/test`, { source, freq: freq ?? d.state.test.freq }); }
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
}
// one request in flight at a time, always ending with the latest fader position
function sendTestLevel(d, db) {
sendTestLevel.next = db;
if (sendTestLevel.busy) return;
sendTestLevel.busy = true;
(async () => {
while (sendTestLevel.next != null) {
const v = sendTestLevel.next;
sendTestLevel.next = null;
try { await api("POST", `/api/devices/${d.id}/testlevel`, { db: v }); } catch (e) { toast(trMsg(e.message)); }
}
sendTestLevel.busy = false;
})();
}
function viewTest(d) {
const on = testOn(d), test = d.state.test;
const freqSel = h("select", { "aria-label": t("Sine frequency"), onchange: () => setTestSignal(d, 3, +freqSel.value) },
GEQ_FREQS.map((f, i) => h("option", { value: i, selected: i === test.freq }, f.endsWith("k") ? `${f.slice(0, -1)} kHz` : `${f} Hz`)));
const signalCard = h("div", { class: "card" },
h("h3", {}, t("Input signal")),
h("div", { class: "srcgrid" }, TEST_SRC().map(([v, label, sub]) =>
h("button", { class: "src" + (test.source === v ? " on" : "") + (v ? " noise" : ""), "aria-pressed": String(test.source === v),
onclick: () => test.source !== v && setTestSignal(d, v, v === 3 ? +freqSel.value : test.freq) },
h("b", {}, label), sub ? h("small", {}, sub) : null))),
h("label", { class: "row sinefreq" + (test.source === 3 ? "" : " dim") }, h("span", { class: "grow" }, t("Sine frequency")), freqSel),
h("p", { class: "info" }, t("The test signal replaces the analog inputs of the DSP. When it is switched on, all outputs are lowered to −50 dB first – raise them slowly with the test fader.")));
const lvl = d.test_level ?? -50;
const val = h("div", { class: "testval" }, on ? `${lvl.toFixed(1)} dB` : "—");
const f = fader({ min: 0, max: (LVL_MAX - LVL_MIN) * 2, value: Math.round((lvl - LVL_MIN) * 2), label: t("Test fader"),
ticks: [-60, -50, -40, -30, -20, -10, 0].map(db => [(db - LVL_MIN) * 2, String(db)]),
onInput: v => { const db = LVL_MIN + v / 2; d.test_level = db; val.textContent = `${db.toFixed(1)} dB`; sendTestLevel(d, db); } });
const outs = chans(d, "out").map((ch, i) => {
const m = h("div", { class: "tmeter" + (ch.mute ? " muted" : "") }, ledMeter(d.id, "out", i), h("small", {}, chLabel("out", i)), limLed(d.id, i));
m.append(toggleBtn("MUTE", "out", i, "mute", "mute small", v => m.classList.toggle("muted", v)));
return m;
});
const faderCard = h("div", { class: "card testfader" + (on ? "" : " off") },
h("h3", {}, t("Test fader"), h("span", { class: "info" }, t("all outputs"))),
h("div", { class: "testbody" }, h("div", { class: "tf" }, f, val), h("div", { class: "tmeters" }, outs)),
on ? h("button", { class: "danger-on wide", onclick: () => setTestSignal(d, 0) }, t("Stop test – back to the analog input")) : null,
h("p", { class: "info" }, on
? t("Saving and recalling presets is blocked during the test. Stopping it switches the noise off first and then puts every fader back where it was.")
: t("Choose a test signal above to start.")));
return [
on ? h("div", { class: "testbanner" }, t("Audio test running – the DSP plays {signal} instead of its inputs.", { signal: TEST_SRC()[test.source][1] })) : null,
h("div", { class: "cards testcards" }, signalCard, faderCard),
];
}
// ------------------------------------------------------------------ settings
function deviceForm(d) {
@@ -1616,7 +1680,7 @@ function render() {
: d.status === "locked" ? h("div", {}, h("p", {}, t("This DSP is locked with a code.")),
h("button", { class: "on", onclick: () => unlockDialog(d) }, t("Enter code")))
: S.demo.enabled && !d.demo ? t("Disconnected while demo mode is on") : t("Not connected."));
else content = ({ mixer: viewMixer, channel: viewChannel, routing: viewRouting, link: viewLink, limiter: viewLimiter }[S.view] || viewMixer)(d);
else content = ({ mixer: viewMixer, channel: viewChannel, routing: viewRouting, link: viewLink, limiter: viewLimiter, test: viewTest }[S.view] || viewMixer)(d);
main.replaceChildren(...[content].flat().filter(Boolean));
main.querySelectorAll(H_SCROLL).forEach((e, i) => { if (xs[i]) e.scrollLeft = xs[i]; });
window.scrollTo(0, y);
@@ -1709,10 +1773,18 @@ function connectEvents() {
S.order.forEach(id => maybeAskUnlock(S.devices[id]));
if (!S.order.length) S.settings = true;
render(); break;
case "device":
case "device": {
if (!S.devices[ev.device]) S.order.push(ev.device);
const was = testOn(S.devices[ev.device]);
S.devices[ev.device] = ev.data;
if (!was && testOn(ev.data) && ev.device === S.cur && !S.settings) S.view = "test"; // e.g. DSP found playing noise
render(); break;
}
case "test": {
const d = S.devices[ev.device];
if (d && d.state) { d.state.test = ev.test; render(); }
break;
}
case "removed":
delete S.devices[ev.device]; S.order = S.order.filter(id => id !== ev.device);
render(); break;
@@ -1736,7 +1808,8 @@ function connectEvents() {
if (JSON.stringify(getPath(ch, ev.param)) === JSON.stringify(ev.value)) break;
setPath(ch, ev.param, ev.value);
showLive(`${ev.device}|${ev.kind}|${ev.idx}|${ev.param}`, ev.value); // even while a fader is held
if (ev.device === S.cur && !S.settings) render();
// the test fader moves every output: the audio test view only shows meters, no need to redraw
if (ev.device === S.cur && !S.settings && !(S.view === "test" && ev.param === "gain")) render();
break;
}
case "lock":
+19
View File
@@ -321,6 +321,25 @@ const DE = {
"Try everything with a simulated DSP – nothing is sent to real devices. While demo mode is on, the real DSPs are disconnected.": "Alles gefahrlos mit einem simulierten DSP ausprobieren – an echte Geräte wird nichts gesendet. Solange der Demo-Modus aktiv ist, sind die echten DSPs getrennt.",
"Not available for the demo device": "Für das Demo-Gerät nicht verfügbar",
"Demo mode is on – switch it off to connect the real DSPs": "Der Demo-Modus ist aktiv – zum Verbinden der echten DSPs bitte ausschalten",
// audio test
"Audio test": "Audiotest",
"Analog input": "Analog-Eingang",
"normal operation": "Normalbetrieb",
"Pink noise": "Rosa Rauschen",
"White noise": "Weißes Rauschen",
"Sine": "Sinus",
"Sine frequency": "Sinus-Frequenz",
"Input signal": "Eingangssignal",
"Test fader": "Testfader",
"all outputs": "alle Ausgänge",
"Audio test running – the DSP plays {signal} instead of its inputs.": "Audiotest läuft – der DSP spielt {signal} statt seiner Eingänge.",
"Choose a test signal above to start.": "Zum Starten oben ein Testsignal wählen.",
"Not possible during the audio test": "Während des Audiotests nicht möglich",
"Saving and recalling presets is blocked during the test. Stopping it switches the noise off first and then puts every fader back where it was.": "Presets speichern und laden ist während des Tests gesperrt. Beim Beenden wird zuerst das Rauschen abgeschaltet, danach gehen alle Fader zurück auf ihren ursprünglichen Wert.",
"Stop test – back to the analog input": "Test beenden – zurück zum Analog-Eingang",
"The test signal replaces the analog inputs of the DSP. When it is switched on, all outputs are lowered to −50 dB first – raise them slowly with the test fader.": "Das Testsignal ersetzt die Analog-Eingänge des DSP. Beim Einschalten werden zuerst alle Ausgänge auf −50 dB abgesenkt – mit dem Testfader langsam hochziehen.",
"Audio test is on – switch it off first": "Der Audiotest läuft – bitte zuerst beenden",
"Audio test is off": "Der Audiotest ist aus",
};
const DE_PATTERNS = [
+1
View File
@@ -25,6 +25,7 @@
<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="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="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></button>
</nav>
<button id="btn-lock" class="icon" hidden aria-label="Lock" title="Lock"></button>
<button id="btn-settings" class="icon" aria-label="Settings" title="Settings" data-t-label="Settings">
+28
View File
@@ -462,3 +462,31 @@ input.code { width: 7.5em; text-align: center; font-family: ui-monospace, Menlo,
.dialog label.chk input { width: 20px; height: 20px; }
.dialog .err { text-align: center; }
.lockbox input.code { flex: none; width: 7.5em; }
/* ---- audio test */
.test-badge { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #fff !important;
background: var(--bad) !important; border-radius: 5px; padding: 1px 6px; }
.testbanner { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font-weight: 600;
background: color-mix(in srgb, var(--bad) 18%, transparent); border: 1px solid var(--bad); }
.cards.testcards { grid-template-columns: minmax(0, 1fr); }
.srcgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.srcgrid .src { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; text-align: left;
text-transform: none; letter-spacing: 0; min-height: 58px; }
.srcgrid .src small { color: var(--dim); font-weight: 400; }
.srcgrid .src.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.srcgrid .src.noise.on { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--panel)); }
.sinefreq { margin-top: 12px; align-items: center; gap: 10px; }
.sinefreq.dim { opacity: .5; }
.testfader.off .tf { opacity: .35; pointer-events: none; }
.testbody { display: flex; gap: 18px; align-items: flex-start; min-width: 0; }
.tf { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tf .fader { height: 300px; }
.testval { white-space: nowrap; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tmeters { display: flex; gap: 6px; overflow-x: auto; min-width: 0; padding-bottom: 4px; }
.tmeter { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.tmeter .led { height: 300px; }
.testfader h3 .info { margin-left: 8px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.tmeter small { font-size: 11px; color: var(--dim); }
button.wide { width: 100%; margin-top: 14px; }
.tmeter button.mute { padding: 6px 8px; font-size: 11px; min-width: 52px; }
.tmeter.muted .led { opacity: .35; }
+12
View File
@@ -137,6 +137,18 @@ def test_device_lock():
assert dsp.lock_code == "B2C3"
def test_test_signal():
# source/frequency follow the mute masks and one word per channel (editor: 0x2C8 on the 204, 0x59C on the 408)
assert P.MODELS["204"].test_base == 0x2C8 and P.MODELS["408"].test_base == 0x59C
for m in P.MODELS.values():
st = P.default_state(m)
st["test"] = {"source": 3, "freq": 17}
assert P.parse_state(m, bytes(P.build_state_buffer(m, st)))["test"] == {"source": 3, "freq": 17}
st = P.default_state(P.MODELS["204"])
P.apply_command(P.MODELS["204"], st, P.CMD_TEST_SIGNAL, bytes([1, 5]))
assert st["test"] == {"source": 1, "freq": 5}
if __name__ == "__main__":
for name, fn in list(globals().items()):
if name.startswith("test_"):