Mercurial > hg > nodescore
diff nodescore.js @ 29:ea19684cd1db
start stop functionality and improved css
author | tzara <rc-web@kiben.net> |
---|---|
date | Wed, 08 Aug 2012 00:58:11 +0000 |
parents | 22f1c38007ff |
children | e4d2a8eb1450 |
line wrap: on
line diff
--- a/nodescore.js Tue Jul 31 17:01:34 2012 +0100 +++ b/nodescore.js Wed Aug 08 00:58:11 2012 +0000 @@ -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); @@ -104,7 +105,7 @@ } socket.on('startChr', function () { startChr();}); - socket.on('stopChr', function () { stopChr();}); + socket.on('stopChr', function () { stopChr();} ); socket.on('resetChr', function () { resetChr();}); @@ -137,9 +138,22 @@ var unit = seq.units[seq.counter]; var tempoms = 60000/seq.mm - var tock = setInterval(function(){ - + // inititate first page here + socket.broadcast.emit("pageFlipfromserver", seq.voice, unit, time, seq.mm,seq.counter); + + var tock = setInterval(function(){ + + + + socket.on('stopSeq', function () { + clearInterval(tock) + sequencerState=0; + stopChr(); + }); + + 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 +168,7 @@ // remove displayed number with " " at end of both countin/out if (counter == 0 ) { + socket.broadcast.emit('countinFromServer', seq.voice, " ", "","", "white","transparent"); } @@ -189,23 +204,11 @@ ztime -= 1000 }, tempoms) + }; - -// 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("bla") sequencerState=1; startChr(); step(seqA); step(seqB); step(seqC); step(seqD); @@ -213,14 +216,16 @@ } else console.log("already started...") }); - - + socket.on('resetSeq', function () { - console.log("rrrrreset") - resetChr(); - + console.log("reset") + resetChr(); }); - + + step = function (seq) { + clearInterval(countdowntick); + countdowntick(seq) + }; ////////////////////////////////////////////