ofxOsc v0.3 now available

hey,

ofxOsc v0.2 is available here:
http://www.frey.co.nz/projects/ofxosc

i’ve updated it to include bundle support (only for sending - bundles are automatically and transparently unwrapped into their component messages on receive). i’ve also changed the hostname argument on setup() to a std::string (rather than a const char*). and, lastly, i’ve added a clear() method to ofxOscMessage so you can reuse the same message object when sending.

have a look at examples/oscSendExample/testApp.cpp for an example of bundle creation and sending - basically you just go like this:

  
  
ofxOscBundle b;  
  
// make message  
ofxOscMessage m;  
m.setAddress( "/bundle1" );  
m.addIntArg( 3 );  
// add to bundle  
b.addMessage( m );  
  
// and repeat  
m.clear();  
m.setAddress( "/bundle2" );  
m.addFloatArg( 5.5f );  
// add to bundle  
b.addMessage( m );  
  
// make nested bundle  
ofxOscBundle nested_b;  
m.clear();  
m.setAddress( "/bundle3a" );  
m.addStringArg( "nested bundle test" );  
nested_b.addMessage( m );  
m.clear();  
m.setAddress( "/bundle3b" );  
m.addStringArg( "test2" );  
nested_b.addMessage( m );  
  
// add to outer bundle  
b.addBundle( nested_b );  
  
// send  
osc_sender.sendBundle( b );  
  

any bugs, problems, let me know.

Great damian!

I’ll definitely be using this within the next couple days! I really appreciate you adding the support for bundles. =)

Damian you rock!

David and myself are currently hard at work on a follow-up piece (called Swarm) of our ‘Wixel Cloud’ light sculpture. Check out these links for info and experiments:

Wixel Cloud (3d physical light sculpture made out of 75 wixels):
http://blendid.nl/wixelcloud/
Video of the piece at Vimeo:
http://www.vimeo.com/1344159
Wixels - Our wireless pixels (wirelessly controlled, physical pixels):
http://blendid.nl/wixels/

I spotted Dinne’s question on OSC bundles on the forum the other day.
http://forum.openframeworks.cc/t/ofxoscmessage—sending-bunles-of-packets/914/3">ofxOscMessage - Sending Bunles of packets]http://forum.openframeworks.cc/t/ofxoscmessage—sending-bunles-of-packets/914/3 are helping us out with the hardware design - and since we’re going to scale up to 500 wixels for our next piece, bundles are a very cool (and in our case vital!) feature to have). Great to see your update arrive in such an amazingly short time - wow!

Swarm will be part of an interactive light-art exhibition in Eindhoven coming September. So our new wixel hardware is going to be fully assembled very soon and i’m eager to see the new OSC code at work!

Thanks a bundle! :smiley:
-Tim

that’s because i’m awesome. :wink:

i’m going to be out of the Netherlands in September unfortunately, otherwise i’d so be there. oh well…

i just quit my job making Flash websites, but that means i’m running out of money. does someone want to give me a job?

Hi Damian,

Thanks for a sweet lib. Is it possible to see which IP sent the OSC message? How? If not would it be easy to implement?

cheers
/cj

Yea being able to distinguish senders would be ace… I’d vote for this too…

hmm, should’ve put a watch on this thread, i somehow missed this feature request…

hold tight, 0.03 coming soon, with much more relaxed message parsing (no more assert() crashes if you try and get the wrong argument type - now it just coerces the input type to the requested type).

sooooon…

all right, v0.3 is up, available at http://www.frey.co.nz/projects/ofxosc.

  • i’ve made it much more forgiving when there’s a type mismatch. before it threw an exception if you tried to get a float pointer as an int or vice versa - now it prints a warning to stderr and tries to convert to the proper format (even works for getting a float as a string).

  • the message.getAddress() now returns a string rather than a char* - this will cause existing code that uses strcmp( m.getAddress(), “pattern” ) to break, you’ll have to go strcmp( m.getAddress().c_str(), “pattern” ) instead, or just use m.getAddress() == “pattern” instead.

  • you can get the remote ip and port by calling m.getRemoteIp() (returns string) and m.getPort() (returns int).

please try it out and let me know what you think.

cheers
d

kool. I will use this for my next ofxTuio update even though that might take some more time since I am busy right now.

hi Damian, hi guys,

Im still a bit new with OF and how to communicate between other platforms,
Im interested in working with MAX and OF since I havent seen much audio libraries in OF yet… but anyway my question is the following:
I tried to test the example of the ofxOsc but I couldnt … it shows a window with an error… just one error that drives me crazy:

if anybody knows why would be great
thanks for all!

Damian, thanks for your work on this.

Receiving OSC messages in OF is working beautifully with your library, but I’m having trouble sending messages with 0.3.

The following chunk never gets the message where it needs to go. The code compiles without warning or errors.

  
ofxOscMessage mout;  
mout.setAddress( "/wii/forcefeedback" );  
mout.addIntArg( 1 );  
sender.sendMessage( mout );  

Once the above is invoked, the following message ends up in the system console after a 5 - 10 second delay:

“OSC Problem: Bad size count 469762048 in bundle (only 28 bytes left in entire bundle).”

This seems like a very large bundle for a single integer? Is it possible that instead of sending the message just snowballs into a larger bundle — explaining the delay before the error registers in the system console?

Is there a library file for code:blocks? I’m getting a lot of errors with the other win32 libraries. I’ve tried .a and .lib so far.

Thanks,

hey guys!

ofxOSC looks really amazing but I’m having the same problem as popa2k with CB on windows :frowning:
I even tried a self-compiled lib from the last version of oscpack I found on the website but CB keeps failing during the linking!

Any idea why?

thanks!
kikko

i’m using it with no problems on os x … i set xcode to use gcc 4.2 and not the default 4.0

Hi,

I managed to get it to compile on XP with CodeBlocks. I was using OF v 0.0573, I don’t know if that might be an issue?

best regards

david

Well, the strange part is that it does compile with the same lib file with the 0.005 prerelease.

I tried to google it a bit and read that it could be something to deal with WSAStartup but my knowledge in c++ is 0-- so i can’t go further :confused:

yay, thks to David, i finally got it to work!
It looks like the osc addon i got with the 0.0573 (c::b windows) was not up to date. Maybe I put it myself, I can’t remember.
But anyway, for people having the same problem i had on windows, it should work just by replacing the osc folder with the one of frey’s website.
thks!

v.06 is completely differnt, so it won’t work with that. 0573 seems to work every time.

I’m trying to update from v2 to v3 and I’m getting:

addons\ofxosc\src\ofxoscreceiver.cpp(33) : error C3861: ‘CreateMutex’: identifier not found

I’m on VS2008.

yes, u need to change CreateMutex by CreateMutexA, that’s fixed in 006