debug: log _playNoteFluid params + stopNote activeNotes keys

This commit is contained in:
2026-07-27 15:56:28 +07:00
parent ce7d23c351
commit 838e173dd7
+5 -2
View File
@@ -320,9 +320,11 @@
stopNote: function (channel, pitch) {
if (channel < 0 || channel > 15) return;
if (_initialized && _fluidModule) {
var mappedCh = _activeNotes[channel + ':' + pitch];
var key = channel + ':' + pitch;
var mappedCh = _activeNotes[key];
console.log("[SonicSF] stopNote ch:", channel, "pitch:", pitch, "key:", key, "mappedCh:", mappedCh, "activeKeys:", Object.keys(_activeNotes));
if (mappedCh === undefined) mappedCh = channel;
delete _activeNotes[channel + ':' + pitch];
delete _activeNotes[key];
try {
var r1 = _fluidModule._fluid_synth_noteoff(_synthPtr, mappedCh, pitch);
if (r1 !== 0) {
@@ -352,6 +354,7 @@
},
_playNoteFluid: function (note, velocity, durationMs, startTime, program, channel, synthEngine) {
console.log("[SonicSF] _playNoteFluid chParam:", channel, "synthEngine:", synthEngine ? synthEngine.soundfont_id + ':' + synthEngine.soundfont_bank + ':' + synthEngine.soundfont_program : 'null');
var midiPitch = Math.min(127, Math.max(0, parseInt(note) || 60));
var midiVel = Math.min(127, Math.max(1, Math.floor(
typeof velocity === 'number' ? (velocity > 1 ? velocity : velocity * 127) : 100