Prebake in settings
Update prebake without reload
This commit is contained in:
parent
b4e171f5b4
commit
9f2237e11d
11 changed files with 292 additions and 37 deletions
|
|
@ -6,7 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||
|
||||
import { code2hash, getPerformanceTimeSeconds, logger, silence } from '@strudel/core';
|
||||
import { getDrawContext } from '@strudel/draw';
|
||||
import { evaluate, transpiler } from '@strudel/transpiler';
|
||||
import { evaluate, evaluateUserPrebake, transpiler } from '@strudel/transpiler';
|
||||
import {
|
||||
getAudioContextCurrentTime,
|
||||
renderPatternAudio,
|
||||
|
|
@ -89,7 +89,7 @@ export function useReplContext() {
|
|||
prebake: async () =>
|
||||
Promise.all([modulesLoading, presets]).then(() => {
|
||||
if (prebakeScript?.length) {
|
||||
return evaluate(prebakeScript ?? '');
|
||||
return evaluateUserPrebake(prebakeScript ?? '');
|
||||
}
|
||||
}),
|
||||
onUpdateState: (state) => {
|
||||
|
|
@ -181,6 +181,16 @@ export function useReplContext() {
|
|||
editorRef.current?.updateSettings(editorSettings);
|
||||
}, [_settings]);
|
||||
|
||||
useEffect(() => {
|
||||
const prebake = async () =>
|
||||
Promise.all([modulesLoading, presets]).then(() => {
|
||||
if (prebakeScript?.length) {
|
||||
return evaluateUserPrebake(prebakeScript ?? '');
|
||||
}
|
||||
});
|
||||
editorRef.current?.updatePrebake(prebake);
|
||||
}, [prebakeScript]);
|
||||
|
||||
//
|
||||
// UI Actions
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue