Pspawner - delayed calculation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Pspawner - delayed calculation

daniel-mayer

Hi,

is there a recommended way to delay the *calculation* of a spawned event pattern from inside a Pspawner, while not delaying other actions of the spawner function? I don't want to use the event's timingOffset, which only shifts server-side. Here the two solutions I came up with:


(
f = { |i|
        {
                ("logical time p" ++ i.asString ++ ": ").post;
                thisThread.clock.beats.postln
        }
};

p = Pspawner { |sp|
        loop {
                sp.par(Pbind(\do, Pfuncn(f.(1))));
                sp.par(
                        Pspawner { |sp|
                                0.01.wait;
                                sp.par(Pbind(\do, Pfuncn(f.(2))));
                        }
                );
                1.wait
        }
};

q = Pspawner { |sp|
        loop {
                sp.par(Pbind(\do, Pfuncn(f.(3))));
                thisThread.clock.sched(0.01, { Pbind(\do, Pfuncn(f.(4))).play });
                1.wait
        }
}
)


p.play

q.play


The first one looks less hacky, does it have a downside concerning efficiency with a lot of events ?


Regards

Daniel

-----------------------------
www.daniel-mayer.at
-----------------------------





_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/