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); }