fix(scan): fx_vst_bridge --scan timeout per-module 30s + emit UNKNOWN thay vi is_instrument=true

- RenderFxJob: safeScanModule chay tren worker thread + TerminateThread neu
  Module::create treo >30s (Ozone 11 Clarity treo vinh vien, SEH khong bat
  hang) -> scan khong bao gio ket thuc -> list_fx() timeout -> fx_paths rong
  -> filter /available vo hieu -> nut Synth hien ca VST FX
- Module crash/hang -> emit is_fx=false,is_instrument=false (UNKNOWN) thay vi
  is_instrument=true (truoc day xep VST FX crash vao danh sach instrument)
- vst_engine: list_scan_all() tra toan bo (FX+instrument+unknown); list_fx()
  loc is_fx tu cache chung
- plugins.py /available: loai ca fx_paths lan unknown_paths khoi
  vst_instruments -> nut Synth chi hien VSTi that
This commit is contained in:
2026-08-22 01:53:21 +00:00
parent 1a8b210063
commit dd2a320b2a
3 changed files with 88 additions and 25 deletions
+14 -4
View File
@@ -172,20 +172,30 @@ async def list_plugins(current_user: dict = Depends(get_current_user)):
# VST FX (Ozone/Sonible/...) khỏi vst_instruments theo is_fx của bridge scan.
# Filter TRƯỚC merge extra: nếu không, entry FX (path .vst3) chiếm id và
# setdefault chặn entry instrument (path .dll) cùng tên → mất cả hai.
# Ngoài is_fx còn loại entry UNKNOWN (is_fx=false, is_instrument=false —
# bridge không đọc được module, vd Ozone 11 Clarity crash/hang khi scan):
# không xác định được loại → KHÔNG hiện trong nút Synth.
fx_paths = set()
unknown_paths = set()
try:
from app.core.vst_engine import get_plugin_manager
fx_paths = {f.get("path", "").lower() for f in get_plugin_manager().list_fx()}
for e in get_plugin_manager().list_scan_all():
path = (e.get("path") or "").lower()
if e.get("is_fx"):
fx_paths.add(path)
elif e.get("is_unknown"):
unknown_paths.add(path)
except Exception:
pass
if fx_paths:
blocked = fx_paths | unknown_paths
if blocked:
avail["vst_instruments"] = [v for v in avail["vst_instruments"]
if (v.get("path") or "").lower() not in fx_paths]
if (v.get("path") or "").lower() not in blocked]
# Gộp VST từ plugin_dirs user đã scan — list_available() CHỈ quét vst_dir
# env (mặc định /opt/daw_engine/vst3) → Synth dropdown không thấy VSTi mà
# Plugin Manager đã scan trong thư mục user chọn (bug: nút Synth rỗng).
extra = [v for v in _scan_vst_in_dirs(d["plugin_dirs"])
if (v.get("path") or "").lower() not in fx_paths]
if (v.get("path") or "").lower() not in blocked]
by_id = {v["id"]: v for v in avail["vst_instruments"]}
for v in extra:
by_id.setdefault(v["id"], v)