fix: single Synth button opens instrument modal, fix init race condition

- Remove small Synth button (already done earlier)
- Large Synth button now calls openInstrumentSelector (instrument modal)
- Fix _initPromise stale cache: reset to null when init fails
- Module not loaded yet → retries on next select instead of stuck
This commit is contained in:
2026-07-27 10:54:58 +07:00
parent cf61b8431d
commit 5c47b68a9d
3 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -44,7 +44,11 @@
if (_initialized && _synthInstance) return;
if (_initPromise) return _initPromise;
_initPromise = (async () => {
if (!window.SpessaSynthClass || !window.__SpessaSynthCDN) return;
if (!window.SpessaSynthClass || !window.__SpessaSynthCDN) {
console.warn("[SonicSF] SpessaSynth CDN not available. Retrying on next select.");
_initPromise = null;
return;
}
try {
if (audioContext.state === 'suspended') await audioContext.resume();
const procUrl = window.__SpessaSynthCDN + "spessasynth_processor.min.js";
@@ -55,6 +59,7 @@
_initialized = true;
} catch (e) {
console.warn("[SonicSF] SpessaSynth init failed:", e);
_initPromise = null;
}
})();
return _initPromise;