diff nodescore.js @ 60:e868cdd4b3e9

.
author tzara <rc-web@kiben.net>
date Sun, 21 Apr 2013 23:41:13 +0000
parents 5ba250832739
children 9bf133b91890
line wrap: on
line diff
--- a/nodescore.js	Tue Apr 02 15:14:25 2013 +0000
+++ b/nodescore.js	Sun Apr 21 23:41:13 2013 +0000
@@ -184,46 +184,41 @@
 	socket.emit('chronFromServer', chron)
     }
 
-
     ////////////////////////////////////////////
     // magic square sequencer (this should be modularised)
     ////////////////////////////////////////////
-    
     // all the variables this sequencer needs are in scoreB.js
-
     requirejs(['scoreB'],function(scoreB) {});
-
     var sequencerState = 0;
     var countdowntick = function(seq){
-	
 	// var tempoms = Math.floor(60000/seq.mm)
 	var tempoms = Math.floor(60000/seq.mm)	
 	var timemultiplier=1000
 	var outcount = 8; var incount=8;
-	var time = ((seq.durations[seq.counter]+1) *timemultiplier) + 30000 + (outcount*tempoms);
+	var time = (( seq.durations[seq.counter]+1 ) 
+		    * timemultiplier ) 
+	    + 30000 + (outcount*tempoms);
 	var time = Math.floor(time)
 	var ztime = time; 
 	var totaltime = Math.floor(time/tempoms)
 	var unit = seq.units[seq.counter];
 	var unitlast = seq.units[seq.counter-1];
 	var voice = seq.voice;
-	
 	 // initiate first page here
 	socket.broadcast.emit("pageFlipfromserver", 
-			      voice, unit, time, seq.mm,seq.counter,unitlast);
+			      voice, unit, time, 
+			      seq.mm,seq.counter,unitlast);
 	socket.emit("pageFlipfromserver", 
-		    voice, unit, time, seq.mm,seq.counter,unitlast);
+		    voice, unit, time, 
+		    seq.mm,seq.counter,unitlast);
 	 
 	function sequenCer() {
-
 	    if (ztime >= 0 ){
-		
 		// basic unit is still the second/1000ms - change this to tempoms? no i dont think so
 		// count in and count out
 		////////////////////////////////////////////
-		
 		var counter = Math.floor(ztime/tempoms)
-		
+
 		if (counter >= 0 ){
 		    socket.broadcast.emit('counterText', 
 					  voice, unit, counter,seq.counter,unitlast);
@@ -232,35 +227,33 @@
 		    
 		    if (counter <= outcount ) {
 			socket.broadcast.emit('countinFromServer', 
-					      voice, counter, "","stop in: ", "red", "transparent",unit);
+					      voice, counter, 
+					      "","stop in: ", "red", "transparent",unit);
 			socket.emit('countinFromServer', 
-				    voice, counter, "","stop in: ", "red", "transparent",unit);
+				    voice, counter, 
+				    "","stop in: ", "red", "transparent",unit);
 		    }
 		    
 		    if (counter > (totaltime)-incount  && counter <= totaltime ) {
 			socket.broadcast.emit('countinFromServer',
-					      voice, counter-(totaltime-incount), "","play in: ", "green","transparent",unit);
+					      voice, counter-(totaltime-incount), 
+					      "","play in: ", "green","transparent",unit);
 			socket.emit('countinFromServer',
-				    voice,counter-(totaltime-incount), "","play in: ", "green","transparent",unit);
+				    voice,counter-(totaltime-incount), 
+				    "","play in: ", "green","transparent",unit);
 		    }
 		    
 		    if (counter == (totaltime)-incount ) {
 			socket.broadcast.emit('countinFromServer',
-					      voice, "+", "","playing.. ", "green","transparent",unit);
+					      voice, "+", 
+					      "","playing.. ", "green","transparent",unit);
 			socket.emit('countinFromServer',
-				    voice, "+", "","playing.. ", "green","transparent",unit);
+				    voice, "+",
+				    "","playing.. ", "green","transparent",unit);
 		    }
-		    
-		    // remove displayed number with " " at end of both countin/out
-		    
-		    if (counter == 0 ) {
-			socket.broadcast.emit('countinFromServer', 
-					      voice, "", "","", "green","transparent",unit);
-			socket.broadcast.emit('counterText', voice, seq.counter, "", unit);
-			socket.emit('counterText', voice, seq.counter, "",unit);
-		    }
+
 		}		    
-		
+	
 		// on each beat do:
 		
 		
@@ -297,18 +290,13 @@
     };
     
     step = function (seq) {
-	//clearInterval(seq.boo);
 	clearInterval(countdowntick);
 	countdowntick(seq)
 	sequencerState=1;
     };
     
-    socket.on('resetSeq', function () { 
-	console.log("reset")
-	resetChr();		
-    });
+    socket.on('resetSeq', function () { resetChr(); });
 
-    
     ////////////////////////////////////////////  
     // some latency calculations
     ///////////////////////////////////////////