From 24901163cb21a9c74f64da3ce0d6aa6af80a3e99 Mon Sep 17 00:00:00 2001 From: Miika Alonen Date: Thu, 24 Aug 2023 11:46:29 +0300 Subject: [PATCH] Synced ziffers to onbeat --- src/classes/ZPlayer.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/classes/ZPlayer.ts b/src/classes/ZPlayer.ts index c22c773..a12425a 100644 --- a/src/classes/ZPlayer.ts +++ b/src/classes/ZPlayer.ts @@ -27,8 +27,15 @@ export class Player extends Event { return this.current; } + pulseToSecond = (pulse: number): number => { + return this.app.clock.convertPulseToSecond(pulse); + } + areWeThereYet = (): boolean => { - const howAboutNow = (this.ziffers.notStarted() || this.app.api.epulse() > this.callTime+(this.current.duration*this.app.api.ppqn())); + const howAboutNow = (this.ziffers.notStarted() || + this.pulseToSecond(this.app.api.epulse()) > + this.pulseToSecond(this.callTime) + + this.current.duration * this.pulseToSecond(this.app.api.ppqn() * 4)) if(howAboutNow) { this.tick = 0; } else {