Working with OSC inside C/C++

For those that are searching for OSC libs for either C or C++, here’s my top two:

  • liblo is a lightwheight OSC implementation, fully C and targeted for POSIX-compliant systems.

It is very simple to install (and for those who use Debian can enjoy the apt-get install liblo0ldbl or liblo0-dev) or to build from source (see sourceforge to browse the code). I’ve made a test some while ago, that used liblo0 to interface a OpenGL game with PureData for sound engine, here’s the video – it’s just a proof of concept:

Space Invaders with OSC (Pure Data + Libl0) #1 from PedroLopes on Vimeo.

  • OSCpack is the big brother of liblo, because it is C++ driven and easier to build on Windows, thus making it cross-plataform (still POSIX compliant under *UNIX it seems…)

It is very simple to use, I’ve downloaded the latest release from this link, and compiled it. It seems that if you are using the latest gcc it will give errors not finding headers for memcpy, atoi and memset. Just edit the *.cpp and add either #include “cstring”, “stdlib” or other that you seem is needed. It will compile smoothly after (well.. some warnings are shown).

p.s.: I’ve uploaded OSCpack to my github as a part of the previous project, take a look at the files if you have build issues with gcc 4.4.1 or so.

After building it, just go to the bin and type ./OscUnitTests and if all goes well:

> 75 tests run, 75 passed, 0 failed.

  • So depending on the nature of your project you can either go each way, if you’re looking to a more C++ oriented version and easier to build on Linux, I’d go for OscPack, if not and then liblo0 is an excellent lib!

Leave a Reply