This commit is contained in:
Jade (Rose) Rowland 2025-11-01 23:34:10 -04:00
parent 92e3a80e65
commit 91e1cc136e
2 changed files with 64 additions and 42 deletions

View file

@ -280,6 +280,11 @@ export function getVibratoOscillator(param, value, t) {
return vibratoOscillator;
}
}
export function scheduleAtTime(callback, targetTime, audioContext = getAudioContext()) {
const currentTime = audioContext.currentTime;
webAudioTimeout(audioContext, callback, currentTime, targetTime);
}
// ConstantSource inherits AudioScheduledSourceNode, which has scheduling abilities
// a bit of a hack, but it works very well :)
export function webAudioTimeout(audioContext, onComplete, startTime, stopTime) {