# HG changeset patch # User Nicholas Jillings # Date 1455880967 0 # Node ID 743ad112d2a8f4f0faf61e173cbcf5a7596c7eb0 # Parent 02e49021fd1960b89afc7fadd904ccee9cf9d918 Playback now tracks for looped playback exactly. diff -r 02e49021fd19 -r 743ad112d2a8 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 {