Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
Public Member Functions | List of all members
OSCServer Class Reference

OSCServer provides functions for receiving OSC messages in Bela. More...

#include <OSCServer.h>

Public Member Functions

void setup (int port)
 Sets the port used to receive OSC messages. More...
 
bool messageWaiting ()
 Returns true if an OSC message has been received and queued. More...
 
oscpkt::Message popMessage ()
 Removes and returns the oldest message from the queue. More...
 
void receiveMessageNow (int timeout)
 Blocks execution until an OSC message is received. More...
 

Detailed Description

OSCServer provides functions for receiving OSC messages in Bela.

When an OSC message is received, the message is decoded by the OSCServer off the audio thread and placed in an internal queue. This queue can be polled from the audio thread using messageWaiting(), and if messages are present they can be accessed with popMessage().

Parsing the OSC messages is left to the user

Care must be taken to use the correct methods while running on the audio thread to prevent Xenomai mode switches and audio glitches.

Uses oscpkt (http://gruntthepeon.free.fr/oscpkt/) underneath

Examples:
OSC/render.cpp.

Member Function Documentation

void OSCServer::setup ( int  port)

Sets the port used to receive OSC messages.

Must be called once during setup()

Parameters
portthe port used to send OSC messages
Examples:
OSC/render.cpp.
bool OSCServer::messageWaiting ( )

Returns true if an OSC message has been received and queued.

This method is audio-thread safe, and can be used from render()

Use this method to check if a message has been received before calling popMessage()

Examples:
OSC/render.cpp.
oscpkt::Message OSCServer::popMessage ( )

Removes and returns the oldest message from the queue.

This method is audio-thread safe, and can be used from render()

This function returns the oldest queued OSC message in the form of an oscpkt Message object, which must then be parsed. It also removes that message from the queue.

Returns
oscpkt::Message an oscpkt Message object representing an OSC message
Examples:
OSC/render.cpp.
void OSCServer::receiveMessageNow ( int  timeout)

Blocks execution until an OSC message is received.

This method is not audio-thread safe, and can not be used from render()

This method blocks the thread's execution until an OSC message is received or timeout milliseconds have elapsed. This should never be called from render() but is useful for receiving messages during setup or an auxiliary task

Parameters
timeoutthe time in milliseconds to block for if no messages are received. Null will block indefinitely.
Examples:
OSC/render.cpp.

The documentation for this class was generated from the following file: