FIX: sửa lỗi không load instrument của soundfont trên window
This commit is contained in:
@@ -35,6 +35,21 @@ def _find_sf2_path(sf_id: str) -> str:
|
||||
fbase, fext = os.path.splitext(fname)
|
||||
if fext.lower() in (".sf2", ".sf3") and (fbase.lower() == clean_lower or fbase.lower() == sf_lower):
|
||||
return os.path.join(base_dir, fname)
|
||||
# Thư mục user thêm qua Plugin Manager (plugin_dirs — Add Directory):
|
||||
# soundfont trong thư mục user phải render được (Windows thường dùng cách này)
|
||||
try:
|
||||
from app.core.vst_engine import _load_user_plugin_dirs
|
||||
for base_dir in _load_user_plugin_dirs():
|
||||
if not os.path.isdir(base_dir):
|
||||
continue
|
||||
for root, dirs, files in os.walk(base_dir):
|
||||
for fname in files:
|
||||
fbase, fext = os.path.splitext(fname)
|
||||
if fext.lower() in (".sf2", ".sf3") and (fbase.lower() == clean_lower or fbase.lower() == sf_lower):
|
||||
return os.path.join(root, fname)
|
||||
dirs[:] = [] # không walk sâu
|
||||
except Exception:
|
||||
pass
|
||||
static_dir = os.path.join(settings.APP_DIR, "static", "soundfonts")
|
||||
if os.path.isdir(static_dir):
|
||||
for fname in os.listdir(static_dir):
|
||||
|
||||
Reference in New Issue
Block a user