fix: send All Notes Off (CC123) before each MIDI NoteOn to stop lingering release

This commit is contained in:
2026-07-27 11:21:51 +07:00
parent e866ad1c0d
commit e785b88ea7
+2
View File
@@ -6757,8 +6757,10 @@ const App = () => {
setLastMidiNote({ pitch, velocity, length: 0, time: Date.now() }); setLastMidiNote({ pitch, velocity, length: 0, time: Date.now() });
activeMidiPitchesRef.current.add(pitch); activeMidiPitchesRef.current.add(pitch);
setActiveMidiPitches(new Set(activeMidiPitchesRef.current)); setActiveMidiPitches(new Set(activeMidiPitchesRef.current));
// Stop previous notes on this channel before playing new note
{ if (window.SonicSF) { { if (window.SonicSF) {
const ch = msg.data[0] & 0x0F; const ch = msg.data[0] & 0x0F;
try { window.SonicSF.controllerChange(ch, 123, 0); } catch (e) {}
const arSub = subTabsRef && subTabsRef.current && activeTabRef && subTabsRef.current.find(s => s.id === activeTabRef.current && s.type === 'PIANO_ROLL' && s.isArmed); const arSub = subTabsRef && subTabsRef.current && activeTabRef && subTabsRef.current.find(s => s.id === activeTabRef.current && s.type === 'PIANO_ROLL' && s.isArmed);
if (arSub) { if (arSub) {
window.SonicSF.playNote(pitch, velocity, 60000, undefined, arSub.instrumentProgram, null, ch, arSub.synth_engine); window.SonicSF.playNote(pitch, velocity, 60000, undefined, arSub.instrumentProgram, null, ch, arSub.synth_engine);