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:
+16
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user