Improve naming & backward compat

This commit is contained in:
jeromew 2025-12-04 08:23:36 +00:00
parent b65cc2128f
commit 0b711e879c

View file

@ -291,7 +291,7 @@ function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000
//filters //filters
const numStages = 1; //num of filters in series const numStages = 1; //num of filters in series
let fOffset = 0; let fOffset = 282; //for backward compat in #1800
const filterChain = []; const filterChain = [];
for (let i = 0; i < numStages; i++) { for (let i = 0; i < numStages; i++) {
const filter = ac.createBiquadFilter(); const filter = ac.createBiquadFilter();
@ -304,7 +304,7 @@ function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000
fOffset += 282; fOffset += 282;
filterChain.push(filter); filterChain.push(filter);
} }
return { phaser: filterChain, lfo }; return { filterChain, lfo };
} }
function getFilterType(ftype) { function getFilterType(ftype) {
@ -694,9 +694,9 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
} }
// phaser // phaser
if (phaserrate !== undefined && phaserdepth > 0) { if (phaserrate !== undefined && phaserdepth > 0) {
const { phaser, lfo } = getPhaser(t, endWithRelease, phaserrate, phaserdepth, phasercenter, phasersweep); const { filterChain, lfo } = getPhaser(t, endWithRelease, phaserrate, phaserdepth, phasercenter, phasersweep);
audioNodes.push(lfo); audioNodes.push(lfo);
Array.prototype.push.apply(chain, phaser); chain.push(...filterChain);
} }
// last gain // last gain