changeset 3051:9dc50ba0c13f

Merge branch 'vnext' into Dev_main
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Mon, 30 Oct 2017 15:24:44 +0000
parents aa86f045d338 (current diff) 451e104f8667 (diff)
children 3f34bb9c4762
files js/core.js
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/js/core.js	Tue Oct 17 17:03:10 2017 -0400
+++ b/js/core.js	Mon Oct 30 15:24:44 2017 +0000
@@ -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 () {