fix: stuck MIDI notes when ARM toggled off mid-note

Remove !st.isArmed guard in note-off handler. Stop note on ALL
tracks regardless of ARM state — FluidSynth stopNote on inactive
channel/pitch is a no-op, so this is safe.
This commit is contained in:
2026-07-29 10:02:30 +07:00
parent fa7815bb53
commit 5ed943b3d6
3 changed files with 18 additions and 11 deletions
+9 -9
View File
@@ -7122,15 +7122,15 @@ const App = () => {
lastMidiNoteRef.current = { ...current, length: lenSec };
setLastMidiNote(prev => prev && prev.pitch === pitch ? { ...prev, length: lenSec, time: Date.now() } : prev);
}
// Stop the note on ALL armed tracks' dedicated channels
if (window.SonicSF && window.SonicSF.stopNote) {
var stopTracks = activeTracksRef.current || [];
stopTracks.forEach(function(st) {
if (!st.isArmed) return;
var stCh = window.SonicPianoRoll ? window.SonicPianoRoll.getTrackMidiChannel(st, stopTracks) : (st.midiChannel !== undefined ? st.midiChannel : 0);
window.SonicSF.stopNote(stCh, pitch);
});
}
// Stop the note on ALL tracks (not just armed) to prevent stuck notes
// when ARM is toggled off while a key is held
if (window.SonicSF && window.SonicSF.stopNote) {
var stopTracks = activeTracksRef.current || [];
stopTracks.forEach(function(st) {
var stCh = window.SonicPianoRoll ? window.SonicPianoRoll.getTrackMidiChannel(st, stopTracks) : (st.midiChannel !== undefined ? st.midiChannel : 0);
window.SonicSF.stopNote(stCh, pitch);
});
}
}
// Sustain (CC64), Modulation (CC1), Pitch Bend