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
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user