diff nodescore.js @ 10:0e5543ccb8fb

fixed transport control of metro and countdown visualisation on control page
author tzara <rc-web@kiben.net>
date Fri, 06 Jul 2012 10:48:15 +0100
parents cd847f789b53
children 0a8133490050
line wrap: on
line diff
--- a/nodescore.js	Thu Jul 05 23:53:30 2012 +0100
+++ b/nodescore.js	Fri Jul 06 10:48:15 2012 +0100
@@ -141,7 +141,7 @@
 	var unit = seq.units[seq.counter];
 	var tempoms = 60000/seq.mm
 	
-	tock = setInterval(function(){
+	var tock = setInterval(function(){
 	    
 	    if (ztime >= 0 ){
 		// basic unit is still the second/1000ms - change this to tempoms? no i dont think so
@@ -150,6 +150,8 @@
 		
 		var counter = ztime/1000
 		
+		socket.emit('counterText', seq.voice, seq.counter, counter);
+
 		if (counter > 0 && counter <= outcount ) {              
 		    socket.broadcast.emit('countinFromServer', seq.voice, counter, "","", "white", "transparent");
 		}
@@ -176,10 +178,12 @@
 	    
 	    // flip the page
 	    if (ztime == 0){
+		socket.emit('counterText', seq.voice, seq.counter, " ");
 		seq.counter = (seq.counter + 1) % seq.durations.length	    		
 		socket.broadcast.emit("pageFlipfromserver", seq.voice, unit, time, seq.mm,seq.counter);
 		socket.emit("pageFlipfromserver", seq.voice, unit, time, seq.mm,seq.counter);		
 		step(seq);     
+
 	    }
 
 	    if (ztime < 0){}	    	    	    
@@ -187,6 +191,17 @@
 	    ztime -= 1000
 			
 	}, tempoms)
+
+
+	socket.on('stopSeq', function (seq) { 
+	    console.log("stop")
+	    clearInterval(tock);	    
+	    sequencerState=0;  
+	    stopChr();
+	});
+
+
+
 			  };
     
     step = function (seq) {
@@ -205,11 +220,7 @@
     });
 
     
-    socket.on('stopSeq', function () { 
-	clearInterval(tock);	    
-	sequencerState=0;  
-	stopChr();
-    });
+
 
     socket.on('resetSeq', function () { 
 	console.log("rrrrreset")