fix: ruler range drag/move, default cursor, SonicSF smooth stopAll

This commit is contained in:
2026-07-26 11:42:06 +07:00
parent d3c28d2fa7
commit e18b261943
3 changed files with 48 additions and 17 deletions
+11 -3
View File
@@ -153,7 +153,7 @@
osc.stop(stopAt);
const oscId = `${note}_${Date.now()}_${Math.random()}`;
activeOscillators[oscId] = osc;
activeOscillators[oscId] = { osc, gain: noteGain };
// Clean up active oscillator reference after it stops
setTimeout(() => {
@@ -164,8 +164,16 @@
},
stopAll: function () {
Object.values(activeOscillators).forEach(osc => {
try { osc.stop(); } catch (e) { }
const ctx = getCtx();
Object.values(activeOscillators).forEach(entry => {
try {
if (entry.gain) {
entry.gain.gain.cancelScheduledValues(ctx.currentTime);
entry.gain.gain.setValueAtTime(entry.gain.gain.value || 1, ctx.currentTime);
entry.gain.gain.linearRampToValueAtTime(0.001, ctx.currentTime + 0.008);
}
if (entry.osc) entry.osc.stop(ctx.currentTime + 0.01);
} catch (e) { }
});
Object.keys(activeOscillators).forEach(k => delete activeOscillators[k]);
},