feat(fx): Phase 1 DAW chain hop nhat — fx_realtime chain JSON giu thu tu, SET_PARAM/REPORT_LATENCY qua WS text, native_render chain builtin+vst3 xen ke, pytest

This commit is contained in:
2026-08-22 19:26:43 +07:00
parent 5ad2c681e7
commit fd790c1dc6
6 changed files with 365 additions and 10 deletions
+16 -2
View File
@@ -1069,9 +1069,23 @@ async def ws_fx_realtime(websocket: WebSocket, session_id: str):
pump_task = asyncio.create_task(_pump_output())
try:
while True:
data = await websocket.receive_bytes()
if not sess.alive():
msg = await websocket.receive()
if msg.get("type") == "websocket.disconnect" or not sess.alive():
break
if msg.get("text") is not None:
# Control protocol Phase 1: SET_PARAM / REPORT_LATENCY qua WS text.
try:
cmd = json.loads(msg["text"])
except Exception:
continue
if cmd.get("cmd") == "set_param":
sess.set_param(cmd.get("slot"), cmd.get("key"), cmd.get("value"))
elif cmd.get("cmd") == "latency":
sess.report_latency(cmd.get("slot"), cmd.get("samples"))
continue
data = msg.get("bytes")
if data is None:
continue
sess.write_input(data)
except WebSocketDisconnect:
pass