Hello everyone! 1) can default values be passed to a function? I've tried all of fun void test( int i = 0) fun void test( 0 => int i) fun void test( int i => 0) 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? 2) by printing <<< now >>>; I get the timestamp from the virtual machine, but if I do <<<now>>>; /// do some stuff <<<now>>>; 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? Cheers, Dimitris ___________________________________________________________ Χρησιμοποιείτε Yahoo!; Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr
Hi Dimitris:
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). If anyone wants to correct me, please jump in.
Passing default values: As Far As I Know, ChucK does not support
default values in formal arguments.
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. In effect, it advances only when sound is being
synthesized, not when your code is being run. From the point of view
of your code, now advances only when you execute some form of:
x => now;
where x is a duration, a time, or an event. So the following code
will advance "now" by 1000 units (where one unit turns out to be one
sample):
<<< now >>>;
1000::samp => now;
<<< now >>>;
On the other hand, the following code will not advance now at all:
<<< now >>>;
for (0 => int i; i
Hello everyone!
1) can default values be passed to a function? I've tried all of
fun void test( int i = 0) fun void test( 0 => int i) fun void test( int i => 0)
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?
2) by printing <<< now >>>; I get the timestamp from the virtual machine, but if I do
<<<now>>>;
/// do some stuff
<<<now>>>;
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?
Cheers,
Dimitris
Χρησιμοποιείτε Yahoo! Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Bozelos Dimitris wrote:
Hello everyone!
Hi :-)
1) can default values be passed to a function? I've tried all of
fun void test( int i = 0) fun void test( 0 => int i) fun void test( int i => 0)
You could try (if I understand what you're trying to achieve): test(); //using default of 0 test(4); // using a value of 4 fun void test(){ test(0); } fun void test(int i){ //do the actual stuff with i } -- Atte http://atte.dk http://modlys.dk http://virb.com/atte
participants (3)
-
Atte Andre Jensen
-
Bozelos Dimitris
-
Robert Poor