fix: schedule noteOff even cho immediate notes (durationMs < 60000)

Trước đây chỉ schedule noteOff khi delay > 0 (notes scheduled).
Virtual piano keyboard play note immediate (delay===0) với duration=500ms
nhưng không có noteOff → âm thanh play mãi không tắt.
Fix: schedule noteOff khi 0 < durationMs < 60000, không phụ thuộc delay.
This commit is contained in:
2026-07-27 15:36:03 +07:00
parent b947237c3c
commit 3d7bae94f2
+1 -1
View File
@@ -371,7 +371,7 @@
try { try {
console.log("[SonicSF] noteOn ch:", ch, "pitch:", midiPitch, "vel:", midiVel); console.log("[SonicSF] noteOn ch:", ch, "pitch:", midiPitch, "vel:", midiVel);
_fluidModule._fluid_synth_noteon(_synthPtr, ch, midiPitch, midiVel); _fluidModule._fluid_synth_noteon(_synthPtr, ch, midiPitch, midiVel);
if (delay > 0) { if (durationMs > 0 && durationMs < 60000) {
scheduledNote.off = setTimeout(function () { scheduledNote.off = setTimeout(function () {
try { try {
_fluidModule._fluid_synth_noteoff(_synthPtr, ch, midiPitch); _fluidModule._fluid_synth_noteoff(_synthPtr, ch, midiPitch);