[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] loop in routine, causes SC hang



Your .wait statement is outside the loop, so it never runs.
hjh

On Tue, Mar 3, 2009 at 6:01 PM, Aaron Gervais <aaron.gervais@xxxxxxxxxxx> wrote:
> Hi everyone,
> I'm back on the list after being away for a few years... enjoying getting
> back into supercollider. :)
> I'm having trouble with a loop in a routine (below). It causes SC to hang
> and I'm not sure why. I basically want the loop to automatically start a new
> synth, and then eventually kill that synth and start another one after a
> time value chosen from a range. The function works if I take out the loop
> (but obviously it doesn't loop). I figure I'm probably missing something
> simple but I can't find it.
> Thanks,
> Aaron
> (
> ~myFunction = { arg buf, pan_range=0.6, pitch_range=0.2, grain_rate=25;
> // buf is an array of buffers formatted as [ [buffer, length], [buffer,
> length] ]
> var r, waitTime, thisBuf;
> r = Routine.new({
> loop {
> waitTime = 10.0.linrand;
> thisBuf = buf.choose;
> Synth.new(\sample_granulator, [
> \out_bus, 0,
> \sound_buf, thisBuf[0].bufnum,
> \pan_rng, pan_range,
> \pitch_rng, pitch_range,
> \trig_rate, grain_rate,
> \length, waitTime
> ]);
> };
> waitTime.yield;
> });
> SystemClock.play(r);
> };
> )



-- 
James Harkins /// dewdrop world
jamshark70@xxxxxxxxxxxxxxxxx
http://www.dewdrop-world.net

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/