<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Dimitris:<div><br></div><div>I'm not the most qualified to answer your questions, but I'll take a shot (besides my brain needs a break from the research I've been doing). &nbsp;If &nbsp;anyone wants to correct me, please jump in.</div><div><br></div><div>Passing default values: As Far As I Know, ChucK does not support default values in formal arguments.</div><div><br></div><div>Of "now" and timestamps: You are well on your way to discovering a fundamental truth about ChucK: "now" is the current time in the virtual machine. &nbsp;In effect, it advances only when sound is being synthesized, not when your code is being run. &nbsp;From the point of view of your code, now advances only when you execute some form of:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>x => now;<br></div><div>where x is a duration, a time, or an event. &nbsp;So the following code will advance "now" by 1000 units (where one unit turns out to be one sample):</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&lt;&lt;&lt; now >>>;<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1000::samp => now;<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&lt;&lt;&lt; now >>>;<br></div><div>On the other hand, the following code will not advance now at all:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&lt;&lt;&lt; now >>>;<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>for (0 => int i; i&lt;REALLY_HUGE_NUMBER; i++) {<br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>Math.sqrt(2.0) => float y;<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&lt;&lt;&lt; now >>>;<br></div><div>... since the code doesn't have any calls to "x => now".</div><div><br></div><div>Moral of the story: ChucKs 'now' facility is for precise timing of synthesized audio. &nbsp;It's not the same as a Unix time function.</div><div><br></div><div>Does that answer your question?</div><div><br></div><div>Best,</div><div><br></div><div>- Rob</div><div><br><div><div>On 22 Jun 2009, at 16:15, Bozelos Dimitris wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font: inherit;">Hello everyone!<div><br></div><div>1) can default values be passed to a function? I've tried all of</div><div><br></div><div>&nbsp;&nbsp; &nbsp;fun void test( int i = 0)</div><div>&nbsp;&nbsp; &nbsp;fun void test( 0 => int i)</div><div>&nbsp;&nbsp; &nbsp;fun void test( int i => 0)</div><div><br></div><div>but nothing works and in the manual nothing is stated. Anybody knows? I would be surprised if you cannot pass default values to a function. Why if so?</div><div><br></div><div>2) by printing &lt;&lt;&lt; now >>>; I get the timestamp from the virtual machine, but if I do</div><div><br></div><div>&lt;&lt;&lt;now>>>;</div><div><br></div><div>/// do some stuff</div><div><br></div><div>&lt;&lt;&lt;now>>>;</div><div><br></div><div>the two outputs are exactly the same even if the stuff in between last for some seconds. Why? How can I know the duration of something?</div><div><br></div><div>Cheers,</div><div><br></div><div>Dimitris</div></td></tr></tbody></table><br>       <hr size="1"><font size="-1" face="Arial"> Χρησιμοποιείτε Yahoo!<br> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων <br> <a href="http://login.yahoo.com/config/mail?.intl=gr">http://login.yahoo.com/config/mail?.intl=gr</a> </font>_______________________________________________<br>chuck-users mailing list<br><a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>https://lists.cs.princeton.edu/mailman/listinfo/chuck-users<br></blockquote></div><br></div></body></html>