From 00566e8ea6a14e781a5e825ff438cf497b63734f Mon Sep 17 00:00:00 2001 From: 3dtours Date: Mon, 27 Jul 2026 15:27:53 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20stopNote=20d=C3=B9ng=20noteoff+noteon(ve?= =?UTF-8?q?l0)=20thay=20v=C3=AC=20all=5Fsounds=5Foff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bỏ _fluid_synth_all_sounds_off (kill cả chord) - Thử noteoff + noteon(vel=0) - MIDI noteOff alternate - Log cả 2 return code --- app/static/js/services/soundfontPlayer.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/static/js/services/soundfontPlayer.js b/app/static/js/services/soundfontPlayer.js index 254a8ce..efd8e50 100644 --- a/app/static/js/services/soundfontPlayer.js +++ b/app/static/js/services/soundfontPlayer.js @@ -305,14 +305,13 @@ stopNote: function (channel, pitch) { if (channel < 0 || channel > 15) return; if (_initialized && _fluidModule) { - console.log("[SonicSF] stopNote ch:", channel, "pitch:", pitch); try { - var r = _fluidModule._fluid_synth_noteoff(_synthPtr, channel, pitch); - if (r !== 0) console.warn("[SonicSF] noteoff returned:", r); - } catch (e) { console.warn("[SonicSF] noteoff error:", e); } - try { - _fluidModule._fluid_synth_all_sounds_off(_synthPtr, channel); - } catch (e) {} + var r1 = _fluidModule._fluid_synth_noteoff(_synthPtr, channel, pitch); + var r2 = _fluidModule._fluid_synth_noteon(_synthPtr, channel, pitch, 0); + if (r1 !== 0 && r2 !== 0) { + console.warn("[SonicSF] noteoff/non failed ch:", channel, "pitch:", pitch, "r:", r1, r2); + } + } catch (e) { console.warn("[SonicSF] stopNote error:", e); } } },