diff ape.js @ 8:a6364db4c2ea

All tracks start muted. Clicking on sliders un-mutes that track. All tracks loop until stopped
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Wed, 25 Mar 2015 12:56:42 +0000
parents 6a6272b06d34
children 94e080247b11
line wrap: on
line diff
--- a/ape.js	Wed Mar 25 12:48:29 2015 +0000
+++ b/ape.js	Wed Mar 25 12:56:42 2015 +0000
@@ -155,6 +155,14 @@
 		trackSliderObj.style.float = "left";
 		trackSliderObj.draggable = true;
 		trackSliderObj.ondragend = dragEnd;
+		
+		// Onclick, switch playback to that track
+		trackSliderObj.onclick = function() {
+			// Get the track ID from the object ID
+			var id = Number(this.id.substr(13,2)); // Maximum theoretical tracks is 99!
+			audioEngineContext.selectedTrack(id);
+		}
+		
 		canvas.appendChild(trackSliderObj);
 	})