Gap 8: PDC realtime — WS latency push + dry-path delay compensation

Backend: /ws/fx-realtime pump drain get_latencies (SHM ring, bridge da bao REPORT_LATENCY) -> push {cmd:'latency',total,latencies} khi tong doi. Frontend: pdcDelay (DelayNode) giua dryOutput->output bu delay master chain (round-trip 2 block + latency VST3), fxRtApplyPdc cap nhat tu WS frame, reset khi chain off. Test test_63 fake session 1024 -> frame total 1024; full 175 passed.
This commit is contained in:
2026-08-23 08:44:54 +07:00
parent db12698ba2
commit 6b2c9a039b
5 changed files with 110 additions and 8 deletions
+16
View File
@@ -1064,8 +1064,24 @@ async def ws_fx_realtime(websocket: WebSocket, session_id: str):
# output theo burst khi nhận input dồn; bắn toàn bộ cùng lúc → worklet
# overflow drop block cũ nhất → âm ngắt quãng.
block_sec = (sess.block_size or 256) / max(int(sess.sample_rate or 44100), 1)
# Gap 8 (PDC realtime): drain latency chain tu SHM ring (bridge bao qua
# REPORT_LATENCY per-slot) -> push text frame khi tong doi. Client dung
# de bu delay dry-bypass path (app.jsx fxRtApplyPdc).
_last_lat = None
try:
while True:
try:
_lats = sess.get_latencies()
_total = sum(_lats.values()) if _lats else 0
if _total != _last_lat:
_last_lat = _total
await websocket.send_text(json.dumps({
"cmd": "latency",
"total": _total,
"latencies": _lats,
}))
except Exception:
pass
blks = sess.read_output()
if not blks:
await asyncio.sleep(0.002)