fix: serve SpessaSynth processor locally to avoid CDN version mismatch

- Download spessasynth_processor.min.js from CDN, serve as static file
- Change __SpessaSynthCDN to /static/js/services/
- Fix version mismatch between esm.sh library and CDN processor
This commit is contained in:
2026-07-26 18:47:32 +07:00
parent c884f3c533
commit 4d42b8407c
3 changed files with 25 additions and 4 deletions
+6 -3
View File
@@ -107,9 +107,12 @@
const bufCopy = buffer.slice(0); const bufCopy = buffer.slice(0);
await _synthInstance.soundBankManager.addSoundBank(bufCopy, sfId); await _synthInstance.soundBankManager.addSoundBank(bufCopy, sfId);
await _synthInstance.isReady; await _synthInstance.isReady;
// Force program 0 on channel 0 to activate loaded bank // Force bank+program select on all channels to activate loaded bank
this.controllerChange(0, 0, 0); for (let ch = 0; ch < 16; ch++) {
this.programChange(0, 0); try { _synthInstance.controllerChange(ch, 0, 0); } catch (e) {}
try { _synthInstance.controllerChange(ch, 32, 0); } catch (e) {}
try { _synthInstance.programChange(ch, 0); } catch (e) {}
}
_currentSfId = sfId; _currentSfId = sfId;
console.log("[SonicSF] SoundFont loaded:", sfId); console.log("[SonicSF] SoundFont loaded:", sfId);
} catch (e) { } catch (e) {
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -13,7 +13,7 @@
<script type="module"> <script type="module">
import { WorkletSynthesizer } from 'https://esm.sh/spessasynth_lib@4.3.1'; import { WorkletSynthesizer } from 'https://esm.sh/spessasynth_lib@4.3.1';
window.SpessaSynthClass = WorkletSynthesizer; window.SpessaSynthClass = WorkletSynthesizer;
window.__SpessaSynthCDN = 'https://cdn.jsdelivr.net/npm/spessasynth_lib@4.3.1/dist/'; window.__SpessaSynthCDN = '/static/js/services/';
console.log('[SonicSF] SpessaSynth library loaded via esm.sh.'); console.log('[SonicSF] SpessaSynth library loaded via esm.sh.');
</script> </script>
<script src="/static/js/services/api.js?v=202607232105"></script> <script src="/static/js/services/api.js?v=202607232105"></script>