[chuck-users] A polymorphic OSC function?

Ollie Glass ollieglaskovik at gmail.com
Fri Oct 28 08:37:10 EDT 2005

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();


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.



More information about the chuck-users mailing list