FIX: sửa lỗi MIDI item không play được qua carla, loop không tắt với soundfont

This commit is contained in:
2026-08-10 11:33:47 +07:00
parent 1cf5b18492
commit d20932a68b
5 changed files with 46 additions and 5 deletions
+17 -1
View File
@@ -9096,7 +9096,23 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
} catch (err) { console.error('playNote error:', err); }
}
},
onMouseUp: () => { keybedMouseDownRef.current = false; }
onMouseUp: () => {
keybedMouseDownRef.current = false;
// Dng note khi th phím tránh kt âm (loop liên tc) vi soundfont
try {
if (window.SonicSF && window.SonicSF.stopNote) window.SonicSF.stopNote(kbCtx.ch, pitch);
} catch (e) {}
if (window.__carlaKeybedTimer) { clearTimeout(window.__carlaKeybedTimer); window.__carlaKeybedTimer = null; }
if (window.SonicCarlaMidi) { try { window.SonicCarlaMidi.noteOff(kbCtx.ch, pitch); } catch (e) {} }
},
onMouseLeave: () => {
if (!keybedMouseDownRef.current) return;
// Kéo chut ra khi phím dng note ca phím đó
try {
if (window.SonicSF && window.SonicSF.stopNote) window.SonicSF.stopNote(kbCtx.ch, pitch);
} catch (e) {}
if (window.SonicCarlaMidi) { try { window.SonicCarlaMidi.noteOff(kbCtx.ch, pitch); } catch (e) {} }
}
}, showLabel && label)
);
}