changeset 463:32757cefeee0 Dev_main

Core.js now randomises the audio elements when asked to on page creation. AB has stricter selection policies, selection can occur only once playback has started.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Tue, 12 Jan 2016 11:50:38 +0000
parents 0db687b660f1
children 90fd092c3d5c
files AB.js core.js example_eval/AB_example.xml
diffstat 3 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/AB.js	Tue Jan 12 11:18:01 2016 +0000
+++ b/AB.js	Tue Jan 12 11:50:38 2016 +0000
@@ -138,11 +138,18 @@
 		this.box.appendChild(this.playback);
 		this.selector.onclick = function()
 		{
+			var time = audioEngineContext.timer.getTestTime();
 			if ($(event.currentTarget).hasClass('disabled'))
 			{
 				console.log("Please wait until sample has loaded");
 				return;
 			}
+			if (audioEngineContext.status == 0)
+			{
+				alert("Please listen to the samples before making a selection");
+				console.log("Please listen to the samples before making a selection");
+				return;
+			}
 			$(".comparitor-selector").removeClass('selected');
 			var id = event.currentTarget.parentElement.getAttribute('track-id');
 			interfaceContext.comparitor.selected = id;
@@ -155,8 +162,9 @@
 				} else {
 					obj.value = 0;
 				}
-				obj.parent.metric.moved(audioEngineContext.timer.getTestTime(),obj.value);
+				obj.parent.metric.moved(time,obj.value);
 			}
+			console.log("Selected "+id+' ('+time+')');
 		};
 		this.playback.onclick = function()
 		{
--- a/core.js	Tue Jan 12 11:18:01 2016 +0000
+++ b/core.js	Tue Jan 12 11:50:38 2016 +0000
@@ -747,6 +747,10 @@
 			if (this.currentStateMap == null)
 			{
 				this.currentStateMap = this.stateMap[this.stateIndex];
+				if (this.currentStateMap.randomiseOrder)
+				{
+					this.currentStateMap.audioElements = randomiseOrder(this.currentStateMap.audioElements);
+				}
 				storage.createTestPageStore(this.currentStateMap);
 				if (this.currentStateMap.preTest != null)
 				{
--- a/example_eval/AB_example.xml	Tue Jan 12 11:18:01 2016 +0000
+++ b/example_eval/AB_example.xml	Tue Jan 12 11:50:38 2016 +0000
@@ -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='false' testPages="2" loudness="-23" sampleRate="44100">
+	<setup interface="AB" projectReturn="save.php" randomiseOrder='true' testPages="2" loudness="-23" sampleRate="44100">
 		<survey location="before">
 			<surveyentry type="question" id="sessionId" mandatory="true">
 				<statement>Please enter your name.</statement>