Cleaning ziffers timing
This commit is contained in:
@ -101,28 +101,26 @@ export class Player extends Event {
|
|||||||
this.skipIndex = 0;
|
this.skipIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main logic
|
const patternIsStarting = (this.notStarted() &&
|
||||||
const howAboutNow =
|
(this.pulse() === 0 || this.origin() >= this.nextBeatInTicks()) &&
|
||||||
// If pattern is just starting
|
this.origin() >= this.waitTime);
|
||||||
(this.notStarted() &&
|
|
||||||
(this.pulse() === 0 || this.origin() >= this.nextBeatInTicks()) &&
|
const timeToPlayNext = (this.current &&
|
||||||
this.origin() >= this.waitTime) ||
|
this.pulseToSecond(this.origin()) >=
|
||||||
// If pattern is already playing
|
this.pulseToSecond(this.lastCallTime) +
|
||||||
(this.current &&
|
this.pulseToSecond(this.current.duration*4*this.app.clock.ppqn) &&
|
||||||
this.pulseToSecond(this.origin()) >=
|
this.origin() >= this.waitTime);
|
||||||
this.pulseToSecond(this.lastCallTime) +
|
|
||||||
this.current.duration *
|
|
||||||
4 *
|
|
||||||
this.pulseToSecond(this.app.api.ppqn()) &&
|
|
||||||
this.origin() >= this.waitTime);
|
|
||||||
|
|
||||||
|
// If pattern is starting or it's time to play next event
|
||||||
|
const areWeThereYet = patternIsStarting || timeToPlayNext;
|
||||||
|
|
||||||
// Increment index of how many times call is skipped
|
// Increment index of how many times call is skipped
|
||||||
this.skipIndex = howAboutNow ? 0 : this.skipIndex + 1;
|
this.skipIndex = areWeThereYet ? 0 : this.skipIndex + 1;
|
||||||
|
|
||||||
// Increment index of how many times sound/midi have been called
|
// Increment index of how many times sound/midi have been called
|
||||||
this.index = howAboutNow ? this.index + 1 : this.index;
|
this.index = areWeThereYet ? this.index + 1 : this.index;
|
||||||
|
|
||||||
if (howAboutNow && this.notStarted()) {
|
if (areWeThereYet && this.notStarted()) {
|
||||||
this.initCallTime = this.app.clock.pulses_since_origin;
|
this.initCallTime = this.app.clock.pulses_since_origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +128,7 @@ export class Player extends Event {
|
|||||||
this.startCallTime = this.app.clock.pulses_since_origin;
|
this.startCallTime = this.app.clock.pulses_since_origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
return howAboutNow;
|
return areWeThereYet;
|
||||||
};
|
};
|
||||||
|
|
||||||
sound(name: string) {
|
sound(name: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user