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)