Mercurial > hg > nodescore
diff nodescore.js @ 9:cd847f789b53
more transport
author | tzara <rc-web@kiben.net> |
---|---|
date | Thu, 05 Jul 2012 23:53:30 +0100 |
parents | 83dfd5f7186a |
children | 0e5543ccb8fb |
line wrap: on
line diff
--- a/nodescore.js Thu Jul 05 17:38:59 2012 +0100 +++ b/nodescore.js Thu Jul 05 23:53:30 2012 +0100 @@ -20,7 +20,7 @@ clientFiles.serve(request, response); }); }); -httpServer.listen(8000); +httpServer.listen(8888); //////////////////////////////////////////// // connect to websockets @@ -132,11 +132,8 @@ var seqC = { metrobeat:0, voice:3, name: "C", counter: 0, mm: 60, beatsinbar: 4, durations: srcsqr[2], units: [4,5,6,5,4,2]}; var seqD = { metrobeat:0, voice:4, name: "D", counter: 0, mm: 60, beatsinbar: 4, durations: srcsqr[3], units: [2,3,4,2,3,1]}; - var tock ; - var countdowntick; - - var countdowntick = function(seq){ + countdowntick = function(seq){ var outcount = 12; var incount=12; var time = ((seq.durations[seq.counter]+1) *timemultiplier) + 30000 + (outcount*1000); @@ -144,9 +141,7 @@ var unit = seq.units[seq.counter]; var tempoms = 60000/seq.mm - - - var tock = setInterval(function(){ + tock = setInterval(function(){ if (ztime >= 0 ){ // basic unit is still the second/1000ms - change this to tempoms? no i dont think so @@ -191,41 +186,31 @@ // decrement the time ztime -= 1000 - },tempoms) + }, tempoms) }; - - var step; step = function (seq) { - console.log(seq.voice) clearInterval(countdowntick); countdowntick(seq) }; - function startSeq() { - startChr(); - // start the metronome - step(seqA); step(seqB); step(seqC); step(seqD); - }; - socket.on('startSeq', function () { if (sequencerState == 0) { - metroState=1; sequencerState=1; - startSeq(); + startChr(); + step(seqA); step(seqB); step(seqC); step(seqD); ztime =-1; } + else console.log("already started...") }); + socket.on('stopSeq', function () { clearInterval(tock); sequencerState=0; stopChr(); - stopMetro(); - }); - socket.on('resetSeq', function () { console.log("rrrrreset") resetChr(); @@ -235,14 +220,7 @@ }); -var chat = io.of('/chat'); -chat.on('connection', function (socket) { - console.log('chat connection'); - socket.on('message', function (msg) { - console.log(msg); - chat.send(msg); - }); -}); +