changeset 2428:78f2dbe417da

WIP #29
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 27 May 2016 16:16:10 +0100
parents b33d6988152c
children e4fcf54abcf5
files interfaces/ABX.js interfaces/ape.js interfaces/discrete.js
diffstat 3 files changed, 39 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/ABX.js	Fri May 27 16:37:17 2016 +0200
+++ b/interfaces/ABX.js	Fri May 27 16:16:10 2016 +0100
@@ -292,16 +292,23 @@
         };
         this.startPlayback = function()
         {
-            // Called when playback has begun
-            $('.comparator-button').text('Listen');
+            if (this.parent.specification.parent.playOne || specification.playOne) {
+                $('.comparator-button').text('Wait');
+                $('.comparator-button').attr("disabled","true");
+                $(this.playback).css("disabled","false");
+            } else {
+                $('.comparator-button').text('Listen');
+            }
             $(this.playback).text('Stop');
             this.playback.setAttribute("playstate","playing");
         };
         this.stopPlayback = function()
         {
-            // Called when playback has stopped. This gets called even if playback never started!
-            $(this.playback).text('Listen');
-            this.playback.setAttribute("playstate","ready");
+            if (this.playback.getAttribute("playstate") == "playing") {
+                $('.comparator-button').text('Listen');
+                $('.comparator-button').removeAttr("disabled");
+                this.playback.setAttribute("playstate","ready");
+            }
         };
         this.getValue = function()
         {
--- a/interfaces/ape.js	Fri May 27 16:37:17 2016 +0200
+++ b/interfaces/ape.js	Fri May 27 16:16:10 2016 +0100
@@ -621,6 +621,7 @@
 	this.parent = audioObject;
 	this.trackSliderObjects = [];
     this.label = null;
+    this.playing = false;
     switch(audioObject.specification.parent.label) {
         case "letter":
             this.label = String.fromCharCode(97 + index);
@@ -669,15 +670,24 @@
         $(name).addClass('track-slider-playing');
         $('.comment-div').removeClass('comment-box-playing');
         $('#comment-div-'+this.parent.id).addClass('comment-box-playing');
-        var outsideReference = document.getElementById('outside-reference');
-        if (outsideReference != undefined)
-        $(outsideReference).removeClass('track-slider-playing');
+        $('.outside-reference').removeClass('track-slider-playing');
+        this.playing = true;
+        
+        if (this.parent.specification.parent.playOne || specification.playOne) {
+            $('.track-slider').addClass('track-slider-disabled');
+            $('.outside-reference').addClass('track-slider-disabled');
+        }
     };
     this.stopPlayback = function()
     {
-        var name = ".track-slider-"+this.parent.id;
-        $(name).removeClass('track-slider-playing');
-        $('#comment-div-'+this.parent.id).removeClass('comment-box-playing');
+        if (this.playing) {
+            this.playing = false;
+            var name = ".track-slider-"+this.parent.id;
+            $(name).removeClass('track-slider-playing');
+            $('#comment-div-'+this.parent.id).removeClass('comment-box-playing');
+            $('.track-slider').removeClass('track-slider-disabled');
+            $('.outside-reference').removeClass('track-slider-disabled');
+        }
     };
 	this.exportXMLDOM = function(audioObject) {
 		// Called by the audioObject holding this element. Must be present
--- a/interfaces/discrete.js	Fri May 27 16:37:17 2016 +0200
+++ b/interfaces/discrete.js	Fri May 27 16:16:10 2016 +0100
@@ -355,13 +355,21 @@
 		if (outsideReference != null) {
 			$(outsideReference).removeClass('track-slider-playing');
 		}
+        if (this.parent.specification.parent.playOne || specification.playOne) {
+            $('.track-slider-button').text = "Wait";
+            $('.track-slider-button').attr("disabled","true");
+        }
     }
     this.stopPlayback = function()
     {
         // Called by audioObject when playback stops
-        this.play.setAttribute("playstate","ready");
-        $(this.holder).removeClass('track-slider-playing');
-        this.play.textContent = "Play";
+        if (this.play.getAttribute("playstate") == "playing") {
+            this.play.setAttribute("playstate","ready");
+            $(this.holder).removeClass('track-slider-playing');
+            $('.track-slider-button').text = "Play";
+            this.play.textContent = "Play";
+            $('.track-slider-button').removeAttr("disabled");
+        }
     }
     
 	this.getValue = function()