fix: stopNote sends noteOff(ch,pitch,0) + controllerChange(CC64=0) for safety
This commit is contained in:
@@ -163,14 +163,11 @@
|
|||||||
|
|
||||||
stopNote: function (channel, pitch) {
|
stopNote: function (channel, pitch) {
|
||||||
if (channel < 0 || channel > 15) return;
|
if (channel < 0 || channel > 15) return;
|
||||||
console.log("[SonicSF] stopNote ch=" + channel + " pitch=" + pitch + " init=" + _initialized);
|
|
||||||
if (_initialized && _synthInstance) {
|
if (_initialized && _synthInstance) {
|
||||||
try { _synthInstance.noteOff(channel, pitch); } catch (e) {
|
try { _synthInstance.noteOff(channel, pitch); } catch (e) {}
|
||||||
console.warn("[SonicSF] noteOff threw:", e);
|
try { _synthInstance.controllerChange(channel, 64, 0); } catch (e) {}
|
||||||
}
|
// Also send noteOff with velocity=0 for safety
|
||||||
} else {
|
try { _synthInstance.noteOff(channel, pitch, 0); } catch (e) {}
|
||||||
// Oscillator fallback: stop is handled by the 60000ms timeout
|
|
||||||
// Nothing to do — oscillator auto-stops after durationMs
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user