Add wavetable oscillator with scanning, warps, and detune

This commit is contained in:
Aria 2025-08-25 08:44:18 -05:00
parent b54139376e
commit 02cd79a6d9
8 changed files with 715 additions and 77 deletions

View file

@ -555,6 +555,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
tremolophase = 0,
tremoloshape,
s = getDefaultValue('s'),
wt,
bank,
source,
gain = getDefaultValue('gain'),
@ -681,8 +682,13 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
let sourceNode;
if (source) {
sourceNode = source(t, value, hapDuration, cps);
} else if (getSound(s)) {
const { onTrigger } = getSound(s);
} else {
const soundSource = wt ?? s;
const sound = getSound(soundSource);
if (!sound) {
throw new Error(`sound ${soundSource} not found! Is it loaded?`);
}
const { onTrigger } = sound;
const onEnded = () => {
audioNodes.forEach((n) => n?.disconnect());
activeSoundSources.delete(chainID);
@ -693,8 +699,6 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
sourceNode = soundHandle.node;
activeSoundSources.set(chainID, soundHandle);
}
} else {
throw new Error(`sound ${s} not found! Is it loaded?`);
}
if (!sourceNode) {
// if onTrigger does not return anything, we will just silently skip