revert: remove 100ms delay from stopNote, keep instant noteOff

This commit is contained in:
2026-07-27 11:27:39 +07:00
parent 0e051297b0
commit 48e4047a84
+2 -5
View File
@@ -163,13 +163,10 @@
stopNote: function (channel, pitch) { stopNote: function (channel, pitch) {
if (channel < 0 || channel > 15) return; if (channel < 0 || channel > 15) return;
if (!_initialized || !_synthInstance) return; if (_initialized && _synthInstance) {
// Delay noteOff by 100ms for natural release
const timer = setTimeout(() => {
try { _synthInstance.noteOff(channel, pitch); } catch (e) {} try { _synthInstance.noteOff(channel, pitch); } catch (e) {}
try { _synthInstance.noteOff(channel, pitch, 0); } catch (e) {} try { _synthInstance.noteOff(channel, pitch, 0); } catch (e) {}
}, 100); }
_scheduledNotes.push({ on: null, off: timer });
}, },
playNote: function (note, velocity, durationMs, startTime, program, destinationNode, channel, synthEngine) { playNote: function (note, velocity, durationMs, startTime, program, destinationNode, channel, synthEngine) {