can now set latency on the scheduler
This commit is contained in:
parent
87de8c0800
commit
25d6ff1c90
1 changed files with 2 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue