changeset 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
files nodescore.js www/m/controls.html www/m/js/controlseq.js
diffstat 3 files changed, 27 insertions(+), 15 deletions(-) [+]
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")
--- a/www/m/controls.html	Thu Jul 05 23:53:30 2012 +0100
+++ b/www/m/controls.html	Fri Jul 06 10:48:15 2012 +0100
@@ -15,9 +15,7 @@
 
 	<h1>Multicast Network Score Controls</h1>
     <div class="outermaster">
-
       <div id="client_chronometer">00:00:00.0</div>
-      
       <div class="metrocase">
 	<div id="metronome0"></div>
 	<div id="metronome1"></div>
@@ -25,17 +23,13 @@
 	<div id="metronome3"></div>
       </div>
       
-
       <div>
 	<h2>Calculate Client Latencies</h2><br>
 	<input type="button" value="Get Latencies" onclick="getLatencies(1000);" />
 	<h2 id="client_latency">0ms</h2>
       </div>
-      
-	  
-	  
-	  <h2>Magic Sequencer Monitor</h2><br>
-	  
+      	  
+	  <h2>Magic Sequencer Monitor</h2><br>	  
       <div>
 	<p class="magicsquare" id="1magicsquare0"></p>
 	<p class="magicsquare" id="1magicsquare1"></p>
--- a/www/m/js/controlseq.js	Thu Jul 05 23:53:30 2012 +0100
+++ b/www/m/js/controlseq.js	Fri Jul 06 10:48:15 2012 +0100
@@ -46,7 +46,7 @@
 //////////////////////////////////////////////
 // SEQUENCER MONITOR
 
-socket.on("magicCtlfromserver", sequenceMonitor);
+socket.on("pageFlipfromserver", sequenceMonitor);
 function sequenceMonitor(group, unit,time,mm,seq){
     var n=6; var x=seq-1; var off=((x%n)+n)%n // thanks claudiusmaximus
     seqnow = "#"+group+"magicsquare"+seq
@@ -54,7 +54,14 @@
     $(seqnow).css('background-color', 'white');
     $(turnmeoff).css('background-color', 'blue')
     console.log("#"+group+"magicsquare"+seq +"     time: " +time + "   %:" + off)
+
 }
+socket.on("counterText", function(group,unit,counter){
+	$("#"+group+"magicsquare"+unit).text(counter);
+    console.log(group+"magicsqjare"+unit+"count:"+counter)
+ });
+
+
 //////////////////////////////////////////////
 // CLient Popup window code