# HG changeset patch # User Nicholas Jillings # Date 1455880967 0 # Node ID c9d94c0725391b84f8e6ea3734c00d733e582606 # Parent d5fd92bcaa6f0d8ba46b1a3b7384cd999019498e Playback now tracks for looped playback exactly. diff -r d5fd92bcaa6f -r c9d94c072539 core.js --- a/core.js Fri Feb 19 10:40:52 2016 +0000 +++ b/core.js Fri Feb 19 11:22:47 2016 +0000 @@ -21,6 +21,8 @@ // Add a prototype to the bufferSourceNode to reference to the audioObject holding it AudioBufferSourceNode.prototype.owner = undefined; +// Add a prototype to the bufferSourceNode to hold when the object was given a play command +AudioBufferSourceNode.prototype.playbackStartTime = undefined; // Add a prototype to the bufferNode to hold the desired LINEAR gain AudioBuffer.prototype.playbackGain = undefined; // Add a prototype to the bufferNode to hold the computed LUFS loudness @@ -1319,6 +1321,7 @@ this.outputGain.gain.setValueAtTime(0.0,startTime); } this.bufferNode.start(startTime); + this.bufferNode.playbackStartTime = startTime; } }; @@ -1337,19 +1340,7 @@ this.getCurrentPosition = function() { var time = audioEngineContext.timer.getTestTime(); if (this.bufferNode != undefined) { - if (this.bufferNode.loop == true) { - if (audioEngineContext.status == 1) { - return (time-this.metric.listenStart)%this.buffer.buffer.duration; - } else { - return 0; - } - } else { - if (this.metric.listenHold) { - return time - this.metric.listenStart; - } else { - return 0; - } - } + return (time - this.bufferNode.playbackStartTime)%this.buffer.buffer.duration; } else { return 0; } @@ -2809,6 +2800,7 @@ this.stop = function() { clearInterval(this.interval); this.interval = undefined; + this.scrubberHead.style.left = '0px'; if (this.maxTime < 60) { this.curTimeSpan.textContent = '0.00'; } else {