[chuck-users] a little debugging help for frozen VM!

chriswicks crwicks at yahoo.com
Fri May 25 15:32:35 EDT 2012


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.


//begincode


Machine.add("justa.ck");                        //class of frequency definitions
Machine.add("pedestrianSender.ck");      //OSC sender of int values

OscRecv receiver;                                //OSC receiver object
6449 => receiver.port;
receiver.listen();
receiver.event("weather/pedestrian, int") @=> OscEvent pedEvent;

-1 => int b3base1;  //int to store a shred ID
-1 => int b3base2;  //ditto

25 => int pedCount; //int to store pedCount sent via OSC


while (true) {
  

  //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,
  //add both shreds to the VM and assign their shred ID to the b3base1 and b3base2

  if (pedCount > 20 && b3base1 == -1) {
    Machine.add("b3base.ck") => b3base1;
    Machine.add("b3base.ck") => b3base2;
  }
  
  else {


    //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    

    //meet the conditional.

    if (pedCount < 20 && b3base1 != -1) {
      Machine.remove(b3base1);
      Machine.remove(b3base2);
      -1 => b3base1;
      -1 => b3base2;

    }
  }

  while( pedEvent.nextMsg() != 0) {
    pedEvent.getInt() => pedCount;
    2::second => now;
  }
}

//endcode
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20120525/d608ce9e/attachment.htm>


More information about the chuck-users mailing list