Mercurial > hg > webaudioevaluationtool
changeset 2949:311596aedb7b
Fix for #249
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Mon, 30 Oct 2017 15:24:22 +0000 |
parents | bfd19c39f2f3 |
children | 3dc059f3b57c 451e104f8667 |
files | js/core.js |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/js/core.js Tue Oct 17 21:46:16 2017 +0100 +++ b/js/core.js Mon Oct 30 15:24:22 2017 +0000 @@ -1083,12 +1083,12 @@ this.popupResponse.innerHTML = ""; this.popupTitle.innerHTML = ""; var strings = node.specification.statement.split("\n"); - strings.forEach(function(e,i,a){ + strings.forEach(function (e, i, a) { a[i] = e.trim(); }); node.specification.statement = strings.join("\n"); var statementElements = p.parseFromString(converter.makeHtml(node.specification.statement), "text/html").querySelector("body").children; - while(statementElements.length > 0) { + while (statementElements.length > 0) { this.popupTitle.appendChild(statementElements[0]); } if (node.specification.type == 'question') { @@ -1912,6 +1912,7 @@ this.url = null; // Hold the URL given for the output back to the results. this.metric = new metricTracker(this); this.storeDOM = null; + this.playing = false; // Bindings for GUI this.interfaceDOM = null; @@ -1988,21 +1989,23 @@ }; this.listenStart = function (setTime) { - if (this.outputGain.gain.value !== this.onplayGain) { + if (this.playing === false) { playCounter++; this.outputGain.gain.linearRampToValueAtTime(this.onplayGain, setTime); this.metric.startListening(audioEngineContext.timer.getTestTime()); this.bufferNode.playbackStartTime = audioEngineContext.timer.getTestTime(); this.interfaceDOM.startPlayback(); + this.playing = true; } }; this.listenStop = function (setTime) { - if (this.outputGain.gain.value !== 0.0) { + if (this.playing === true) { this.outputGain.gain.linearRampToValueAtTime(0.0, setTime); this.metric.stopListening(audioEngineContext.timer.getTestTime(), this.getCurrentPosition()); } this.interfaceDOM.stopPlayback(); + this.playing = false; }; this.setupPlayback = function () {