Looks per preset, steadier DJ Brake, no zoom on phones, simple dashboard on touch

Colours and link group names now belong to the preset (by name, the DSP has no
IDs) and travel in preset files. DJ Brake: limiters are left out instead of
chosen; a slowly falling peak mark, an average bar, a warning before the limit,
and it learns from real hits where the limiter sits on the meter. Pinch and
double tap zoom are off. On touchscreens the dashboard only offers widget settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 21:09:16 +01:00
1 parent 99613327f8
commit cf35a1faa1
11 files changed
+232 -48

No files matched your search

+50
View File
@@ -206,6 +206,56 @@ def test_fir_model():
assert st["outputs"][0]["fir"]["type"] == 1 and st["outputs"][0]["fir"]["name"] == "ABC"
def test_dj_brake_follows_music():
import server, tempfile
from types import SimpleNamespace
with tempfile.TemporaryDirectory() as d:
app = server.App(Path(d) / "c.json")
thr0 = 180 # threshold 0 dB
dev = SimpleNamespace(id="x", demo=True, state={"outputs": [{"mute": False, "limit": {"threshold": thr0}}]}, status="online")
app.devices["x"] = dev
lv = lambda db: 10 ** (db / 20)
note = lambda db, t, limit=False: app.dj_note({"device": "x", "out": [lv(db)], "limit": [limit]}, now=t)
# the peak stays while the music dips, then falls slowly
note(-10, 100.0)
note(-30, 100.5)
assert abs(app.dj_rooms["x"] - 10) < 0.01
note(-30, 102.5)
assert 10 < app.dj_rooms["x"] < 14
# the limiter acts at -12 on the meter although the threshold says 0: learned, and the distance is true afterwards
note(-12, 110.0, True)
assert abs(app.dj_cal["x:0"] - 12) < 3 and app.dj_rooms["x"] == 0
assert app.dj_hit == 110.0
for i in range(30):
note(-30, 120.0 + i)
note(-20, 150.0)
assert 6 < app.dj_rooms["x"] < 10
# a left out output neither warns nor counts
app.dj_ignore = {"x": [0]}
note(-1, 160.0, True)
assert app.dj_hit == 110.0 and app.dj_rooms["x"] is False
def test_looks_follow_presets():
from dsp.device import Device
d = Device("x", "x", "127.0.0.1")
d.state = {"preset_name": "A"}
d.colors, d.linknames = {"out0": "#111111"}, {"out:0,1": "Tops"}
d.sync_look()
d.state = {"preset_name": "B"} # not seen yet: starts with what is there, then goes its own way
d.sync_look()
assert d.colors == {"out0": "#111111"}
d.colors, d.linknames = {"out0": "#222222"}, {"out:0,1": "Subs"}
d.remember_look()
d.state = {"preset_name": "A"}
d.sync_look()
assert d.colors == {"out0": "#111111"} and d.linknames == {"out:0,1": "Tops"}
d.state = {"preset_name": "B"}
d.sync_look()
assert d.colors == {"out0": "#222222"} and d.linknames == {"out:0,1": "Subs"}
assert "looks" not in d.snapshot()
if __name__ == "__main__":
for name, fn in list(globals().items()):
if name.startswith("test_"):