Use setvalueattime to pin values and prevent bleed

This commit is contained in:
Aria 2025-12-04 22:50:28 -06:00
parent d50af71ba1
commit 4c99f4866b
3 changed files with 16 additions and 13 deletions

View file

@ -175,10 +175,11 @@ export function registerSynthSounds() {
};
const factory = () => new AudioWorkletNode(ac, 'supersaw-oscillator', { outputChannelCount: [2] });
const o = getNodeFromPool('supersaw', factory);
const now = ac.currentTime;
Object.entries(params).forEach(([key, value]) => {
if (value !== undefined) {
o.parameters.get(key).value = value;
}
const param = o.parameters.get(key);
const target = value !== undefined ? value : param.defaultValue;
param.setValueAtTime(target, now);
});
o.port.postMessage({ type: 'initialize' });
o.port.onmessage = (e) => {