Atte André Jensen wrote:
I'm wrestling with some mostly conceptual problems that I'd like to get some feedback on.
Unfortunately no one replied. Fortunately I've been thinking like a mad man. And I came up with the following extremely simple solution. Events to the rescue. I rewrite my current instrument functions to wait for an event, provide overload functions that accepts length, sporks the function, waits for length amount of time and broadcast events. Didn't try with audio, but it's so simple it's gotta work. Any comments are welcome! -- peace, love & harmony Atte http://www.atte.dk | quartet: http://www.anagrammer.dk http://www.atte.dk/gps | compositions: http://www.atte.dk/compositions fun void in1(float dynamic, dur length){ Event in1_off; spork ~ in1(dynamic, in1_off); length => now; in1_off.broadcast(); 10::second => now; } fun void in1(float dynamic, Event off){ <<<"in1 on", dynamic>>>; off => now; <<<"in1 off",dynamic>>>; 1::second => now; <<<"in1, 1 second after off",dynamic>>>; } fun void in2(float dynamic, dur length){ Event in2_off; spork ~ in2(dynamic, in2_off); length => now; in2_off.broadcast(); 10::second => now; } fun void in2(float dynamic, Event off){ <<<"in2 on",dynamic>>>; off => now; <<<"in2 off",dynamic>>>; 2::second => now; <<<"in2, 2 seconds after off",dynamic>>>; } Event in1_off, in2_off; spork ~ in1(1,in1_off); spork ~ in2(.9,in2_off); spork ~ in1(.6, 1::second); spork ~ in2(.1, 2::second); 200::ms => now; in1_off.broadcast(); 1::week => now;