Skip to content

Commit

Permalink
updated offset error in player._start()
Browse files Browse the repository at this point in the history
  • Loading branch information
lukephills committed Jul 4, 2015
1 parent d299f0e commit 2dc3b9e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Tone/source/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source"], function(To
*/
Tone.Player.prototype._start = function(startTime, offset, duration){
if (this._buffer.loaded){
offset = this.defaultArg(this._startPosition, 0);
//if it's a loop the default offset is the loopstart point
if (this._loop){
offset = this.defaultArg(offset, this._loopStart);
} else {
//otherwise the default offset is 0
offset = this.defaultArg(offset, 0);
}
offset = this.toSeconds(offset);
duration = this.defaultArg(duration, this._buffer.duration - offset);
//the values in seconds
startTime = this.toSeconds(startTime);
Expand Down

0 comments on commit 2dc3b9e

Please sign in to comment.