From c884f3c53395a307d0b2e64e609b0e773a3d81c2 Mon Sep 17 00:00:00 2001 From: 3dtours Date: Sun, 26 Jul 2026 18:44:43 +0700 Subject: [PATCH] fix: clone buffer before addSoundBank, re-await isReady, force program 0 - Clone ArrayBuffer before sendToWorklet (transfer neuters original) - Re-await synthInstance.isReady after addSoundBank - Force controllerChange(0,0,0) + programChange(0,0) after load --- app/static/js/services/soundfontPlayer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/static/js/services/soundfontPlayer.js b/app/static/js/services/soundfontPlayer.js index 59227ee..491bf6e 100644 --- a/app/static/js/services/soundfontPlayer.js +++ b/app/static/js/services/soundfontPlayer.js @@ -103,7 +103,13 @@ } } try { - await _synthInstance.soundBankManager.addSoundBank(buffer, sfId); + // Clone buffer before sending to worklet (avoids transfer neutering) + const bufCopy = buffer.slice(0); + await _synthInstance.soundBankManager.addSoundBank(bufCopy, sfId); + await _synthInstance.isReady; + // Force program 0 on channel 0 to activate loaded bank + this.controllerChange(0, 0, 0); + this.programChange(0, 0); _currentSfId = sfId; console.log("[SonicSF] SoundFont loaded:", sfId); } catch (e) {