Update zifferjs and fix some bugs

This commit is contained in:
2023-08-30 18:19:04 +03:00
parent 93029401a7
commit 43eff8bda2
6 changed files with 47 additions and 33 deletions

View File

@ -71,7 +71,7 @@ export class Player extends Event {
};
origin = (): number => {
return this.app.clock.pulses_since_origin;
return this.app.clock.pulses_since_origin+1;
};
pulse = (): number => {
@ -86,6 +86,10 @@ export class Player extends Event {
return this.app.clock.next_beat_in_ticks;
};
nextBeatInTicks = (): number => {
return this.app.clock.next_beat_in_ticks;
};
// Check if it's time to play the event
areWeThereYet = (): boolean => {
// If clock has stopped
@ -100,17 +104,14 @@ export class Player extends Event {
const howAboutNow =
// If pattern is just starting
(this.notStarted() &&
(this.app.clock.time_position.pulse === 1 ||
this.app.clock.pulses_since_origin >=
this.app.clock.next_beat_in_ticks) &&
this.app.clock.pulses_since_origin >= this.waitTime) || // If pattern is already playing
(this.pulse() === 1 || this.origin() >= this.nextBeatInTicks()) &&
this.origin() >= this.waitTime) ||
// If pattern is already playing
(this.current &&
this.pulseToSecond(this.app.clock.pulses_since_origin) >=
this.pulseToSecond(this.lastCallTime) +
this.current.duration *
4 *
this.pulseToSecond(this.app.api.ppqn()) &&
this.app.clock.pulses_since_origin >= this.waitTime);
this.pulseToSecond(this.origin()) >=
this.pulseToSecond(this.lastCallTime) +
this.current.duration * 4 * this.pulseToSecond(this.app.api.ppqn()) &&
this.origin() >= this.waitTime);
// Increment index of how many times call is skipped
this.skipIndex = howAboutNow ? 0 : this.skipIndex + 1;