FIR DSP 408: own memory layout and FIR tab (filters, coefficient files, tap budget)

Layout and commands derived from the behaviour of its control software, tested
against the simulator only. No GEQ on this model; dynamic EQs are left untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 17:11:46 +01:00
1 parent f7d5e22bb0
commit 5597fae3f3
13 files changed
+622 -35

No files matched your search

+30 -2
View File
@@ -35,7 +35,7 @@ def test_layout_matches_devices():
def test_state_roundtrip():
for m in P.MODELS.values():
for m in (m for m in P.MODELS.values() if not m.fir):
st = P.default_state(m)
st["outputs"][-1]["comp"]["threshold"] = 123
st["inputs"][0]["geq"][30] = 7
@@ -140,7 +140,7 @@ def test_device_lock():
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():
for m in (m for m in P.MODELS.values() if not m.fir):
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}
@@ -178,6 +178,34 @@ def test_beta_models():
assert back["outputs"][m.n_out - 1]["gain"] == 123 and len(back["inputs"]) == m.n_in
def test_fir_model():
m = P.MODELS["408fir"]
assert (m.in_size, m.out_size, m.out_base, m.globals_base, m.size, m.chunks) == (138, 108, 0x238, 0x598, 0x625, 32)
st = P.default_state(m)
o = st["outputs"][7]
o["gain"], o["limit"]["threshold"], o["hp"], o["peq"][8]["bypass"] = 123, 77, {"freq": 40, "slope": 5}, True
o["fir"].update(type=3, window=8, low=200, high=8000, taps=24, name="SUB")
st["inputs"][3]["comp"]["threshold"], st["inputs"][3]["fir"] = 55, {"taps": 2048, "bypass": False, "name": "ROOM"}
st["inputs"][0]["peq"][7]["bypass"] = True
buf = bytes(P.build_state_buffer(m, st))
assert buf[0x238 + 7 * 108 + 28:0x238 + 7 * 108 + 36] == bytes([3, 8]) + (200).to_bytes(2, "little") + (8000).to_bytes(2, "little") + (24).to_bytes(2, "little")
assert buf[0x5B4 + 8 * 11:0x5B4 + 8 * 11 + 3] == b"SUB" and buf[0x59C:0x59E] == (128).to_bytes(2, "little")
back = P.parse_state(m, buf)
assert back["outputs"] == st["outputs"] and back["inputs"] == st["inputs"]
assert len(back["inputs"][0]["peq"]) == 8 and len(back["outputs"][0]["peq"]) == 9 and "geq" not in back["inputs"][0]
assert P.param_command(m, "out", 7, back["outputs"][7], "fir") == (0x4B, bytes.fromhex("0b 03 08 c8 00 40 1f 18 00"))
assert P.param_command(m, "out", 7, back["outputs"][7], "hp") == (0x32, bytes.fromhex("0b 28 00 04 00"))
assert P.param_command(m, "out", 0, back["outputs"][0], "hp") == (0x32, bytes.fromhex("04 00 00 00 01"))
assert P.param_command(m, "in", 3, back["inputs"][3], "fir.bypass") == (0x4F, bytes.fromhex("03 00"))
assert P.param_command(m, "out", 7, back["outputs"][7], "limit")[1][:3] == bytes.fromhex("0b 00 00")
assert P.fir_channel_taps(back["outputs"][7]) == 1024 and P.fir_channel_taps(back["inputs"][3]) == 2048
frames = P.fir_coef_frames(4, [1.0] + [0.0] * 12)
assert len(frames) == 2 and frames[0][:8] == bytes.fromhex("04 00 0d 00 3f 80 00 00") and len(frames[0]) == 4 + 48 and len(frames[1]) == 8
for cmd, p in ((0x4B, bytes.fromhex("04 01 02 96 00 20 4e 08 00")), (0x4E, frames[0]), (0x5B, b"\x04ABC ")):
P.apply_command(m, st, cmd, p)
assert st["outputs"][0]["fir"]["type"] == 1 and st["outputs"][0]["fir"]["name"] == "ABC"
if __name__ == "__main__":
for name, fn in list(globals().items()):
if name.startswith("test_"):