changeset 996:902f22e182f6

Fixed Bug 1204: Multiple clicks creates multiple instances.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Fri, 01 May 2015 16:07:15 +0100
parents 3444a772d19e
children e736301ff2e1
files ape.js core.js example_eval/project.xml
diffstat 3 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ape.js	Fri May 01 15:52:13 2015 +0100
+++ b/ape.js	Fri May 01 16:07:15 2015 +0100
@@ -401,14 +401,11 @@
 		audioEngineContext.selectedTrack = function(id) {
 			for (var i=0; i<this.audioObjects.length; i++)
 			{
-				if (id == i) {
-					this.audioObjects[i].outputGain.gain.value = 1.0;
-					this.audioObjects[i].play(audioContext.currentTime+0.01);
-				} else {
-					this.audioObjects[i].outputGain.gain.value = 0.0;
-					this.audioObjects[i].stop();
-				}
+				this.audioObjects[i].outputGain.gain.value = 0.0;
+				this.audioObjects[i].stop();
 			}
+			this.audioObjects[id].outputGain.gain.value = 1.0;
+			this.audioObjects[id].play(audioContext.currentTime+0.01);
 		};
 	}
 	
--- a/core.js	Fri May 01 15:52:13 2015 +0100
+++ b/core.js	Fri May 01 16:07:15 2015 +0100
@@ -170,8 +170,11 @@
 	};
 	
 	this.stop = function() {
-		this.bufferNode.stop(0);
-		this.bufferNode = undefined;
+		if (this.bufferNode != undefined)
+		{
+			this.bufferNode.stop(0);
+			this.bufferNode = undefined;
+		}
 	};
 
 	this.constructTrack = function(url) {
--- a/example_eval/project.xml	Fri May 01 15:52:13 2015 +0100
+++ b/example_eval/project.xml	Fri May 01 16:07:15 2015 +0100
@@ -18,7 +18,7 @@
 			<metricEnable>elementFlagMoved</metricEnable>
 		</Metric>
 	</setup>
-	<audioHolder id='0' hostURL="example_eval/" sampleRate="44100" randomiseOrder='true' repeatCount='1' loop='true' elementComments='true'>
+	<audioHolder id='0' hostURL="example_eval/" sampleRate="44100" randomiseOrder='true' repeatCount='1' loop='false' elementComments='true'>
 		<interface>
 			<title>Example Test Question</title>
 			<scale position="0">Min</scale>