Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /trunk/misc/bw/server.srp [r78] .. [r79] Maximize Restore

  Switch to side-by-side view

--- a/trunk/misc/bw/server.srp
+++ b/trunk/misc/bw/server.srp
@@ -388,14 +388,21 @@
 zmq_active = nil
 
 sras_index = 0
+riff_cycles = 0
 def select_riffs_and_soloist(id)
     drum_circle_solo_index = drum_circle_solo_next
     display "select_riffs_and_soloist", the_sched.time, real_now
     if id != sras_index:
         return
     // select riffs and soloist index
-    // for now, riffs will be 0
-    var msg = "D   " + chr(0) + chr(0) + chr(0) + chr(0)
+    // for now, there are just 2 riffs. Start with 0 and change
+    // every 4 cycles
+    var r = riff_cycles % 8
+    r = 0 if r < 4 else 1
+    display "select_riffs_and_soloist", r
+    var msg = "D   " + chr(r) + chr(r) + chr(r) + chr(r)
+    riff_cycles = riff_cycles + 1
+
     // select solo index from the list
     if len(drum_circle_solo_requests) == 0:
         // refill the pool
@@ -434,7 +441,9 @@
     var client = clients.find_client(ticket)
     if client:
         client.last_recv_time = real_now
-        if riffmode and gno_msg[0] == "N":
+        if gno_msg[0] == "N":
+            if not riffmode:
+                return
             // send note and timestamp to clients. timestamp is advanced
             // at clients so we can send the original timestamp
             // We're building a string by creating an array of strings
@@ -446,7 +455,6 @@
             // velocity is 127 for soloist, actual + boost for Janelle,
             //    and 40 for others
             var vel = ord(gno_msg[13])
-            print "N", client.index, ord(gno_msg[12]), "in:", vel, 
             if vel > 0:
                 if client.index == drum_circle_solo_index:
                     vel = 127
@@ -456,7 +464,6 @@
                     // drum_velocity_boost could be negative, so
                     // make sure adjusted vel > 0
                     vel = max(1, vel + drum_velocity_boost)
-            print "solo:", drum_circle_solo_index, "out:", vel
             drum_circle_msg.append(chr(vel))          //       vel
             // this should be very rare, but just in case there's a
             // flood of notes, let's break things up into separate
@@ -464,7 +471,6 @@
             if len(drum_circle_msg) > 800:
                 zmq_send(publish_sock, flatten(drum_circle_msg))
                 drum_circle_msg.set_len(1) // back to ["N   "]
-            display "got N msg", client.index, ord(gno_msg[12]), vel
             return
         elif gno_msg[0] == "Q":
             display "server got solo request", client.index, gno_msg[8]
@@ -559,7 +565,7 @@
         // here's a handy place that gets run every 0.2s
         if len(drum_circle_msg) > 1:
             zmq_send(publish_sock, flatten(drum_circle_msg))
-            display "sent N msg", len(drum_circle_msg)
+            # display "sent N msg", len(drum_circle_msg)
             drum_circle_msg.set_len(1) // back to ["N   "]
         rtsched.poll(real_now)
     if real_now > http_poll_time: