changeset 1609:590e487fe3f1

Only 'Stop' button; 'Start' when any sample is clicked.
author Brecht De Man <b.deman@qmul.ac.uk>
date Sat, 16 May 2015 20:58:15 +0100
parents a21deccefe7d
children 63217e7bd1a7
files ape.js
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ape.js	Sat May 16 17:52:51 2015 +0100
+++ b/ape.js	Sat May 16 20:58:15 2015 +0100
@@ -166,17 +166,14 @@
 	
 	// Create playback start/stop points
 	var playback = document.createElement("button");
-	playback.innerHTML = 'Start';
+	playback.innerHTML = 'Stop';
 	playback.id = 'playback-button';
 	// onclick function. Check if it is playing or not, call the correct function in the
 	// audioEngine, change the button text to reflect the next state.
 	playback.onclick = function() {
-		if (audioEngineContext.status == 0) {
-			audioEngineContext.play();
+		if (audioEngineContext.status == 1) {
+			audioEngineContext.stop();
 			this.innerHTML = 'Stop';
-		} else {
-			audioEngineContext.stop();
-			this.innerHTML = 'Start';
 		}
 	};
 	// Create Submit (save) button
@@ -502,6 +499,7 @@
                 }
                               
             }
+            audioEngineContext.play();
 		};
 		
 		canvas.appendChild(trackSliderObj);
@@ -781,7 +779,7 @@
 	}
 }
 
-function buttonSubmitClick()
+function buttonSubmitClick() // TODO: Only when all songs have been played!
 {
 	if (audioEngineContext.status == 1) {
 		var playback = document.getElementById('playback-button');