Mercurial > hg > nodescore
diff nodescore.js @ 33:5088859ace72
Merge branch 'master' of git://gitorious.org/nodescore/nodescore
Conflicts:
nodescore
www/m/thumbs/1.png
www/m/thumbs/2.png
www/m/thumbs/3.png
www/m/thumbs/4.png
www/m/thumbs/5.png
www/m/thumbs/6.png
author | tzara <rc-web@kiben.net> |
---|---|
date | Sun, 19 Aug 2012 22:59:48 +0100 |
parents | e4d2a8eb1450 |
children | ea8d61c851c0 |
line wrap: on
line diff
--- a/nodescore.js Sun Aug 19 22:58:36 2012 +0100 +++ b/nodescore.js Sun Aug 19 22:59:48 2012 +0100 @@ -25,6 +25,7 @@ var httpServer = http.createServer(function(request, response) { request.addListener('end', function () { clientFiles.serve(request, response); + process.setMaxListeners(0); }); }); httpServer.listen(8889); @@ -36,7 +37,7 @@ var io = sio.listen(httpServer) , nicknames = {}; -io.set('log level', 2); // reduce loggingi +io.set('log level', 1); // reduce loggingi io.sockets.on('connection', function (socket) { //////////////////////////////////////////// @@ -83,7 +84,8 @@ var now=datetime.toString() // console.log(now); socket.broadcast.emit("dateTime", now); - socket.emit("dateTime", now);}, 1000)} +// socket.emit("dateTime", now); + }, 1000)} clearInterval(ding); dateTime() @@ -104,7 +106,7 @@ } socket.on('startChr', function () { startChr();}); - socket.on('stopChr', function () { stopChr();}); + socket.on('stopChr', function () { stopChr();} ); socket.on('resetChr', function () { resetChr();}); @@ -129,7 +131,7 @@ var seqD = { metrobeat:0, voice:4, name: "D", counter: 0, mm: 60, beatsinbar: 4, durations: srcsqr[3], units: [2,3,4,2,3,1]}; - countdowntick = function(seq){ + var countdowntick = function(seq){ var outcount = 12; var incount=12; var time = ((seq.durations[seq.counter]+1) *timemultiplier) + 30000 + (outcount*1000); @@ -137,9 +139,15 @@ var unit = seq.units[seq.counter]; var tempoms = 60000/seq.mm + // initiate first page here + socket.broadcast.emit("pageFlipfromserver", seq.voice, unit, time, seq.mm,seq.counter); + var tock = setInterval(function(){ - + + + if (ztime >= 0 ){ + // basic unit is still the second/1000ms - change this to tempoms? no i dont think so // count in and count out //////////////////////////////////////////// @@ -154,6 +162,7 @@ // remove displayed number with " " at end of both countin/out if (counter == 0 ) { + socket.broadcast.emit('countinFromServer', seq.voice, " ", "","", "white","transparent"); } @@ -187,41 +196,47 @@ if (ztime < 0){} // decrement the time ztime -= 1000 - + }, tempoms) + + }; +// socket.on('stopSeq', function () { +// console.log("sequencer stopping...") +// clearInterval(tock) +// sequencerState=0; +// stopChr(); + // var tock = function(){null} + +// }); -// socket.on('stopSeq', function (seq) { -// console.log("stop") -// clearInterval(tock); -// sequencerState=0; -// stopChr(); -// }); - }; - - step = function (seq) { - clearInterval(countdowntick); - countdowntick(seq) - }; - socket.on('startSeq', function () { if (sequencerState == 0) { + console.log("sequencer starting...") sequencerState=1; startChr(); step(seqA); step(seqB); step(seqC); step(seqD); ztime =-1; } - else console.log("already started...") + else console.log("sequencer already started...") }); + + + socket.on('resetSeq', function () { - console.log("rrrrreset") - resetChr(); - + console.log("reset") + resetChr(); }); + + step = function (seq) { + clearInterval(countdowntick); + countdowntick(seq) + }; + //////////////////////////////////////////// // some latency calculations