compute the start of the next tick using the tickDuration instead of getTimeOfTick

fixes #706
This commit is contained in:
Yotam Mann 2020-09-23 22:01:03 -04:00
parent 9c1b303bcf
commit 530a997a07

View file

@ -569,7 +569,8 @@ export class Transport extends ToneWithContext<TransportOptions> implements Emit
if (this.state === "started") {
const ticks = this._clock.getTicksAtTime(now);
// schedule to start on the next tick, #573
const time = this._clock.getTimeOfTick(Math.ceil(ticks));
const remainingTick = this._clock.frequency.getDurationOfTicks(Math.ceil(ticks) - ticks, now);
const time = now + remainingTick;
this.emit("stop", time);
this._clock.setTicksAtTime(t, time);
// restart it with the new time