[chuck-users] Fwd: hotswapping UGens
Stephen Sinclair
radarsat1 at gmail.com
Wed Jan 21 15:46:38 EST 2009
*shakes fist* !!!
On Wed, Jan 21, 2009 at 12:54 PM, Kassen <signal.automatique at gmail.com> wrote:
> Dear all,
>
> I just noticed that I accidentally send this to the DEV list instead of the
> users one. That was of course a mistake. I hope this didn't bother anyone,
> I'll try to pay more attention on the future.
>
> Sorry,
> Kas.
>
> ---------- Forwarded message ----------
> From: Kassen <signal.automatique at gmail.com>
> Date: 2009/1/21
> Subject: hotswapping UGens
> To: ChucK Developer Mailing List <chuck-dev at lists.cs.princeton.edu>
>
>
> Fellow ChucKists,
>
> Inspired by Scott's explanation of casting I thought I'd try a new trick
> that may be quite interesting for livecoding.
>
> first run this file;
> -----------------------------
> new UGen @=> Foo.instrument;
> public class Foo
> {
> static UGen @instrument;
> spork ~attach();
>
> fun void attach()
> {
> while(1)
> {
> if(!instrument.isConnectedTo( dac )) instrument => dac;
> second => now;
> }
> }
> }
>
> Foo foo;
> new Sitar @=> foo.instrument;
>
> //your melody goes here
> while(second => now) 1 => (foo.instrument $ Sitar).noteOn;
> --------------------------------------------
>
> Then run this to hot-swap the UGen while the original code runs;
>
> --------------
> new Shakers @=> Foo.instrument;
> -----------------------
>
> Sadly this does need that "attach" function as assignment breaks the link to
> the dac. I'm not sure I feel that's desirable behaviour but at least we can
> now hotswap UGens without crashing. I don't think I succeeded in that
> before.
>
> Yours,
> Kas.
>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
More information about the chuck-users
mailing list