fix: SpessaSynth init retry + default SF3 auto-load

- getAudioContext() calls SonicSF.init on every call (not just first)
- soundfontPlayer.init retries after 1s if SpessaSynth module not loaded yet
- Auto-loads sgm_v2.01 SF3 on successful init
- Fixes race condition: module script loads after regular scripts
This commit is contained in:
2026-07-26 17:59:15 +07:00
parent 29c4c45791
commit 23601007bf
3 changed files with 16 additions and 6 deletions
+3 -3
View File
@@ -37,13 +37,13 @@ function getAudioContext() {
if (window.SonicAudio && window.SonicAudio.initAudioWorklet) {
window.SonicAudio.initAudioWorklet();
}
if (window.SonicSF && window.SonicSF.init) {
window.SonicSF.init(audioCtx);
}
}
if (audioCtx.state === 'suspended') {
audioCtx.resume();
}
if (window.SonicSF && window.SonicSF.init) {
window.SonicSF.init(audioCtx);
}
return audioCtx;
}
const formatTime = secs => {