# HG changeset patch # User Nicholas Jillings # Date 1509377078 0 # Node ID 451e104f8667a42ebe5d5bc0d614a04bee4e4626 # Parent ab52da8becbe3a660dbf21c603b41c1da4bde531# Parent 311596aedb7b444cf6898d6fc1f436727012b2f5 Merge branch 'master' into vnext diff -r ab52da8becbe -r 451e104f8667 js/core.js --- a/js/core.js Tue Oct 17 17:02:10 2017 -0400 +++ b/js/core.js Mon Oct 30 15:24:38 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 () {