Phase 3: engine render chain hop nhat — track/master doc mastering_settings.chain (imager/maximizer), PDC probe FX_LATENCIES, fix daw_vst_bridge link BuiltinFxChain, pytest 3.2/3.3

This commit is contained in:
2026-08-22 20:17:59 +07:00
parent 1390ad545b
commit e5c957fc87
11 changed files with 235 additions and 35 deletions
+14 -3
View File
@@ -216,12 +216,14 @@ def render_offline(instrument_id, notes, bpm, sample_rate, preset_id=None,
pass
def render_fx_chain(input_wav, fx_chain, sample_rate, out_path=None) -> str:
def render_fx_chain(input_wav, fx_chain, sample_rate, out_path=None):
"""Render WAV qua native_bridge --render-fx (VST3 FX + builtin gain/normalize).
fx_chain: list dict {type: "vst3"|"builtin", path|id, preset_b64?, bypass?,
params?}. path là plugin id/name → resolve_plugin_path (".vst3"). Trả
out_path; lỗi → HTTPException (501 thiếu bridge, 404 plugin lạ, 500 render).
(out_path, latencies) — latencies: per-slot samples (bridge FX_LATENCIES,
Phase 3 PDC; [] nếu exe cũ không báo). Lỗi → HTTPException (501 thiếu
bridge, 404 plugin lạ, 500 render).
"""
from app.core.vst_engine import resolve_plugin_path
exe = find_fx_bridge_exe()
@@ -284,7 +286,16 @@ def render_fx_chain(input_wav, fx_chain, sample_rate, out_path=None) -> str:
detail=f"Bridge không load được plugin. {log[-500:]}")
raise HTTPException(status_code=500,
detail=f"FX render thất bại (rc={r.returncode}). {log[-500:]}")
return out
latencies = []
for _line in (r.stdout or "").splitlines():
if "FX_LATENCIES" in _line:
try:
latencies = [int(x) for x in
_line.split("FX_LATENCIES", 1)[1].split()]
except Exception:
latencies = []
break
return out, latencies
except HTTPException:
raise
except subprocess.TimeoutExpired: