feat: native host bridge integration — C++ bridge, Rust SHM, JS routing, build scripts, docs
- native_bridge/: InstrumentEngineManager multi-channel, sample-accurate, CC/program/pitchbend, transport, Vst3Instrument stub (HAVE_VST3SDK) - src-tauri: shm.rs, bridge spawn + audio pump + health monitor, open_vst_gui, externalBin, commands - app: UnifiedMidiRouter, NativeBridgeService, bridgeAudioNode, audioRoutingEngine, Plugin Manager UI, Bridge/WASM indicator, set_position sync - build: 3 ps1 (force-added, build/ ignored), verify_bundle --check-bridge, CI workflow - docs: TASKS.md, TEST_NOTES.md (Windows verify checklist), install/report updates
This commit is contained in:
@@ -551,6 +551,36 @@ def resolve_preset_path(preset_id_or_path: str) -> str:
|
||||
return ""
|
||||
|
||||
|
||||
def resolve_plugin_path(name_or_path: str, ext: str = "") -> str:
|
||||
"""E3: resolve path thật của plugin/soundfont cho Native Bridge (E2).
|
||||
ext: '.vst3' | '.vst2' | '.sf2' | '.sf3' | '.sfz' — filter phần mở rộng
|
||||
khi quét plugin_dirs. Trả '' nếu không tìm thấy. Chống path traversal:
|
||||
chỉ tên file (không separator) hoặc path tồn tại được chấp nhận."""
|
||||
if not name_or_path:
|
||||
return ""
|
||||
p = name_or_path
|
||||
if os.path.isfile(p):
|
||||
return p
|
||||
base = os.path.basename(p.replace("\\", "/"))
|
||||
base_noext = os.path.splitext(base)[0].lower()
|
||||
want_ext = ext.lower() if ext else None
|
||||
dirs = []
|
||||
try:
|
||||
dirs = list(_load_user_plugin_dirs()) or []
|
||||
except Exception:
|
||||
pass
|
||||
dirs += [settings.VST_DIR, settings.SOUNDFONT_DIR]
|
||||
for base_dir in dirs:
|
||||
if not os.path.isdir(base_dir):
|
||||
continue
|
||||
for root, _, files in os.walk(base_dir):
|
||||
for fn in files:
|
||||
if want_ext and not fn.lower().endswith(want_ext):
|
||||
continue
|
||||
if fn.lower() == base.lower() or os.path.splitext(fn)[0].lower() == base_noext:
|
||||
return os.path.join(root, fn)
|
||||
return ""
|
||||
|
||||
def apply_preset_to_plugin(plugin, preset_id=None, preset_path=None, preset_data_b64=None) -> bool:
|
||||
"""Gán preset lên plugin pedalboard: bytes nhúng (base64 .vstpreset) ưu
|
||||
tiên, sau đó preset_id (thư viện), sau preset_path (file). Trả True nếu
|
||||
|
||||
Reference in New Issue
Block a user