Merge remote-tracking branch 'origin/main' into migrate-tutorial-fanchor

This commit is contained in:
Felix Roos 2024-05-31 10:47:25 +02:00
commit 33322be948
2 changed files with 32 additions and 23 deletions

View file

@ -10,10 +10,10 @@ import cx from '@src/cx.mjs';
import { transpiler } from '@strudel/transpiler';
import {
getAudioContext,
initAudioOnFirstClick,
webaudioOutput,
resetGlobalEffects,
resetLoadedSounds,
initAudioOnFirstClick,
} from '@strudel/webaudio';
import { defaultAudioDeviceName } from '../settings.mjs';
import { getAudioDevices, setAudioDevice } from './util.mjs';
@ -42,9 +42,10 @@ import { getMetadata } from '../metadata_parser';
const { latestCode } = settingsMap.get();
let modulesLoading, presets, drawContext, clearCanvas, isIframe;
let modulesLoading, presets, drawContext, clearCanvas, isIframe, audioReady;
if (typeof window !== 'undefined') {
initAudioOnFirstClick();
audioReady = initAudioOnFirstClick();
modulesLoading = loadModules();
presets = prebake();
drawContext = getDrawContext();
@ -88,6 +89,7 @@ export function Repl({ embedded = false }) {
clearHydra();
}
},
beforeEval: () => audioReady,
afterEval: (all) => {
const { code } = all;
setLatestCode(code);