<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div>Hey, all.  I'm attempting to build something that shifts layers of ChucK files based on OSC events, and I hit a snag really early on.  I'm a relatively new programmer, so hopefully this isn't too stupid of a question, but I've got an issue that freezes the virtual machine and doesn't play any sound or send any OSC events.  Nothing happens..the VM shows that the shreds are added, and then it just freezes and I have to force quit...it won't take a --removeall or --kill command or anything.  Individually, each file works as it should, aside from the file whose code I am including here.  I think I may be missing a key concept as to the way Machine.add works and how it assigns the value of the shred to an int, but I'm just not sure.  If anyone can give me some direction here as to what might be happening I'd
 appreciate it!  I've tried advancing time in various places, setting my initial pedCount to various values, all to no avail.  Thanks very much, and please let me know if this is unclear in any way.<br></div><div><br></div><div>//begincode<br></div><div><br></div><div>Machine.add("justa.ck");<span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span class="tab">    //class of frequency definitions</span><br>Machine.add("pedestrianSender.ck");<span class="tab">    </span><span class="tab">  //OSC sender of int values</span><br><br>OscRecv receiver;<span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span
 class="tab">    </span><span class="tab">    </span><span class="tab">    </span><span class="tab">    //OSC receiver object</span><br>6449 => receiver.port;<br>receiver.listen();<br>receiver.event("weather/pedestrian, int") @=> OscEvent pedEvent;<br><br>-1 => int b3base1;  //int to store a shred ID<br>-1 => int b3base2;<span class="tab">  //ditto</span><br><br>25 => int pedCount; //int to store pedCount sent via OSC<br></div><div><br></div><div>while (true) {<br>  <br></div><div>  //if the pedCount is greater than 20 (a value which will be sent via OSC) and b3base1 is equal to -1, i.e. the shred isn't currently running,</div><div>  //add both shreds to the VM and assign their shred ID to the b3base1 and b3base2</div><div><br></div><div>  if (pedCount > 20 && b3base1 == -1) {<br>    Machine.add("b3base.ck") =>
 b3base1;<br>    Machine.add("b3base.ck") => b3base2;<br>  }<br>  <br>  else {<br></div><div><br></div><div>    //if the pedCount is less than 20, remove both shreds from the VM and assign -1 to their value so that if the pedCount goes back above 20 they<span class="tab">    <br></span></div><div><span class="tab">    //meet the conditional.</span></div><div><span class="tab"><br></span></div><div>    if (pedCount < 20 && b3base1 != -1) {<br>      Machine.remove(b3base1);<br>      Machine.remove(b3base2);</div><div>      -1 => b3base1;</div><div>      -1 => b3base2;<br></div><div>    }<br>  }<br><br>  while( pedEvent.nextMsg() != 0) {<br>    pedEvent.getInt() => pedCount;<br>    2::second
 => now;<br>  }</div><div>}</div><div><br></div><div>//endcode<br></div></div></body></html>