refactor scheduler constructor + add onEvent

This commit is contained in:
Felix Roos 2022-04-14 00:32:41 +02:00
parent 5629c0ee72
commit 325eec2c6f
2 changed files with 11 additions and 8 deletions

View file

@ -18,10 +18,13 @@ Loading...</textarea
const { cat, State, TimeSpan } = strudel;
Object.assign(window, strudel); // add strudel to eval scope
const audioContext = getAudioContext();
const interval = 0.1;
const lookahead = 0.5;
const scheduler = new Scheduler(audioContext, interval, lookahead);
const scheduler = new Scheduler({
audioContext: getAudioContext(),
interval: 0.1,
onEvent: (e) => {
e.context?.createAudioNode?.(e);
},
});
let initialCode = `sequence(1,2).mul(55/2) // frequencies
.mul(slowcat(1,2))