From 987ecffc6cf4fb951d71213df3bca4413b9fc912 Mon Sep 17 00:00:00 2001 From: 3dtours Date: Mon, 27 Jul 2026 15:50:28 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20activeNotes=20key=20d=C3=B9ng=20MIDI=20c?= =?UTF-8?q?hannel=20g=E1=BB=91c,=20kh=C3=B4ng=20ph=E1=BA=A3i=20FluidSynth?= =?UTF-8?q?=20channel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Key _activeNotes[ch:midiPitch] dùng ch đã remap (FluidSynth channel), stopNote lookup bằng MIDI channel (0) → không tìm thấy. Fix: key = (channel ?? 0) + ':' + midiPitch (MIDI channel gốc). --- app/static/js/services/soundfontPlayer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/static/js/services/soundfontPlayer.js b/app/static/js/services/soundfontPlayer.js index 09a7d17..bdaf5a4 100644 --- a/app/static/js/services/soundfontPlayer.js +++ b/app/static/js/services/soundfontPlayer.js @@ -394,12 +394,13 @@ try { console.log("[SonicSF] noteOn ch:", ch, "pitch:", midiPitch, "vel:", midiVel); _fluidModule._fluid_synth_noteon(_synthPtr, ch, midiPitch, midiVel); - _activeNotes[ch + ':' + midiPitch] = ch; + _activeNotes[(channel !== undefined ? channel : 0) + ':' + midiPitch] = ch; + var noteMapKey = (channel !== undefined ? channel : 0) + ':' + midiPitch; if (durationMs > 0 && durationMs < 60000) { scheduledNote.off = setTimeout(function () { try { _fluidModule._fluid_synth_noteoff(_synthPtr, ch, midiPitch); - delete _activeNotes[ch + ':' + midiPitch]; + delete _activeNotes[noteMapKey]; } catch (e) {} }, durSec * 1000); }