fix absolute time

This commit is contained in:
Felix Roos 2022-04-02 21:46:56 +02:00
parent c3b15fffa4
commit 86b1e992a1
3 changed files with 12 additions and 9 deletions

View file

@ -27,7 +27,7 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw }) {
const cycle = useCycle({
onDraw,
onEvent: useCallback(
(time, event) => {
(time, event, startedAt) => {
try {
onEvent?.(event);
const { onTrigger, velocity } = event.context;
@ -41,7 +41,7 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw }) {
/* console.warn('no instrument chosen', event);
throw new Error(`no instrument chosen for ${JSON.stringify(event)}`); */
} else {
onTrigger(time, event);
onTrigger(time, event, startedAt);
}
} catch (err) {
console.warn(err);