OSC for Qt4

ofqf is a native OSC implementation in Qt4. Native means that ofqf doesn't depend on other external libs (except for QtCore and QtNetwork) and ofqf isn't just a wrapper around liblo or something.

Why should I use ofqf?

If your app is using Qt, you do have several choices for OSC, but all involve wrapping external libraries with some QObject so you can use signals/slots to communicate with the rest of your app. In that case you will want to use ofqf!

Show me examples!

server

A simple OSC-server that can be shut down by the osc-message "/quit" is the following:

QOscServer* s = new QOscServer(
  QHostAddress::Any,
  5000,
  QCoreApplication::instance()
);
PathObject* pathquit = new PathObject(
  "/quit",
  QVariant::Invalid,
  QCoreApplication::instance()
);
QObject::connect(
  pathquit, SIGNAL( data() ),
  QCoreApplication::instance(), SLOT( quit() )
);

Thats it on the server side...

client

A simple client to stop that server on button-click:

int main( int argc, char** argv )
{
  QApplication* app = new QApplication( argc, argv );

  QPushButton* btn = new QPushButton( "Quit the server and this client", 0 );
  btn->show();

  QOscClient* c = new QOscClient( QHostAddress::LocalHost, 5000, app );
  PathObject* pathquit = new PathObject( "/quit", QVariant::Invalid, c );

  QObject::connect( btn, SIGNAL( clicked() ), pathquit, SLOT( send() ) );
  QObject::connect( btn, SIGNAL( clicked() ), btn, SLOT( close() );

  return app->exec();
}

Download

Grab the sources of version 0.1.1 from here: ofqf-0.1.2.tar.bz2

Sources

As of end of May 2014, ofqf is on github.

I think I will sanitize the repo a bit (add tags on the revisions I released years ago). And the changed name from ofqf to ofq is to anticipate a port to Qt5, which would make OSC-for-Qt4 into OSC-for-Qt5. Well, lets just make it OSC-for-Qt...

Installation

Building the lib and the samples is done with calling scons.

If you want to install lib, headers and pkg-config-file you have to use scons install which installs by default to /usr/local. To select another prefix you have to use scons install PREFIX=<dir>.

To un-install the installed files use scons -c install or, if you used your own prefix, scons -c install PREFIX=<dir>.