fix latency issues for larger intervals

This commit is contained in:
Felix Roos 2022-08-23 21:52:24 +02:00
parent 24f8f48a2f
commit d0b07c4890

View File

@ -42,7 +42,8 @@ export class Scheduler {
if (!hap.part.begin.equals(hap.whole.begin)) {
return;
}
const scheduled = time + (hap.whole.begin - begin) / this.cps + latency - passed; // this took me ages...
// the following line took me ages to come up with.. handle with care
const scheduled = time + (hap.whole.begin - begin) / this.cps - passed + interval + latency;
const duration = hap.duration / this.cps; // TODO: use legato / duration of objectified value
const now = getTime();
const deadline = scheduled - now;