move supradough to separate package

This commit is contained in:
Felix Roos 2025-06-06 16:17:05 +02:00
parent ccc90d547c
commit 43c05cb504
No known key found for this signature in database
15 changed files with 102 additions and 33 deletions

View file

@ -190,11 +190,18 @@ export function getAudioContextCurrentTime() {
return getAudioContext().currentTime;
}
let externalWorklets = [];
export function registerWorklet(url) {
externalWorklets.push(url);
}
let workletsLoading;
function loadWorklets() {
if (!workletsLoading) {
const audioCtx = getAudioContext();
workletsLoading = audioCtx.audioWorklet.addModule(workletsUrl);
const allWorkletURLs = externalWorklets.concat([workletsUrl]);
console.log('allWorkletURLs', allWorkletURLs);
workletsLoading = Promise.all(allWorkletURLs.map((workletURL) => audioCtx.audioWorklet.addModule(workletURL)));
}
return workletsLoading;