mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-19 17:48:33 +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() {
|
function updateHighlights() {
|
||||||
const audioTime = Tone.getTransport().seconds;
|
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) });
|
view.dispatch({ effects: setHighlights.of(events) });
|
||||||
frame = requestAnimationFrame(updateHighlights);
|
frame = requestAnimationFrame(updateHighlights);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user