proper draw cleanup

This commit is contained in:
Felix Roos 2022-11-13 13:58:36 +01:00
parent aa76419eda
commit 8f31fbe275
5 changed files with 157 additions and 154 deletions

View file

@ -47,4 +47,4 @@ currently broken / buggy:
- [ ] find a way to display errors when console is closed / another tab selected
- [x] scheduler.getPhase is quantized to clock interval
- => draw was choppy + that also caused useHighlighting bugs
- [ ] pianoroll keeps rolling when pressing stop
- [ ] pianoroll keeps rolling when pressing stop

View file

@ -114,6 +114,10 @@ function App() {
defaultOutput: webaudioOutput,
getTime,
autolink: true,
beforeEval: () => {
cleanupUi();
cleanupDraw();
},
});
// init code
@ -175,7 +179,6 @@ function App() {
} else {
logger('[repl] stopped. tip: you can also stop by pressing ctrl+dot', 'highlight');
stop();
// cleanupDraw();
}
};
const handleUpdate = () => {
@ -186,9 +189,6 @@ function App() {
const handleShuffle = async () => {
const { code, name } = getRandomTune();
logger(`[repl] ✨ loading random tune "${name}"`);
cleanupDraw();
cleanupUi();
resetLoadedSamples();
await prebake(); // declare default samples
await evaluate(code, false);