Fix worklets not loading

This commit is contained in:
Nikita 2025-10-19 19:44:53 +03:00
parent 920776fdfe
commit 908c0e44ff
6 changed files with 28 additions and 23 deletions

View file

@ -348,7 +348,7 @@ export function applyFM(param, value, begin) {
duration,
} = value;
let modulator;
let stop = () => {};
let stop = () => { };
if (fmModulationIndex) {
const ac = getAudioContext();

View file

@ -208,11 +208,11 @@ export function registerWorklet(url) {
}
let workletsLoading;
function loadWorklets() {
export function loadWorklets() {
if (!workletsLoading) {
const audioCtx = getAudioContext();
const allWorkletURLs = externalWorklets.concat([workletsUrl]);
workletsLoading = Promise.all(allWorkletURLs.map((workletURL) => audioCtx.audioWorklet.addModule(workletURL)));
workletsLoading = Promise.all(allWorkletURLs.map((workletURL) => audioCtx.audioWorklet.addModule(workletURL))).then(() => workletsLoading = undefined);
}
return workletsLoading;