VST FX integration: plugin picker theo category + GUI embed fill viewport (FX Rack & Mastering)

This commit is contained in:
2026-08-19 07:55:57 +07:00
parent 19904bcad8
commit 0cf771242f
5 changed files with 111 additions and 50 deletions
+18 -1
View File
@@ -1,6 +1,7 @@
# SonicForge Studio VST / VSTi Engine Service
import os
import json
import re
import numpy as np
import functools
import threading
@@ -271,6 +272,21 @@ def release_soundfont(path: str):
else:
_FLUID_CACHE[path] = (fl, ref - 1)
def _classify_fx_category(name, path=""):
"""Heuristic phân loại VST FX cho Plugin Picker (spec vst_fx_panel_integration).
C++ scan có subCategoriesString (VD 'Fx|EQ') nhưng không emit ra JSON; dùng
tên plugin để xếp category. Chỉ ảnh hưởng UI grouping, không ảnh hưởng audio."""
s = (" " + name + " " + path).lower()
if any(k in s for k in ("eq", "equalizer", "filter", "graphic", "parametric")) or re.search(r"(^|[^a-z0-9])q([0-9]|[^a-z]|$)", s):
return "equalizer"
if any(k in s for k in ("reverb", "delay", "echo", "chorus", "hall", "space")):
return "reverb_delay"
if any(k in s for k in ("comp", "limiter", "maximizer", "gate", "leveler", "de-ess")):
return "comp_limiter"
if any(k in s for k in ("distortion", "drive", "satur", "overdrive", "fuzz", "amp")):
return "distortion"
return "utility"
class PluginManager:
def __init__(self, vst_dir=None, sf_dir=None, upload_sf_dir=None, extra_vst_dirs=None):
from app.config import settings as _st
@@ -491,7 +507,8 @@ class PluginManager:
continue
name = p.get("name") or os.path.splitext(os.path.basename(path))[0]
results.append({"id": name, "name": name, "path": path,
"type": p.get("type", "VST3")})
"type": p.get("type", "VST3"),
"category": _classify_fx_category(name, path)})
seen, uniq = set(), []
for fx in results:
if fx["path"] in seen: