Vuo  1.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Typedefs | Functions | Variables
VuoOsc.cc File Reference

Description

VuoOsc implementation.

Classes

class  VuoOscInPacketListener
 This class maintains a list of trigger functions to be called when an OSC message is received. More...
 
class  VuoOscInSocket
 Opens a reusable UDP socket, attaches the specified listener to it (on a separate thread), and starts it receiving messages. More...
 
struct  VuoOscIn_internal
 Private data for a VuoOscIn instance. More...
 
class  VuoOscOutputIdentifier
 Enable VuoOscOutputDevice to be used in std::map. More...
 
struct  _VuoOscOut_internal
 Private data for a VuoOscOut instance. More...
 

Typedefs

typedef void(* VuoOscReceivedMessageTrigger )(VuoOscMessage)
 A node's trigger method, to be called when an OSC message is received.
 
typedef struct
_VuoOscOut_internal
VuoOscOut_internal
 Private data for a VuoOscOut instance.
 

Functions

static void registerCallback (CFNetServiceRef theService, CFStreamError *error, void *info)
 Callback needed to asynchronously register a CFNetService.
 
static CFNetServiceRef VuoOsc_createNetService (char *name, int port, bool isServer)
 Creates a new CFNetService for advertising an OSC server or client.
 
static void VuoOsc_destroyNetService (CFNetServiceRef netService)
 Stop advertising the Bonjour service.
 
 __attribute__ ((constructor)) static void VuoOscIn_init(void)
 Initializes VuoOscInPool_semaphore.
 
void VuoOscIn_destroy (VuoOscIn oi)
 Destroys an OSC server.
 
VuoOscIn VuoOscIn_make (const VuoOscInputDevice device)
 Creates a reference-counted object to manage receiving messages from a OSC device.
 
void VuoOscIn_enableTriggers (VuoOscIn oi, VuoOutputTrigger(receivedMessage, VuoOscMessage))
 Sets up the OSC server to call the trigger functions when it receives a message.
 
void VuoOscIn_disableTriggers (VuoOscIn oi)
 Stops the OSC server from calling trigger functions when it receives a message.
 
static int VuoOsc_findAvailableUdpPort (void)
 Returns an available UDP port.
 
VuoOscOut VuoOscOut_getShared (const VuoOscOutputDevice device)
 Returns the reference-counted object for the specified OSC output device.
 
void VuoOscOut_sendMessages (VuoOscOut ao, VuoList_VuoOscMessage messages)
 Sends a message to the specified OSC device.
 
 VUOKEYEDPOOL (VuoOscOutputIdentifier, VuoOscOut_internal)
 
static void VuoOscOut_destroy (VuoOscOut_internal ai)
 
VuoOscOut_internal VuoOscOut_make (VuoOscOutputIdentifier device)
 
 VUOKEYEDPOOL_DEFINE (VuoOscOutputIdentifier, VuoOscOut_internal, VuoOscOut_make)
 

Variables

std::map< unsigned int,
VuoOscInSocket * > 
VuoOscInPool
 Sockets, keyed by port.
 
dispatch_semaphore_t VuoOscInPool_semaphore = NULL
 Synchronizes access to VuoOscInPool.
 

Class Documentation

struct VuoOscIn_internal
Class Members
VuoOscInputDevice device The port to listen on, and the name of the Bonjour service.
VuoOscReceivedMessageTrigger receivedMessage The trigger function to call when a newly-arrived OSC message has been parsed.
struct _VuoOscOut_internal
Class Members
VuoOscOutputDevice device The target device this instance represents.
CFNetServiceRef netService
dispatch_queue_t queue
UdpTransmitSocket * socket

Typedef Documentation

Private data for a VuoOscOut instance.

typedef void(* VuoOscReceivedMessageTrigger)(VuoOscMessage)

A node's trigger method, to be called when an OSC message is received.

Function Documentation

__attribute__ ( (constructor)  )

Initializes VuoOscInPool_semaphore.

static void registerCallback ( CFNetServiceRef  theService,
CFStreamError *  error,
void *  info 
)
static

Callback needed to asynchronously register a CFNetService.

Apparently this doesn't need to do anything.

static CFNetServiceRef VuoOsc_createNetService ( char *  name,
int  port,
bool  isServer 
)
static

Creates a new CFNetService for advertising an OSC server or client.

static void VuoOsc_destroyNetService ( CFNetServiceRef  netService)
static

Stop advertising the Bonjour service.

static int VuoOsc_findAvailableUdpPort ( void  )
static

Returns an available UDP port.

void VuoOscIn_destroy ( VuoOscIn  oi)

Destroys an OSC server.

void VuoOscIn_disableTriggers ( VuoOscIn  oi)

Stops the OSC server from calling trigger functions when it receives a message.

This function may be called from any thread.

void VuoOscIn_enableTriggers ( VuoOscIn  oi,
VuoOutputTrigger(receivedMessage, VuoOscMessage  
)

Sets up the OSC server to call the trigger functions when it receives a message.

This function may be called from any thread.

VuoOscIn VuoOscIn_make ( const VuoOscInputDevice  device)

Creates a reference-counted object to manage receiving messages from a OSC device.

If the device's port is nonzero, attempts to use the specified port. If zero, automatically chooses an unused port. If the port is successfully opened, advertises the server via Bonjour.

VuoOscOut VuoOscOut_getShared ( const VuoOscOutputDevice  device)

Returns the reference-counted object for the specified OSC output device.

void VuoOscOut_sendMessages ( VuoOscOut  ao,
VuoList_VuoOscMessage  messages 
)

Sends a message to the specified OSC device.

Variable Documentation

std::map<unsigned int, VuoOscInSocket *> VuoOscInPool

Sockets, keyed by port.

dispatch_semaphore_t VuoOscInPool_semaphore = NULL

Synchronizes access to VuoOscInPool.