![]() |
![]() |
This DLL allows you to receive OSC data in applications which can bind static librarys (DLLs) on Microsoft Windows.
Download the DLL with sample cpp files.
Each OSC message consists at least of one address string, which tells the application which subfunction is addressed. In the simplest case the address string is the only part of the whole message. Often you will have other parameters following though. The OSC DLL currently supports integer, floating point and string parameters.
The OSCDLL exports a number of functions you can call in your program.
Depending on your compiler/programming framework you have to take some steps to be able to access those functions.
For C i prepared a Header-File (oscinterface.h) and a source file (oscinterface.cpp) which allow the import of the functions into your program.
A typical integration into your program would look similar to this:
program initialisation
OSCLinkDLL(); //binds the DLL
OSCOpen(); //opens the OSC connection, will always listen on port 7000
main loop of your program, this example assumes you are receiving tracking data from eyecon. The four parameters are1. integer timestamp // used as an id to track an individual
2. boolean present // will usually be 1 (true) if this drops to 0 (false) it means that the person with this ID dissapeared
3. float x // x-coordinate scaled to range 0..1
4. float y // y-coordinat scaled to range 0..1
int cnt = OSCMsgCnt(); //number of osc-message in input queue
for (i:=0; i <ccnt;i++) //process all messages which have been received since last loop
{char* buffer = OSCAddress(); //OSC address is a string which tells us which subfuntion to use
int n = OSCMsgParaCnt(); //how many messageparameters are available
if (n>=4)
{
int id = OSCParaAsInt(0);
int alive = OSCParaAsInt(1);
float x = OSCParaAsSingle(2);
float y = OSCParaAsSingle(3);
ProcessPosition(id,alive,x,y); // user function
}
OSCNext(); //release current message, go to next one
}
program finalisation
OSCClose(); //closes the OSC connection
void OSCOpen(void) | Iinitializes the OSC function. Port is always 7000 for now (not very nice...) |
void OSCClose(void) | Ends the OSC controls function. |
int OSCMsgCnt(void) | Indicates, how many OSC messages are ready and waiting to be processed |
int OSCMsgParaCnt(void) | Returns how many parameters the current OSC message is carrying |
char* OSCAddress(void) | Returns the address string for the current OSC message |
int OSCParaAsInt(int n); | Interprets a paramter as Integer |
float OSCParaAsSingle(int n); | returns the OSCparameter with index n, interpreted as datatype single |
char* OSCParaAsString(int n); | returns the OSCparameter with index n, interpreted as datatype string |
void OSCNext(void) | Release the current message, make the next one current. Mandatory use after accessing elements of the message |
OSC DLL Help, this file last changed on 25. Sept 2007