From 55362d272af2844137f0f60f4b5e68fd845050cf Mon Sep 17 00:00:00 2001 From: Jer Noble Date: Tue, 3 Feb 2015 16:47:12 -0800 Subject: [PATCH 1/1] When playing back in reverse, make sure the grain to be played takes that into account. --- sound.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound.js b/sound.js index a00d422..6a481c5 100644 --- a/sound.js +++ b/sound.js @@ -272,8 +272,10 @@ Sound.prototype = { this.node.buffer = this.buffer; this.node.playbackRate.value = this._playbackRate; this.node.onended = this.onended.bind(this); - var remainingDuration = this._playbackRate < 0 ? this.nextStartTime : this.buffer.duration - this.nextStartTime; - this.node.start(0, this.nextStartTime, remainingDuration); + if (this._playbackRate < 0) + this.node.start(0, 0, this.nextStartTime); + else + this.node.start(0, this.nextStartTime, this.buffer.duration - this.nextStartTime); this.timeUpdateTimer = setInterval(this.sendTimeUpdate.bind(this), 250); }, -- 2.40.1