![](https://secure.gravatar.com/avatar/ecebd64d9032bb92d186c2fe0e0879d8.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/94823c4736944451e68eb71619b7c93b.jpg?s=120&d=mm&r=g)
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@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (2)
-
Ollie Glass
-
Philip Davidson