Introduction
VVOSC is an Objective-c framework for assembling, sending, and receiving OSC (Open Sound Control) messages on OS X. A simple sample application (gui) which sends and receives OSC messages is also included to aid in the debugging of your software. There's also an SDK which allows you to develop iPhone applications which use VVOSC. All the source code is available on the project homepage: http://code.google.com/p/vvopensource
Features and Capabilities
Includes a sample GUI app for debugging OSC applications and hardware that also demonstrates use of the framework
Packet parsing (client) + construction (server)
Creates bundles/nested bundles, safely parse bundles/nested bundles
Detects other OSC destinations via bonjour/zero-conf networking and automatically creates output ports so you can send data to them.
Input ports automagically advertise their presence via bonjour/zero-conf networking. This is as close to no-setup as it gets!
Supports the following data types: i (int32), f (float32), s/S (OSC-string), b (OSC blob), h (64-bit int), d (64-bit float/double), r (32-bit RGBA color), m (MIDI message), T (tru), F (false), N(nil), I (infinity), t (OSC-timetag)
Processing frequency defaults to 30hz, but may be adjusted dynamically well in excess of 100hz
Multithreaded- each input port runs on its own thread- and threadsafe.
Optional OSC address space classes (OSCNode & OSCAddressSpace) may be used to quickly create a simple OSC-based API for controlling software. Address space includes POSIX regex-based pattern matching engine for dispatching a single message to multiple nodes.
Built on a handful of small, easy-to-grok classes written specifically for OS X. Very easy to understand, modify, subclass, or extend.
Project includes targets that build and install an SDK for using VVOSC in iOS apps
Breaks from the OSC specification
"char" data type not supported yet, you can use "string" in the meantime
It's possible to create an OSCValue from an NSString containing UTF8 characters, which VVOSC will try to send- and if the software receiving this data doesn't freak out, this allows you to UTF8 characters. In other words, VVOSC doesn't explicitly prevent the use of non-ASCII characters, so it's possible to use it to create incompatible OSC data!
The OSC specification describes a limited subset of regex to be used in wildcard/pattern matching for OSC dispatch. VVOSC's message dispatch is presently a POSIX regex engine simply because it was faster and easier to get going (it's built into the OS) than rolling my own. The specific engine used may change if message dispatch becomes a speed issue in the future; presumably, this ambiguity is why the OSC spec describes a specific and limited subset of regex!
The OSC spec describes the optional type characters [ and ] to delineate arrays and basic node-based structures for ad-hoc data types. Lacking any specific usage examples, this isn't supported yet- if someone wants to send me a specific example i can use to support this protocol properly, please let me know.
While VVOSC parses, stores, and allows you to set OSC time tags (and even create and pass time tags as values), it doesn't perform any delay or scheduling if it receives an OSC bundle with a time tag which is later than the current time. Parsed time tags are available to your applications as the 'timeTag' variable of a passed OSCMessage, which is stored as an NSDate (which, internally, is a double which basically represents 64-bit NTP time, as I understand it).
Sample code
// create an OSCManager- set myself up as its delegate
manager = [[OSCManager alloc] init];
[manager setDelegate:self];
// create an input port for receiving OSC data
[manager createNewInputForPort:1234];
// create an output so i can send OSC data to myself
outPort = [manager createNewOutputToAddress:@"127.0.0.1" atPort:1234];
// make an OSC message
newMsg = [OSCMessage createWithAddress:@"/Address/Path/1"];
// add a bunch arguments to the message
[newMsg addInt:12];
[newMsg addFloat:12.34];
[newMsg addColor:[NSColor colorWithDeviceRed:0.0 green:1.0 blue:0.0 alpha:1.0]];
[newMsg addBOOL:YES];
[newMsg addString:@"Hello World!"];
// send the OSC message
[outPort sendThisMessage:newMsg];