mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 20:48:27 +00:00
Merge pull request #539 from tidalcycles/setcps-reset-only-on-shuffle
do not reset cps before eval #517
This commit is contained in:
commit
acaf0ca0af
@ -42,17 +42,6 @@ export function repl({
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await beforeEval?.({ code });
|
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);
|
let { pattern } = await _evaluate(code, transpiler);
|
||||||
|
|
||||||
logger(`[eval] code updated`);
|
logger(`[eval] code updated`);
|
||||||
|
|||||||
@ -206,6 +206,7 @@ export function Repl({ embedded = false }) {
|
|||||||
logger(`[repl] ✨ loading random tune "${name}"`);
|
logger(`[repl] ✨ loading random tune "${name}"`);
|
||||||
clearCanvas();
|
clearCanvas();
|
||||||
resetLoadedSounds();
|
resetLoadedSounds();
|
||||||
|
scheduler.setCps(1);
|
||||||
await prebake(); // declare default samples
|
await prebake(); // declare default samples
|
||||||
await evaluate(code, false);
|
await evaluate(code, false);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user