Remove webaudio from core dependencies

This commit is contained in:
Nikita 2025-10-20 21:24:27 +03:00
parent 2a0635879c
commit 0f652e8b5b
5 changed files with 24 additions and 38 deletions

View file

@ -91,8 +91,6 @@ export function repl({
const stop = () => scheduler.stop();
const start = () => scheduler.start();
const exportAudio = async (begin, end, sampleRate, downloadName = undefined) =>
await scheduler.exportAudio(begin, end, sampleRate, downloadName);
const pause = () => scheduler.pause();
const toggle = () => scheduler.toggle();
const setCps = (cps) => {
@ -259,23 +257,23 @@ export function repl({
}
};
const setCode = (code) => updateState({ code });
return { scheduler, evaluate, start, exportAudio, stop, pause, setCps, setPattern, setCode, toggle, state };
return { scheduler, evaluate, start, stop, pause, setCps, setPattern, setCode, toggle, state };
}
export const getTrigger =
({ getTime, defaultOutput }) =>
async (hap, deadline, duration, cps, t) => {
// ^ this signature is different from hap.context.onTrigger, as set by Pattern.onTrigger(onTrigger)
// TODO: get rid of deadline after https://codeberg.org/uzu/strudel/pulls/1004
try {
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
await defaultOutput(hap, deadline, duration, cps, t);
async (hap, deadline, duration, cps, t) => {
// ^ this signature is different from hap.context.onTrigger, as set by Pattern.onTrigger(onTrigger)
// TODO: get rid of deadline after https://codeberg.org/uzu/strudel/pulls/1004
try {
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
await defaultOutput(hap, deadline, duration, cps, t);
}
if (hap.context.onTrigger) {
// call signature of output / onTrigger is different...
await hap.context.onTrigger(hap, getTime(), cps, t);
}
} catch (err) {
errorLogger(err, 'getTrigger');
}
if (hap.context.onTrigger) {
// call signature of output / onTrigger is different...
await hap.context.onTrigger(hap, getTime(), cps, t);
}
} catch (err) {
errorLogger(err, 'getTrigger');
}
};
};