Slightly better sync. onbeat() starts now from the first beat
This commit is contained in:
@ -884,11 +884,12 @@ export class UserAPI {
|
|||||||
*/
|
*/
|
||||||
let final_pulses: boolean[] = [];
|
let final_pulses: boolean[] = [];
|
||||||
beat.forEach((b) => {
|
beat.forEach((b) => {
|
||||||
b = (b % this.app.clock.time_signature[0]) + 1;
|
const _mod = b % this.app.clock.time_signature[0];
|
||||||
|
b = _mod === 0 ? b : _mod;
|
||||||
let integral_part = Math.floor(b);
|
let integral_part = Math.floor(b);
|
||||||
let decimal_part = b - integral_part;
|
let decimal_part = b - integral_part;
|
||||||
final_pulses.push(
|
final_pulses.push(
|
||||||
integral_part === this.app.clock.time_position.beat &&
|
integral_part === this.app.clock.time_position.beat &&
|
||||||
this.app.clock.time_position.pulse ===
|
this.app.clock.time_position.pulse ===
|
||||||
decimal_part * this.app.clock.ppqn
|
decimal_part * this.app.clock.ppqn
|
||||||
);
|
);
|
||||||
|
|||||||
@ -38,9 +38,9 @@ export class Player extends Event {
|
|||||||
|
|
||||||
areWeThereYet = (): boolean => {
|
areWeThereYet = (): boolean => {
|
||||||
const howAboutNow = (
|
const howAboutNow = (
|
||||||
(this.notStarted()) ||
|
(this.notStarted() && this.app.clock.time_position.pulse === 1) ||
|
||||||
(
|
(
|
||||||
this.current &&
|
this.current &&
|
||||||
this.pulseToSecond(this.app.api.epulse()+1) >=
|
this.pulseToSecond(this.app.api.epulse()+1) >=
|
||||||
this.pulseToSecond(this.callTime) +
|
this.pulseToSecond(this.callTime) +
|
||||||
(this.current.duration*4) * this.pulseToSecond(this.app.api.ppqn())
|
(this.current.duration*4) * this.pulseToSecond(this.app.api.ppqn())
|
||||||
|
|||||||
Reference in New Issue
Block a user