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:
1 parent
f7d5e22bb0
commit
5597fae3f3
13 files changed
+622
-35
No files matched your search
+34
-1
@@ -85,6 +85,7 @@ class Device:
|
||||
"detected_model": self.model_name or None,
|
||||
"n_in": self.model.n_in if self.model else 0,
|
||||
"n_out": self.model.n_out if self.model else 0,
|
||||
"fir": bool(self.model and self.model.fir),
|
||||
"presets": self.presets, "state": self.state}
|
||||
|
||||
def start(self):
|
||||
@@ -138,6 +139,35 @@ class Device:
|
||||
await asyncio.sleep(0.3)
|
||||
await self.refresh()
|
||||
|
||||
def fir_taps_used(self, skip: tuple[str, int] | None = None) -> int:
|
||||
"""FIR taps taken by all channels together (they share P.FIR_MAX_TOTAL)."""
|
||||
total = 0
|
||||
for kind, key in (("in", "inputs"), ("out", "outputs")):
|
||||
for i, ch in enumerate(self.state[key]):
|
||||
if (kind, i) != skip:
|
||||
total += P.fir_channel_taps(ch)
|
||||
return total
|
||||
|
||||
async def upload_fir(self, kind: str, idx: int, coeffs: list[float], name: str) -> int:
|
||||
"""Send FIR coefficients to a channel. Returns how many frames were not answered."""
|
||||
if self.status != "online" or not self.state or not self.model.fir:
|
||||
raise RuntimeError("DSP is not connected")
|
||||
await self.flush()
|
||||
c = self.model.channel(kind, idx)
|
||||
name = P.clean_name(name)[:8]
|
||||
failed = 0
|
||||
if await self._request(P.CMD_FIR_NAME, bytes([c]) + name.encode("ascii").ljust(8, b" ")) is None:
|
||||
failed += 1
|
||||
for payload in P.fir_coef_frames(c, coeffs):
|
||||
if await self._request(P.CMD_FIR_COEF, payload) is None:
|
||||
failed += 1
|
||||
fir = self.state["inputs" if kind == "in" else "outputs"][idx]["fir"]
|
||||
fir["name"] = name
|
||||
if kind == "in":
|
||||
fir["taps"] = len(coeffs)
|
||||
self._emit_state()
|
||||
return failed
|
||||
|
||||
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)."""
|
||||
@@ -406,7 +436,10 @@ class Device:
|
||||
self._codes = None
|
||||
|
||||
async def _load_config(self):
|
||||
self.state = await self._read_config()
|
||||
state = await self._read_config()
|
||||
if self.model.fir and self.state: # where this model keeps the test signal in its memory is not known
|
||||
state["test"] = self.state.get("test", state["test"])
|
||||
self.state = state
|
||||
|
||||
async def _read_config(self) -> dict:
|
||||
model = self.model
|
||||
|
||||
Reference in new issue
Block a user