<div dir="ltr">In order to advance &#39;now&#39; and make it eventually equal or higher than &#39;later&#39; you should put inside your loop something like:<div><br></div><div>now + 5::second =&gt; time later;</div><div>while(now &lt; later) {</div><div>  ...</div><div>  1::second =&gt; now;</div><div>}</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-22 11:50 GMT-05:00 Peter Lutek <span dir="ltr">&lt;<a href="mailto:peter@peterlutek.com" target="_blank">peter@peterlutek.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">greetings! a little help for a newbie?....<br>
<br>
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 &quot;beat&quot; whenever new data comes in from MIDI. then, it should print &quot;done&quot;. instead, it just keeps printing the new &quot;beat&quot; values for as long as i let it run, never getting to the &quot;done&quot; line. i don&#39;t understand why the &quot;while( now &lt; later )&quot; doesn&#39;t kill the loop after 5 seconds.<br>
<br>
also, xruns go through the roof and i have to kill it externally. i&#39;m on linux, using jack. (all the setup of MIDI ports and variables happens before this, and i know it&#39;s functioning fine...)<br>
<br>
////////////<br>
<br>
dur beat;<br>
<br>
now + 5::second =&gt; time later;<br>
while( now &lt; later ){<br>
       while( min.recv(msgin) ){<br>
                  ( msgin.data3 + 10 ) * 50::ms =&gt; beat;<br>
                  &lt;&lt;&lt;beat&gt;&gt;&gt;;<br>
              }<br>
}<br>
&lt;&lt;&lt;&quot;done&quot;&gt;&gt;&gt;;<br>
<br>
///////////<br>
<br>
thanks much, in advance... cheers!<br>
.pltk.<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Peter Lutek<br>
improvising musician in Toronto, Canada<br>
<a href="http://peterlutek.com" target="_blank">http://peterlutek.com</a><br>
______________________________<u></u>_________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.<u></u>princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.<u></u>edu/mailman/listinfo/chuck-<u></u>users</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>-Moisés
</div>