mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
filter out inactive events
This commit is contained in:
parent
a6dac6ded3
commit
f6d128842a
@ -10,7 +10,10 @@ function useHighlighting({ view, pattern, started }) {
|
||||
|
||||
function updateHighlights() {
|
||||
const audioTime = Tone.getTransport().seconds;
|
||||
const events = pattern.queryArc(audioTime, audioTime + 1 / 60);
|
||||
const span = { begin: audioTime, end: audioTime + 1 / 60 };
|
||||
// TODO: remove isActive workaround when query is fixed
|
||||
const isActive = (event) => event.whole.end >= span.begin && event.whole.begin <= span.end;
|
||||
const events = pattern.queryArc(span.begin, span.end).filter(isActive);
|
||||
view.dispatch({ effects: setHighlights.of(events) });
|
||||
frame = requestAnimationFrame(updateHighlights);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user