fix: add debug log to stopNote for troubleshooting

This commit is contained in:
2026-07-27 11:14:09 +07:00
parent 0246255792
commit 90ff65f31d
+7 -1
View File
@@ -163,8 +163,14 @@
stopNote: function (channel, pitch) {
if (channel < 0 || channel > 15) return;
console.log("[SonicSF] stopNote ch=" + channel + " pitch=" + pitch + " init=" + _initialized);
if (_initialized && _synthInstance) {
try { _synthInstance.noteOff(channel, pitch); } catch (e) {}
try { _synthInstance.noteOff(channel, pitch); } catch (e) {
console.warn("[SonicSF] noteOff threw:", e);
}
} else {
// Oscillator fallback: stop is handled by the 60000ms timeout
// Nothing to do — oscillator auto-stops after durationMs
}
},