mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 13:38:40 +00:00
can now set latency on the scheduler
This commit is contained in:
parent
87de8c0800
commit
25d6ff1c90
@ -10,11 +10,11 @@ import { State, TimeSpan } from '@strudel.cycles/core';
|
|||||||
export class Scheduler {
|
export class Scheduler {
|
||||||
worker;
|
worker;
|
||||||
pattern;
|
pattern;
|
||||||
constructor({ audioContext, interval = 0.2, onEvent }) {
|
constructor({ audioContext, interval = 0.2, onEvent, latency = 0.2 }) {
|
||||||
this.worker = new ClockWorker(
|
this.worker = new ClockWorker(
|
||||||
audioContext,
|
audioContext,
|
||||||
(begin, end) => {
|
(begin, end) => {
|
||||||
this.pattern.query(new State(new TimeSpan(begin, end))).forEach((e) => {
|
this.pattern.query(new State(new TimeSpan(begin + latency, end + latency))).forEach((e) => {
|
||||||
if (!e.part.begin.equals(e.whole.begin)) {
|
if (!e.part.begin.equals(e.whole.begin)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user