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:
@@ -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 ──
|
||||
|
||||
Reference in New Issue
Block a user