Mercurial > hg > nodescore
comparison nodescore.js @ 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 |
comparison
equal
deleted
inserted
replaced
9:cd847f789b53 | 10:0e5543ccb8fb |
---|---|
139 var time = ((seq.durations[seq.counter]+1) *timemultiplier) + 30000 + (outcount*1000); | 139 var time = ((seq.durations[seq.counter]+1) *timemultiplier) + 30000 + (outcount*1000); |
140 var ztime = time; var totaltime = time/1000 | 140 var ztime = time; var totaltime = time/1000 |
141 var unit = seq.units[seq.counter]; | 141 var unit = seq.units[seq.counter]; |
142 var tempoms = 60000/seq.mm | 142 var tempoms = 60000/seq.mm |
143 | 143 |
144 tock = setInterval(function(){ | 144 var tock = setInterval(function(){ |
145 | 145 |
146 if (ztime >= 0 ){ | 146 if (ztime >= 0 ){ |
147 // basic unit is still the second/1000ms - change this to tempoms? no i dont think so | 147 // basic unit is still the second/1000ms - change this to tempoms? no i dont think so |
148 // count in and count out | 148 // count in and count out |
149 //////////////////////////////////////////// | 149 //////////////////////////////////////////// |
150 | 150 |
151 var counter = ztime/1000 | 151 var counter = ztime/1000 |
152 | 152 |
153 socket.emit('counterText', seq.voice, seq.counter, counter); | |
154 | |
153 if (counter > 0 && counter <= outcount ) { | 155 if (counter > 0 && counter <= outcount ) { |
154 socket.broadcast.emit('countinFromServer', seq.voice, counter, "","", "white", "transparent"); | 156 socket.broadcast.emit('countinFromServer', seq.voice, counter, "","", "white", "transparent"); |
155 } | 157 } |
156 // remove displayed number with " " at end of both countin/out | 158 // remove displayed number with " " at end of both countin/out |
157 if (counter == 0 ) { | 159 if (counter == 0 ) { |
174 socket.emit('metroPulse', tempoms, seq.voice,seq.metrobeat); | 176 socket.emit('metroPulse', tempoms, seq.voice,seq.metrobeat); |
175 } | 177 } |
176 | 178 |
177 // flip the page | 179 // flip the page |
178 if (ztime == 0){ | 180 if (ztime == 0){ |
181 socket.emit('counterText', seq.voice, seq.counter, " "); | |
179 seq.counter = (seq.counter + 1) % seq.durations.length | 182 seq.counter = (seq.counter + 1) % seq.durations.length |
180 socket.broadcast.emit("pageFlipfromserver", seq.voice, unit, time, seq.mm,seq.counter); | 183 socket.broadcast.emit("pageFlipfromserver", seq.voice, unit, time, seq.mm,seq.counter); |
181 socket.emit("pageFlipfromserver", seq.voice, unit, time, seq.mm,seq.counter); | 184 socket.emit("pageFlipfromserver", seq.voice, unit, time, seq.mm,seq.counter); |
182 step(seq); | 185 step(seq); |
186 | |
183 } | 187 } |
184 | 188 |
185 if (ztime < 0){} | 189 if (ztime < 0){} |
186 // decrement the time | 190 // decrement the time |
187 ztime -= 1000 | 191 ztime -= 1000 |
188 | 192 |
189 }, tempoms) | 193 }, tempoms) |
194 | |
195 | |
196 socket.on('stopSeq', function (seq) { | |
197 console.log("stop") | |
198 clearInterval(tock); | |
199 sequencerState=0; | |
200 stopChr(); | |
201 }); | |
202 | |
203 | |
204 | |
190 }; | 205 }; |
191 | 206 |
192 step = function (seq) { | 207 step = function (seq) { |
193 clearInterval(countdowntick); | 208 clearInterval(countdowntick); |
194 countdowntick(seq) | 209 countdowntick(seq) |
203 } | 218 } |
204 else console.log("already started...") | 219 else console.log("already started...") |
205 }); | 220 }); |
206 | 221 |
207 | 222 |
208 socket.on('stopSeq', function () { | 223 |
209 clearInterval(tock); | |
210 sequencerState=0; | |
211 stopChr(); | |
212 }); | |
213 | 224 |
214 socket.on('resetSeq', function () { | 225 socket.on('resetSeq', function () { |
215 console.log("rrrrreset") | 226 console.log("rrrrreset") |
216 resetChr(); | 227 resetChr(); |
217 | 228 |