Also set values immediately for supersaw and wavetable
This commit is contained in:
parent
85e79d9932
commit
21e6d81d34
3 changed files with 3 additions and 5 deletions
|
|
@ -155,7 +155,7 @@ export function getCompressor(ac, threshold, ratio, knee, attack, release) {
|
|||
release: release ?? 0.05,
|
||||
};
|
||||
Object.entries(options).forEach(([key, value]) => {
|
||||
node[key].value = value;;
|
||||
node[key].value = value;
|
||||
});
|
||||
return node;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,11 +178,10 @@ 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]) => {
|
||||
const param = o.parameters.get(key);
|
||||
const target = value !== undefined ? value : param.defaultValue;
|
||||
param.setValueAtTime(target, now);
|
||||
param.value = target;
|
||||
});
|
||||
o.port.postMessage({ type: 'initialize' });
|
||||
const gainAdjustment = 1 / Math.sqrt(voices);
|
||||
|
|
|
|||
|
|
@ -244,11 +244,10 @@ export async function onTriggerSynth(t, value, onended, tables, cps, frameLen) {
|
|||
};
|
||||
const factory = () => new AudioWorkletNode(ac, 'wavetable-oscillator-processor', { outputChannelCount: [2] });
|
||||
const source = getNodeFromPool('wavetable', factory);
|
||||
const now = ac.currentTime;
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
const param = source.parameters.get(key);
|
||||
const target = value !== undefined ? value : param.defaultValue;
|
||||
param.setValueAtTime(target, now);
|
||||
param.value = target;
|
||||
});
|
||||
source.port.postMessage({ type: 'initialize', payload });
|
||||
if (ac.currentTime > t) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue