fix(preview): download soundfont resolve plugin_dirs + fallback default GM (hết oscillator)
This commit is contained in:
@@ -601,6 +601,16 @@ async def download_soundfont_asset(sf_id: str):
|
||||
except Exception as e:
|
||||
print(f"[soundfont-download] SF3->SF2 conversion failed for {full}: {e}")
|
||||
return FileResponse(full, media_type="application/octet-stream", filename="soundfont.sf3")
|
||||
# Not found in the 3 standard dirs -> resolve like offline render
|
||||
# (render_engine._find_sf2_path): scan user plugin_dirs (Downloads...),
|
||||
# then fall back to default GM font. UI preview must hear the SAME
|
||||
# instrument as offline; before, 404 -> soundfontPlayer.js played a
|
||||
# fallback oscillator (synth sound).
|
||||
resolved = _find_sf2_path(clean_id)
|
||||
if not resolved or not os.path.exists(resolved):
|
||||
resolved = _find_default_sf2()
|
||||
if resolved and os.path.exists(resolved):
|
||||
return FileResponse(resolved, media_type="application/octet-stream", filename=os.path.basename(resolved))
|
||||
raise HTTPException(status_code=404, detail="SoundFont asset not found")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user