Hello, Is it possible to determine the IP address of the client sending an incoming OSC message? There is no documentation on the API of the OscEvent class. I'm trying to find a way of dealing with multiple OSC clients that are sending the same OSC message. OscRecv incoming; OscEvent event; 1234 => incoming.port; incoming.listen(); server.event("/incoming", "f") @=> event; spork ~ waitForEvent(); fun void waitForEvent() { while (true) { event => now; while (event.nextMsg()) { event.getFloat() => float f; event.getIPAddress() => string client; if (client == ...) { } } } } michael
Michael Heuer
Is it possible to determine the IP address of the client sending an incoming OSC message? There is no documentation on the API of the OscEvent class.
Sorry, doesn't appear so. src/ulib_opsc.cpp:104 // init base class if( !type_engine_import_class_begin( env, "OscEvent", "Event", env->global(), osc_address_ctor, osc_address_dtor ) ) return FALSE; // add member variable - OSCAddress object osc_address_offset_data = type_engine_import_mvar( env, "int", "@OscEvent_Data", FALSE ); if( osc_recv_offset_data == CK_INVALID_OFFSET ) goto error; // keep type around for initialization ( so other classes can return it ) osc_addr_type_ptr = env->class_def; func = make_new_mfun( "int", "set", osc_address_set ); func->add_arg( "string" , "addr" ); if( !type_engine_import_mfun( env, func ) ) goto error; func = make_new_mfun( "int", "hasMsg", osc_address_has_mesg ); if( !type_engine_import_mfun( env, func ) ) goto error; func = make_new_mfun( "int", "nextMsg", osc_address_next_mesg ); if( !type_engine_import_mfun( env, func ) ) goto error; func = make_new_mfun( "int", "getInt", osc_address_next_int ); if( !type_engine_import_mfun( env, func ) ) goto error; func = make_new_mfun( "float", "getFloat", osc_address_next_float ); if( !type_engine_import_mfun( env, func ) ) goto error; func = make_new_mfun( "string", "getString", osc_address_next_string ); if( !type_engine_import_mfun( env, func ) ) goto error; func = make_new_mfun( "int", "can_wait", osc_address_can_wait ); if( !type_engine_import_mfun( env, func ) ) goto error; type_engine_import_class_end( env ); ... michael
Could you route them through OSCulator and alter their addresses based on
the host?
Mike
On Thu, Aug 19, 2010 at 1:05 AM, Michael Heuer
Michael Heuer
wrote: Is it possible to determine the IP address of the client sending an incoming OSC message? There is no documentation on the API of the OscEvent class.
Sorry, doesn't appear so.
src/ulib_opsc.cpp:104
// init base class if( !type_engine_import_class_begin( env, "OscEvent", "Event", env->global(), osc_address_ctor, osc_address_dtor ) ) return FALSE;
// add member variable - OSCAddress object
osc_address_offset_data = type_engine_import_mvar( env, "int", "@OscEvent_Data", FALSE ); if( osc_recv_offset_data == CK_INVALID_OFFSET ) goto error;
// keep type around for initialization ( so other classes can return it )
osc_addr_type_ptr = env->class_def;
func = make_new_mfun( "int", "set", osc_address_set ); func->add_arg( "string" , "addr" ); if( !type_engine_import_mfun( env, func ) ) goto error;
func = make_new_mfun( "int", "hasMsg", osc_address_has_mesg ); if( !type_engine_import_mfun( env, func ) ) goto error;
func = make_new_mfun( "int", "nextMsg", osc_address_next_mesg ); if( !type_engine_import_mfun( env, func ) ) goto error;
func = make_new_mfun( "int", "getInt", osc_address_next_int ); if( !type_engine_import_mfun( env, func ) ) goto error;
func = make_new_mfun( "float", "getFloat", osc_address_next_float ); if( !type_engine_import_mfun( env, func ) ) goto error;
func = make_new_mfun( "string", "getString", osc_address_next_string ); if( !type_engine_import_mfun( env, func ) ) goto error;
func = make_new_mfun( "int", "can_wait", osc_address_can_wait ); if( !type_engine_import_mfun( env, func ) ) goto error;
type_engine_import_class_end( env ); ...
michael _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
mike clemow wrote:
Could you route them through OSCulator and alter their addresses based on the host?
Yeah maybe. I wrote the author of TouchOSC to ask if a unique client identifier might be added to its OSC protocol. Mrmr has a options to use a bundle message style /mrmr/widgettype/widgetnumber/uniqueId or to include the unique identifier with each message /mrmr/widgettype/widgetnumber 0.1 uniqueId but I can't get it to connect to a ChucK OSC server on my Mac. TouchOSC works fine. michael http://hexler.net/software/touchosc http://mrmr.noisepages.com
Have you installed mrmr server? That system works by serving up the
interfaces to various clients and broadcasting from there, I thought. I
haven't really dug further into it than that. but you might still have to
use an OSC router like OSCulator just to figure out what's coming from what
ip. That's an interesting problem. I guess if all else fails, you could
write an OSC mapper script in python using pyliblo, or something, although,
that sounds like more effort than should be necessary.
mike
On Thu, Aug 19, 2010 at 4:27 PM, Michael Heuer
mike clemow wrote:
Could you route them through OSCulator and alter their addresses based on the host?
Yeah maybe. I wrote the author of TouchOSC to ask if a unique client identifier might be added to its OSC protocol. Mrmr has a options to use a bundle message style
/mrmr/widgettype/widgetnumber/uniqueId
or to include the unique identifier with each message
/mrmr/widgettype/widgetnumber 0.1 uniqueId
but I can't get it to connect to a ChucK OSC server on my Mac. TouchOSC works fine.
michael
http://hexler.net/software/touchosc http://mrmr.noisepages.com _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
mike clemow wrote:
Have you installed mrmr server? That system works by serving up the interfaces to various clients and broadcasting from there, I thought. I haven't really dug further into it than that. but you might still have to use an OSC router like OSCulator just to figure out what's coming from what ip. That's an interesting problem. I guess if all else fails, you could write an OSC mapper script in python using pyliblo, or something, although, that sounds like more effort than should be necessary.
According to the mrmr docs, clients are supposed to offer /mrmr connect ip-address to the server on its UDP OSC port, and I never see that, nor any other incoming OSC messages. Perhaps the mrmr server does something non-OSC to initiate. I'm all for fewer moving pieces, so I am hoping the TouchOSC guy will help me out. :) On a somewhat-related note, has anyone ever seen a tool that records and replays OSC messages, similar in spirit to a MIDI looper? I thought of writing one in ChucK, but that seems like a non-trivial problem. michael
On Thu, Aug 19, 2010 at 5:11 PM, Michael Heuer
According to the mrmr docs, clients are supposed to offer
/mrmr connect ip-address
to the server on its UDP OSC port, and I never see that, nor any other incoming OSC messages. Perhaps the mrmr server does something non-OSC to initiate.
I'm all for fewer moving pieces, so I am hoping the TouchOSC guy will help me out. :)
I hear that. OSC is great if you're writing your own protocol, but I guess identity is not a property that the TouchOSC thought to include. I think it's a really good feature to have.
On a somewhat-related note, has anyone ever seen a tool that records and replays OSC messages, similar in spirit to a MIDI looper? I thought of writing one in ChucK, but that seems like a non-trivial problem.
That sounds like a really awesome idea. I guess, if I were building that in chuck, I'd start with just an object that gets set up to record/playback only one parameter at a time and then leverage that into banks of network input recorders. <fantasy> OSCorder rec; rec.listenFor("/this/is/my/message", "i"); // starts the listener, creates an appropriate array type for data rec.play(1); // error! no data! rec.rec(1); // starts recording 1::minute => now: rec.rec(0); // stops recording rec.play(1); // plays it back, could be sporkable... 1::minute => now; rec.play(0); // stops playback rec.rate(0.5); // half speed rec.play(1); 2::minute => now; rec.play(0); rec.erase(); // clear array and start over.... </fantasy> Something like that sounds perfectly reasonable. That's just riffing off the LiSa object. There's probably a way to leverage LiCK to make it a lot more useful to you. mike
michael _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
2010/8/19 mike clemow
On Thu, Aug 19, 2010 at 5:11 PM, Michael Heuer
wrote: According to the mrmr docs, clients are supposed to offer
/mrmr connect ip-address
to the server on its UDP OSC port, and I never see that, nor any other incoming OSC messages. Perhaps the mrmr server does something non-OSC to initiate.
I'm all for fewer moving pieces, so I am hoping the TouchOSC guy will help me out. :)
I hear that. OSC is great if you're writing your own protocol, but I guess identity is not a property that the TouchOSC thought to include. I think it's a really good feature to have.
I've committed what I have for the TouchOSC stuff to LicK, in TouchOscServer.ck and the example layout in examples/touchOscSimple.ck
On a somewhat-related note, has anyone ever seen a tool that records and replays OSC messages, similar in spirit to a MIDI looper? I thought of writing one in ChucK, but that seems like a non-trivial problem.
That sounds like a really awesome idea. I guess, if I were building that in chuck, I'd start with just an object that gets set up to record/playback only one parameter at a time and then leverage that into banks of network input recorders.
<fantasy> OSCorder rec; rec.listenFor("/this/is/my/message", "i"); // starts the listener, creates an appropriate array type for data rec.play(1); // error! no data! rec.rec(1); // starts recording 1::minute => now: rec.rec(0); // stops recording rec.play(1); // plays it back, could be sporkable... 1::minute => now; rec.play(0); // stops playback rec.rate(0.5); // half speed rec.play(1); 2::minute => now; rec.play(0); rec.erase(); // clear array and start over.... </fantasy> Something like that sounds perfectly reasonable. That's just riffing off the LiSa object. There's probably a way to leverage LiCK to make it a lot more useful to you.
Yeah that does look reasonable. Of course the devil is in the implementation. :) michael
participants (2)
-
Michael Heuer
-
mike clemow