[chuck-users] A polymorphic OSC function?

Philip Davidson philipd at CS.Princeton.EDU
Fri Oct 28 12:27:09 EDT 2005


Ollie, not at this moment, unfortunately.

I have an OSC-overhaul in the works ( hopefully within a week or two ) 
that will allow for more flexible access now that Chuck has more robust 
support for string comparison.  I'll also be adding in the 'Container'
concept for namespaces so that we can define addresses as 
'subdirectories' rather than full-path.



Ollie Glass wrote:
> Hello Chuckers. Is it possible to receive any OSC event with a single  
> event and function? In my code I create several events like this:
> 
> recv.event( "/setStep,i,i,i" ) @=> OscEvent oe;
> recv.event( "/setBpm,f" ) @=> OscEvent obpm;
> recv.event( "/openWave,i,s" ) @=> OscEvent owave;
> 
> Then I spork listener threads for each one:
> 
> fun void bpmListener() {
>     while ( true )    {
>         obpm => now;
>         while ( obpm.nextMsg() != 0 ) {
>             ...
> spork ~ bpmListener();
> 
> fun void openListener() {
>     while ( true )    {
>         owave => now;
>         while ( owave.nextMsg() != 0 ) {
>             ...
> spork ~ openListener();
> 
> etc.
> 
> So I create an event, function and thread for every OSC message I  want 
> to receive. Is there a way to make a polymorphic function that  can 
> recieve any OSC event with some if / else statements to switch  based on 
> what the message is? Any sample code would be much appreciated.
> 
> Thanks,
> 
> Ollie
> _______________________________________________
> 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