Mercurial > hg > nodescore
comparison www/m/js/controlseq.js @ 60:e868cdd4b3e9
.
author | tzara <rc-web@kiben.net> |
---|---|
date | Sun, 21 Apr 2013 23:41:13 +0000 |
parents | 5ba250832739 |
children | 9bf133b91890 |
comparison
equal
deleted
inserted
replaced
59:5ba250832739 | 60:e868cdd4b3e9 |
---|---|
1 | |
2 ////////////////////////////////////////////// | 1 ////////////////////////////////////////////// |
3 var socket = io.connect(); | 2 var socket = io.connect(); |
4 ////////////////////////////////////////////// | 3 ////////////////////////////////////////////// |
5 // Sequencer Controls | 4 // Sequencer Controls |
6 function startSeq() { socket.emit("startSeq") } | 5 function startSeq() { socket.emit("startSeq") } |
7 function stopSeq() { socket.emit("stopSeq") } | 6 function stopSeq() { socket.emit("stopSeq") } |
8 function resetSeq() { socket.emit("resetSeq") } | 7 function resetSeq() { socket.emit("resetSeq") } |
9 ////////////////////////////////////////////// | 8 ////////////////////////////////////////////// |
10 // Chron Controls | 9 // Chron Controls |
11 | |
12 function stopWatch(value) { socket.emit("stopWatch", value) } | 10 function stopWatch(value) { socket.emit("stopWatch", value) } |
13 | |
14 ////////////////////////////////////////////// | 11 ////////////////////////////////////////////// |
15 // Metronome Controls | 12 // Metronome Controls |
16 | |
17 //socket.on("metroPulse", metronomeTick); | 13 //socket.on("metroPulse", metronomeTick); |
18 function metroStart(pulse) { socket.emit("metroStart", pulse);} | 14 function metroStart(pulse) { socket.emit("metroStart", pulse);} |
19 function metroStop() { socket.emit("metroStop");} | 15 function metroStop() { socket.emit("metroStop");} |
20 | |
21 ////////////////////////////////////////////// | 16 ////////////////////////////////////////////// |
22 // Latency "Pong" | 17 // Latency "Pong" |
23 | |
24 socket.on("timeFromServer", function(n) { | 18 socket.on("timeFromServer", function(n) { |
25 socket.emit("clientTimeResponse",n); | 19 socket.emit("clientTimeResponse",n); |
26 //console.log(n); | 20 //console.log(n); |
27 }); | 21 }); |
28 socket.on("latencyFromServer", function(latency) { | 22 socket.on("latencyFromServer", function(latency) { |
29 $("#client_latency").text(latency+"ms.") | 23 $("#client_latency").text(latency+"ms.") |
30 }); | 24 }); |
31 | |
32 function getLatencies(x) { socket.emit("getLatencies", x); } | 25 function getLatencies(x) { socket.emit("getLatencies", x); } |
33 | |
34 ////////////////////////////////////////////// | 26 ////////////////////////////////////////////// |
35 // Chronometer Controls | 27 // Chronometer Controls |
36 | |
37 function startChr() { socket.emit("startChr"); } | 28 function startChr() { socket.emit("startChr"); } |
38 function stopChr() { socket.emit("stopChr"); } | 29 function stopChr() { socket.emit("stopChr"); } |
39 function resetChr() { | 30 function resetChr() { socket.emit("resetChr"); |
40 socket.emit("resetChr"); | 31 $("div#client_chronometer").text("00:00:00.0"); } |
41 $("div#client_chronometer").text("00:00:00.0"); | 32 socket.on("chronFromServer", function(chron){ |
42 } | 33 $("div#c_chronometer").text(chron); }); |
43 socket.on("chronFromServer", function(chron){ | |
44 //console.log(chron); | |
45 $("div#client_chronometer").text(chron); | |
46 }); | |
47 | 34 |
48 ////////////////////////////////////////////// | 35 ////////////////////////////////////////////// |
49 // SEQUENCER MONITOR | 36 // SEQUENCER MONITOR |
50 | |
51 socket.on("pageFlipfromserver", sequenceMonitor); | 37 socket.on("pageFlipfromserver", sequenceMonitor); |
52 function sequenceMonitor(group, unit,time,mm,seq,unitlast){ | 38 function sequenceMonitor(group, unit,time,mm,seq,unitlast){ |
53 // var n=6; var x=seq-1; var off=((x%n)+n)%n // thanks claudiusmaximus | 39 // var n=6; var x=seq-1; var off=((x%n)+n)%n // thanks claudiusmaximus |
54 | |
55 if (group == 1) { turnmeoff = "#sqr"+unitlast+".sqa"} | 40 if (group == 1) { turnmeoff = "#sqr"+unitlast+".sqa"} |
56 if (group == 2) { turnmeoff = "#sqr"+unitlast+".sqb"} | 41 if (group == 2) { turnmeoff = "#sqr"+unitlast+".sqb"} |
57 if (group == 3) { turnmeoff = "#sqr"+unitlast+".sqc"} | 42 if (group == 3) { turnmeoff = "#sqr"+unitlast+".sqc"} |
58 if (group == 4) { turnmeoff = "#sqr"+unitlast+".sqd"} | 43 if (group == 4) { turnmeoff = "#sqr"+unitlast+".sqd"} |
59 | 44 $(turnmeoff).css({'color':'black'}) |
60 $(turnmeoff).css({'color':'black'}) | |
61 | |
62 } | 45 } |
63 | 46 |
64 socket.on("counterText", function(group,unit,counter,seq){ | 47 // countdown to change |
65 | 48 socket.on("countinFromServer", countinCtrl); |
66 if (group == 1) { $('#sqr'+unit+".sqa").text(counter); | 49 function countinCtrl(groupID, currentseconds,mm,text,colour,background,unit){ |
67 if (counter == 0 ) { $('#sqr'+unit+".sqa").css("color","black") } | 50 console.log("#count"+groupID) |
68 else { $('#sqr'+unit+".sqa").css("color","yellow") } | 51 // all counts to control page |
52 $("#counttitle"+groupID).css('color','white'); | |
53 $("#counttitle"+groupID).text(text); | |
54 $("#count"+groupID).text(currentseconds).css('color','white'); | |
55 document.getElementById("count"+groupID).style.color=colour; | |
56 } | |
57 | |
58 socket.on("counterText", function(group,unit,counter,seq){ | |
59 if (group == 1) { $('#inner-'+unit+"-0").text(counter); | |
60 // $("#count1").text(currentseconds); | |
61 if (counter == 0 ) { $('#inner-'+unit+"-0").css("color","black") } | |
62 else { $('#inner-'+unit+"-0").css("color","yellow") } | |
69 } | 63 } |
70 | 64 |
71 if (group == 2) { $('#sqr'+unit+".sqb").text(counter); | 65 if (group == 2) { $('#inner-'+unit+"-1").text(counter); |
72 if (counter == 0 ) { $('#sqr'+unit+".sqb").css("color","black") } | 66 |
73 else { $('#sqr'+unit+".sqb").css("color","green") } | 67 if (counter == 0 ) { $('#inner-'+unit+"-1").css("color","black") } |
68 else { $('#inner-'+unit+"-1").css("color","green") } | |
74 } | 69 } |
75 | 70 |
76 if (group == 3) { $('#sqr'+unit+".sqc").text(counter); | 71 if (group == 3) { $('#inner-'+unit+"-2").text(counter); |
77 if (counter == 0 ) { $('#sqr'+unit+".sqc").css("color","black") } | 72 |
78 else { $('#sqr'+unit+".sqc").css("color","aqua") } | 73 if (counter == 0 ) { $('#inner-'+unit+"-2").css("color","black") } |
74 else { $('#inner-'+unit+"-2").css("color","aqua") } | |
79 } | 75 } |
80 | 76 |
81 if (group == 4) { $('#sqr'+unit+".sqd").text(counter); | 77 if (group == 4) { $('#inner-'+unit+"-3").text(counter); |
82 if (counter == 0 ) { $('#sqr'+unit+".sqd").css("color","black")} | 78 if (counter == 0 ) { $('#inner-'+unit+"-3").css("color","black")} |
83 else { $('#sqr'+unit+".sqd").css("color","red") } | 79 else { $('#inner-'+unit+"-3").css("color","red") } |
84 } | 80 } |
85 } | 81 } |
86 ); | 82 ); |
87 | 83 |
88 | 84 |
85 /* | |
89 ////////////////////////////////////////////// | 86 ////////////////////////////////////////////// |
90 // CLient Popup window code | 87 // CLient Popup window code |
91 | 88 |
92 function newPopup(url) { | 89 function newPopup(url) { |
93 popupWindow = window.open( | 90 popupWindow = window.open( |
94 url,'popUpWindow','height=400,width=800,left=10,top=10,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,titlebar=no,directories=no,status=yes')} | 91 url,'popUpWindow','height=400,width=800,left=10,top=10,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,titlebar=no,directories=no,status=yes')} |
92 | |
93 */ |