changeset 2426:77404bde464c

Implemented #29 for AB
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 27 May 2016 15:12:47 +0100
parents c859ec64acca
children b33d6988152c
files interfaces/AB.js js/specification.js tests/examples/AB_example.xml xml/test-schema.xsd
diffstat 4 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/interfaces/AB.js	Fri May 27 14:58:20 2016 +0100
+++ b/interfaces/AB.js	Fri May 27 15:12:47 2016 +0100
@@ -315,14 +315,23 @@
         }
         this.startPlayback = function()
         {
-            $('.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()
         {
-            $(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.exportXMLDOM = function(audioObject)
 		{
--- a/js/specification.js	Fri May 27 14:58:20 2016 +0100
+++ b/js/specification.js	Fri May 27 15:12:47 2016 +0100
@@ -13,6 +13,7 @@
     this.crossFade = null;
     this.preSilence = null;
     this.postSilence = null;
+    this.playOne = null;
     
     // nodes
     this.metrics = null;
@@ -448,6 +449,7 @@
 		this.preTest = null;
 		this.postTest = null;
 		this.interfaces = [];
+        this.playOne = null;
 		this.commentBoxPrefix = "Comment on track";
 		this.audioElements = [];
 		this.commentQuestions = [];
--- a/tests/examples/AB_example.xml	Fri May 27 14:58:20 2016 +0100
+++ b/tests/examples/AB_example.xml	Fri May 27 15:12:47 2016 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <waet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test-schema.xsd">
-	<setup interface="AB" projectReturn="save.php" randomiseOrder='true' poolSize="2" loudness="-23" sampleRate="44100">
+	<setup interface="AB" projectReturn="save.php" randomiseOrder='true' poolSize="2" loudness="-23" sampleRate="44100" playOne="true">
 		<survey location="before">
 			<surveyentry type="question" id="sessionId" mandatory="true">
 				<statement>Please enter your name.</statement>
--- a/xml/test-schema.xsd	Fri May 27 14:58:20 2016 +0100
+++ b/xml/test-schema.xsd	Fri May 27 15:12:47 2016 +0100
@@ -26,6 +26,8 @@
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>
+        
+        <xs:attribute name="playOne" type="xs:boolean" default="false"/>
 
         <!-- define complex elements-->
         <xs:element name="waet">
@@ -62,6 +64,7 @@
                 </xs:attribute>
                 <xs:attribute ref="preSilence" />
                 <xs:attribute ref="postSilence" />
+                <xs:attribute ref="playOne" />
             </xs:complexType>
         </xs:element>
 
@@ -97,6 +100,7 @@
                 <xs:attribute ref="alwaysInclude" />
                 <xs:attribute ref="preSilence" />
                 <xs:attribute ref="postSilence" />
+                <xs:attribute ref="playOne" />
             </xs:complexType>
         </xs:element>