In order to advance 'now' and make it eventually equal or higher than 'later' you should put inside your loop something like:

now + 5::second => time later;
while(now < later) {
  ...
  1::second => now;
}


2014-10-22 11:50 GMT-05:00 Peter Lutek <peter@peterlutek.com>:
greetings! a little help for a newbie?....

when i run this bit of code, i would have expected the while loop to run for only 5 seconds, printing out a new value for "beat" whenever new data comes in from MIDI. then, it should print "done". instead, it just keeps printing the new "beat" values for as long as i let it run, never getting to the "done" line. i don't understand why the "while( now < later )" doesn't kill the loop after 5 seconds.

also, xruns go through the roof and i have to kill it externally. i'm on linux, using jack. (all the setup of MIDI ports and variables happens before this, and i know it's functioning fine...)

////////////

dur beat;

now + 5::second => time later;
while( now < later ){
       while( min.recv(msgin) ){
                  ( msgin.data3 + 10 ) * 50::ms => beat;
                  <<<beat>>>;
              }
}
<<<"done">>>;

///////////

thanks much, in advance... cheers!
.pltk.

--
Peter Lutek
improvising musician in Toronto, Canada
http://peterlutek.com
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



--
-Moisés