using getTicksAtTime for better accuracy when getting progress

This commit is contained in:
Yotam Mann 2017-12-27 16:29:15 -05:00
parent d72fba9bf7
commit 7bd133ca02

View file

@ -576,7 +576,9 @@ define(["Tone/core/Tone", "Tone/core/Clock", "Tone/type/Type", "Tone/core/Timeli
Object.defineProperty(Tone.Transport.prototype, "progress", { Object.defineProperty(Tone.Transport.prototype, "progress", {
get : function(){ get : function(){
if (this.loop){ if (this.loop){
return (this.ticks - this._loopStart) / (this._loopEnd - this._loopStart); var now = this.now();
var ticks = this._clock.getTicksAtTime(now);
return (ticks - this._loopStart) / (this._loopEnd - this._loopStart);
} else { } else {
return 0; return 0;
} }