OSC now with more Cocoa21 Jul
Hello all,
So, I am in the midst of adding TUIO event generation to the BBTouch code base. For anyone who doesnt know, TUIO is a subset of OSC (open sound control) commands, and is sent using the OSC standard.
Sooo... to this effect, i started researching all the various OSC libs out there, and there are a few, and they are all pretty good. However, in the spirit of this project (ie an all-cocoa multi-touch thing), and in an effort to learn more about the OSC protocol, i decided to start over from scratch.
That was a few days ago, and here is a new OSC implementation in not-so-pure cocoa/objc. There is a bunch of POSIX and C stuff in there to deal with the sockets and the bit-level manipulation of the data. but that is all abstracted away into some nice objects.
here is some sample code for making an OSC listener: (aka a server)
BBOSCListener* anOSCListener = [BBOSCListener defaultListenerOnPort:4556];
that's it. the listener will use the default dispatch delegate to handle the messages coming in, and there you go. (note: be sure to retain your listener if you use the 'easy' method above)
and to send messages? like so:
BBOSCSender* anOSCSender =
[BBOSCSender senderWithDestinationHostName:@"localhost" portNumber:4556];
if (![anOSCSender sendOSCPacket:newMessage]) {
NSLog(@"Oh Noes!!");
}
that's it.
generating messages and bundles is also simple:
BBOSCMessage * newMessage =
[BBOSCMessage messageWithBBOSCAddress:
[BBOSCAddress addressWithString:@"/test/1/groovy"]];
[newMessage attachArgument:
[BBOSCArgument argumentWithString:@"Testing!!"]];
[newMessage attachArgument:
[BBOSCArgument argumentWithInt:12]];
and bundles are similar.
Anyhooo.. the code is available here:
http://code.google.com/p/bbosc/
It is all commented nicely so you should be able to re-use it pretty easily.
A few notes: First, it should probably be a framework, but for now it is just a collection of files. Also, I havent gotten around to building a nice message dispatch system. so for now, if you want to use the code to build a server, you will have to implement your own dispatch. I built it originally to be the client code for BBTouch TUIO events, but it seemed silly not to build the listener stuff as well, so i built that in. (sans dispatch). I am going to add the sending stuff to bbtouch, then i will come back and add a nice dispatch module into BBOSC.



My full name is Ben Britten Smith.
hey ben!
glad to see that you apparently got some spare time – this means that the payed job goes well so i hope ;-) Looks like the TUIO stuff will comming soon… Keep it up man! BTW: in case you missed that, take a look at NUI-Group: http://nuigroup.com/forums/viewthread/2462/P15/ this guy from the RWTH (university of aachen – germany) seems to be quite advanced with the cocoa-stuff…
Cheers,
Sandor
Hey Sandor!
thanks for the link, i hadn’t seen that, it looks very promising! I can’t wait to see the code when they release it. I am not sure about the iphone-as-a-touchpad idea, but it might be totally cool.
Anyhow, i plod along :-)
this week looks promising… hopefully i will get the TUIO stuff into bbtouch.. you dont happen to know of any good TUIO server apps that run on the mac (like the flash apps n stuff?) i will need something to test against..
Cheers!
-b
Hi Ben,
Great work, I’m checking out the source code from SVN right now :-)
I will also try to test whether it compiles correctly in iPhone SDK.
Keep up the good work! And I will catch you online.
Best,
Pawel Solyga
Hey Ben! Great work man! I just sit here an i’m wondering about your progress ;-) For the Mac stuff: maybe a stupid idea but i saw that there is a TUIO implementation for Quartz Composer (located btw in the same repo as BBTouch)… So why not take that for testing? Or is that too simple for that? BTW: that was the reason why i put that in the UI-concept i have posted (well concept is too much said i know – LOL!)… I will have a look today evening at the new stuff with TUIO…
Keep it up man!
Hey Sandor,
naw, that is a good idea :-) the QC stuff is cool. I am definitely going to get into that at some point. I havent really had much of a look at it yet. I wonder if anyone has done a full blob detector as a quartz filter yet? I was thinking a great deal about that when I was first writing the blob stuff. The way the CIImage filters work is optimized for rendering, so it is a bit strange to work with (ie you dont get a big bufffer of bits to play with, you just get a callback that asks you to handle some bits here and there…
Anyhow all good ideas :-) keep em coming :-)
let me know how the TUIO stuff goes, i know i had a fun time playing with the Processing sketch and actually seeing it all work together.
Cheers!
-b