Merge pull request #539 from tidalcycles/setcps-reset-only-on-shuffle

do not reset cps before eval #517
This commit is contained in:
Felix Roos 2023-03-23 22:39:26 +01:00 committed by GitHub
commit acaf0ca0af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 11 deletions

View File

@ -42,17 +42,6 @@ export function repl({
}
try {
await beforeEval?.({ code });
scheduler.setCps(1); // reset cps in case the code does not contain a setCps call
// problem: when the code does contain a setCps after an awaited promise,
// the cps will be 1 until the promise resolves
// example:
/*
await new Promise(resolve => setTimeout(resolve,1000))
setCps(.5)
note("c a f e")
*/
// to make sure the setCps inside the code is called immediately,
// it has to be placed first
let { pattern } = await _evaluate(code, transpiler);
logger(`[eval] code updated`);

View File

@ -206,6 +206,7 @@ export function Repl({ embedded = false }) {
logger(`[repl] ✨ loading random tune "${name}"`);
clearCanvas();
resetLoadedSounds();
scheduler.setCps(1);
await prebake(); // declare default samples
await evaluate(code, false);
};