clear sounds + cps on pattern change

+ similar to shuffle
This commit is contained in:
Felix Roos 2023-12-08 09:18:33 +01:00
parent b03bf9ec3d
commit cec8553fb5

View File

@ -247,9 +247,15 @@ export function Repl({ embedded = false }) {
stop();
}
};
const handleUpdate = (newCode) => {
const handleUpdate = async (newCode, reset = false) => {
if (reset) {
clearCanvas();
resetLoadedSounds();
scheduler.setCps(1);
await prebake(); // declare default samples
}
(newCode || isDirty) && activateCode(newCode);
logger('[repl] code updated! tip: you can also update the code by pressing ctrl+enter', 'highlight');
logger('[repl] code updated!');
};
const handleShuffle = async () => {