fix: send CC64=0 + CC121=0 before noteOff (reset sustain + all controllers)

This commit is contained in:
2026-07-27 12:02:50 +07:00
parent 9357e4fcc8
commit 4def86168b
+5 -1
View File
@@ -173,10 +173,14 @@
stopNote: function (channel, pitch) {
if (channel < 0 || channel > 15) return;
if (_initialized && _synthInstance) {
// Ensure sustain is OFF before noteOff (SpessaSynth uses >=8192 threshold)
try { _synthInstance.controllerChange(channel, 64, 0); } catch (e) {}
// Standard noteOff with multiple velocity variants
try { _synthInstance.noteOff(channel, pitch); } catch (e) {}
try { _synthInstance.noteOff(channel, pitch, 0); } catch (e) {}
try { _synthInstance.allNotesOff(channel); } catch (e) {}
// Backup: All Notes Off + reset controllers
try { _synthInstance.controllerChange(channel, 123, 0); } catch (e) {}
try { _synthInstance.controllerChange(channel, 121, 0); } catch (e) {}
}
},