fix: locateFile cho FluidSynth WASM module (dùng self-host/CDN)
Module script (type=module) có document.currentScript === null,
nên libfluidsynth không thể tự locate .wasm file. Fix: pass
locateFile() trả về URL .wasm tương ứng với URL .js đã load.
fluidsynthLoader.js: expose __FluidSynthLocateWasm() trả về
FLUIDSYNTH_JS_URL.replace('.js', '.wasm'). Dùng polling
setInterval thay vì resolve callback cho đáng tin cậy hơn.
soundfontPlayer.js: pass locateFile factory khi gọi factory.
This commit is contained in:
@@ -73,7 +73,14 @@
|
||||
}
|
||||
|
||||
console.log("[SonicSF] Initializing FluidSynth WASM Engine...");
|
||||
_fluidModule = await window.__FluidSynthModuleFactory();
|
||||
_fluidModule = await window.__FluidSynthModuleFactory({
|
||||
locateFile: function (path) {
|
||||
if (path.endsWith('.wasm')) {
|
||||
return window.__FluidSynthLocateWasm ? window.__FluidSynthLocateWasm() : path;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
});
|
||||
|
||||
if (!_fluidModule || !_fluidModule._new_fluid_settings) {
|
||||
throw new Error("FluidSynth WASM module loaded but API missing");
|
||||
|
||||
Reference in New Issue
Block a user