changeset 2216:75ef314b5e64

WIP for #2: '<page>' and '<cetup'> nodes have working "poolSize" attribute to determine number of children to take forward.
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 12 Apr 2016 10:50:52 +0100
parents 13f3f7e89bff
children cb27ece65a5c
files core.js example_eval/ABX_example.xml example_eval/AB_example.xml example_eval/mushra_example.xml example_eval/project.xml test-schema.xsd
diffstat 6 files changed, 31 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/core.js	Mon Apr 11 12:03:11 2016 +0100
+++ b/core.js	Tue Apr 12 10:50:52 2016 +0100
@@ -868,25 +868,11 @@
 		}
 		for (var i=0; i<pageHolder.length; i++)
 		{
-			if (specification.testPages <= i && specification.testPages != 0) {break;}
+			if (specification.poolSize <= i && specification.poolSize != 0) {break;}
             pageHolder[i].presentedId = i;
 			this.stateMap.push(pageHolder[i]);
             storage.createTestPageStore(pageHolder[i]);
-            for (var element of pageHolder[i].audioElements) {
-                var URL = pageHolder[i].hostURL + element.url;
-                var buffer = null;
-                for (var buffObj of audioEngineContext.buffers) {
-                    if (URL == buffObj.url) {
-                        buffer = buffObj;
-                        break;
-                    }
-                }
-                if (buffer == null) {
-                    buffer = new audioEngineContext.bufferObj();
-                    buffer.getMedia(URL);
-                    audioEngineContext.buffers.push(buffer);
-                }
-            }
+            audioEngineContext.loadPageData(pageHolder[i]);
 		}
         
 		if (specification.preTest != null) {this.preTestSurvey = specification.preTest;}
@@ -1172,6 +1158,25 @@
             }
         }
 	};
+    
+    this.loadPageData = function(page) {
+        // Load the URL from pages
+        for (var element of page.audioElements) {
+            var URL = page.hostURL + element.url;
+            var buffer = null;
+            for (var buffObj of this.buffers) {
+                if (URL == buffObj.url) {
+                    buffer = buffObj;
+                    break;
+                }
+            }
+            if (buffer == null) {
+                buffer = new this.bufferObj();
+                buffer.getMedia(URL);
+                this.buffers.push(buffer);
+            }
+        }
+    };
 	
 	this.play = function(id) {
 		// Start the timer and set the audioEngine state to playing (1)
--- a/example_eval/ABX_example.xml	Mon Apr 11 12:03:11 2016 +0100
+++ b/example_eval/ABX_example.xml	Tue Apr 12 10:50:52 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="ABX" projectReturn="save.php" randomiseOrder='true' testPages="2" loudness="-23" sampleRate="44100">
+	<setup interface="ABX" projectReturn="save.php" randomiseOrder='true' poolSize="2" loudness="-23" sampleRate="44100">
 		<survey location="before">
 			<surveyentry type="question" id="sessionId" mandatory="true">
 				<statement>Please enter your name.</statement>
--- a/example_eval/AB_example.xml	Mon Apr 11 12:03:11 2016 +0100
+++ b/example_eval/AB_example.xml	Tue Apr 12 10:50:52 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' testPages="2" loudness="-23" sampleRate="44100">
+	<setup interface="AB" projectReturn="save.php" randomiseOrder='true' poolSize="2" loudness="-23" sampleRate="44100">
 		<survey location="before">
 			<surveyentry type="question" id="sessionId" mandatory="true">
 				<statement>Please enter your name.</statement>
--- a/example_eval/mushra_example.xml	Mon Apr 11 12:03:11 2016 +0100
+++ b/example_eval/mushra_example.xml	Tue Apr 12 10:50:52 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="MUSHRA" projectReturn="save.php" randomiseOrder='true' testPages="2" loudness="-23" sampleRate="44100">
+	<setup interface="MUSHRA" projectReturn="save.php" randomiseOrder='true' poolSize="2" loudness="-23" sampleRate="44100">
         <exitText>Thank you for looking at WAET. You can modify the successful completion text as well!</exitText>
 		<survey location="before">
 			<surveyentry type="question" id="sessionId" mandatory="true">
--- a/example_eval/project.xml	Mon Apr 11 12:03:11 2016 +0100
+++ b/example_eval/project.xml	Tue Apr 12 10:50:52 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="APE" projectReturn="save.php" randomiseOrder='true' testPages="2" loudness="-23" sampleRate="44100" calibration="true">
+	<setup interface="APE" projectReturn="save.php" randomiseOrder='true' poolSize="2" loudness="-23" sampleRate="44100" calibration="true">
 		<survey location="before">
 			<surveyentry type="question" id="sessionId" mandatory="true">
 				<statement>Please enter your name.</statement>
--- a/test-schema.xsd	Mon Apr 11 12:03:11 2016 +0100
+++ b/test-schema.xsd	Tue Apr 12 10:50:52 2016 +0100
@@ -9,6 +9,8 @@
         <xs:attribute name="id" type="xs:ID" />
         <xs:attribute name="mandatory" type="xs:boolean" />
         <xs:attribute name="name" type="xs:string" />
+        <xs:attribute name="poolSize" type="xs:nonNegativeInteger" default="0" />
+        <xs:attribute name="alwaysInclude" type="xs:boolean" default="false" />
 
         <xs:attribute name="preSilence" default="0">
             <xs:simpleType>
@@ -46,7 +48,7 @@
                 <xs:attribute name="interface" type="xs:string" use="required" />
                 <xs:attribute name="projectReturn" type="xs:string" use="optional" default="" />
                 <xs:attribute name="randomiseOrder" type="xs:boolean" default="false" />
-                <xs:attribute name="testPages" type="xs:nonNegativeInteger" default="0" />
+                <xs:attribute ref="poolSize" />
                 <xs:attribute name="loudness" type="xs:nonPositiveInteger" use="optional" />
                 <xs:attribute name="sampleRate" type="xs:positiveInteger" use="optional" />
                 <xs:attribute name="calibration" type="xs:boolean" default="false" />
@@ -83,6 +85,8 @@
                         </xs:restriction>
                     </xs:simpleType>
                 </xs:attribute>
+                <xs:attribute ref="poolSize" />
+                <xs:attribute ref="alwaysInclude" />
                 <xs:attribute ref="preSilence" />
                 <xs:attribute ref="postSilence" />
             </xs:complexType>
@@ -168,6 +172,7 @@
                     </xs:simpleType>
                 </xs:attribute>
                 <xs:attribute name="loudness" type="xs:nonPositiveInteger" use="optional" />
+                <xs:attribute ref="alwaysInclude" />
                 <xs:attribute ref="preSilence" />
                 <xs:attribute ref="postSilence" />
             </xs:complexType>