fix: ruler range drag/move, default cursor, SonicSF smooth stopAll
This commit is contained in:
@@ -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]);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user