[chuck-users] confused about time/control

Moisés Gabriel Cachay Tello xpktro at gmail.com
Wed Oct 22 13:12:42 EDT 2014


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 at 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 at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>



-- 
-Moisés
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20141022/409944ef/attachment.html>


More information about the chuck-users mailing list