[chuck-users] stupid n00bie question: Part II

Kassen signal.automatique at gmail.com
Wed Oct 10 07:07:40 EDT 2007

On 10/10/07, AlgoMantra <algomantra at gmail.com> wrote:
> Okay, I beg your pardon in advance again......

Why? That's what the list is for!

1. Are the MAUI modules available only for miniAudicle, and not Audicle?
> That
> would mean that one can only do this on Mac. I'm a dodo using XP.

Yeah, at least so far.

2. Can two ChucK shreds throw data at each other in the same VM, like two
> Python sockets?
> So I could read Microphone data in RMS off one shred and throw it towards
> a Python
> GUI using another shred which is using OSC? Can two shreds talk?

Yes, you can. The easiest way to go about this is to make sure both shreds
come from  the same .ck file. If they do they share the name space of that
file so any event or variable defined in there should be open to both. The
exception is things defined inside of functions (and in this case all but
one of those shreds will be sporked functions). Something defined inside of
a function will only be accessible to that function.

If the above is all you need I'd keep it in a single file and use a event,
the first shred would analyze the sound and broadcast the event whenever
something interesting happens, the second would wait for the event and send
the OSC. The sections in the manual and the /examples/ dir on events contain
everything you'll need.

It gets slightly harder if the two shreds come from different files, if that
is the case the trick is to make a public class containing a static event
and have both shreds use a instance of that. This is a bit of a work-around
but it does work. The one thing to mind is that non-primitive static objects
in public classes have a issue with instantiation, to get around this you
need to define the class, then define a event outside of it and asign this
to it. Fortunately you only need to do that once and it'll be fine, there
has been quite a bit of discussion about this on the list that you might
want to look up (mainly on static arrays). If that's the route you take and
you run into trouble get back to it and I or somebody else will talk you
through it.

Hope that helps,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20071010/63ee0b70/attachment-0001.htm 

More information about the chuck-users mailing list