BBTouch, code, meta, multitouch, openSoundControl

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.

No TweetBacks yet. (Be the first to Tweet this post)

5 Responses to “OSC now with more Cocoa”

  1. sandor 21 July 2008 at 6:38 pm #

    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

  2. Ben 21 July 2008 at 6:53 pm #

    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

  3. solydzajs 21 July 2008 at 9:14 pm #

    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

  4. sandor 22 July 2008 at 7:10 pm #

    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!

  5. Ben 22 July 2008 at 10:01 pm #

    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

Leave a Reply

You must be logged in to post a comment.

About

meMy full name is Ben Britten Smith.

I go by Ben Britten because Ben Smith is a bit too common and using my full name is a mouthful.

I live in Melbourne, Australia and service clients all over the globe.

Contact

Have some questions?

Feel free to contact me directly at support@benbritten.com with any questions you might have about any of the applications I support.

Thanks!

PHVsPjxsaT48c3Ryb25nPndvb19hYm91dDwvc3Ryb25nPiAtIGFib3V0LXdpZGdldDwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2JlbG93X2ltYWdlPC9zdHJvbmc+IC0gaHR0cDovL2JlbmJyaXR0ZW4uY29tL3dwLWNvbnRlbnQvdGhlbWVzL3ZpYnJhbnRjbXMvaW1hZ2VzL2FkNDY4LmpwZzwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2JlbG93X3VybDwvc3Ryb25nPiAtIGh0dHA6Ly93d3cud29vdGhlbWVzLmNvbTwvbGk+PGxpPjxzdHJvbmc+d29vX2FsdF9zdHlsZXNoZWV0PC9zdHJvbmc+IC0gYmVuYnJpdHRlbi5jc3M8L2xpPjxsaT48c3Ryb25nPndvb19ibG9ja19pbWFnZTwvc3Ryb25nPiAtIGh0dHA6Ly9iZW5icml0dGVuLmNvbS93cC1jb250ZW50L3RoZW1lcy92aWJyYW50Y21zL2ltYWdlcy9hZDMzNi5qcGc8L2xpPjxsaT48c3Ryb25nPndvb19ibG9ja191cmw8L3N0cm9uZz4gLSBodHRwOi8vd3d3Lndvb3RoZW1lcy5jb208L2xpPjxsaT48c3Ryb25nPndvb19ibG9nPC9zdHJvbmc+IC0gdHJ1ZTwvbGk+PGxpPjxzdHJvbmc+d29vX2Jsb2djYXQ8L3N0cm9uZz4gLSAvY2F0ZWdvcnkvYmxvZy88L2xpPjxsaT48c3Ryb25nPndvb19jYXRfbWVudTwvc3Ryb25nPiAtIGZhbHNlPC9saT48bGk+PHN0cm9uZz53b29fY29udGFjdDwvc3Ryb25nPiAtIGNvbnRhY3Q8L2xpPjxsaT48c3Ryb25nPndvb19jdXN0b21fY3NzPC9zdHJvbmc+IC0gPC9saT48bGk+PHN0cm9uZz53b29fY3VzdG9tX2Zhdmljb248L3N0cm9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