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

OscSender provides functions for sending OSC messages from Bela. More...

#include <OscSender.h>

Public Member Functions

 OscSender (int port, std::string ip_address=std::string("127.0.0.1"))
 
void setup (int port, std::string ip_address=std::string("127.0.0.1"))
 Initialises OscSender. More...
 
OscSendernewMessage (std::string address)
 Creates a new OSC message. More...
 
OscSenderadd (int payload)
 Adds an int argument to a message. More...
 
OscSenderadd (float payload)
 Adds a float argument to a message. More...
 
OscSenderadd (std::string payload)
 Adds a string argument to a message. More...
 
OscSenderadd (bool payload)
 Adds a boolean argument to a message. More...
 
OscSenderadd (void *ptr, size_t num_bytes)
 Adds a binary blob argument to a message. More...
 
void send ()
 Sends the message. More...
 
void send (const oscpkt::Message &extMsg)
 Sends a message. More...
 
void send_task_func (void *buf, int size)
 

Public Attributes

std::unique_ptr< UdpClientsocket
 
std::unique_ptr< oscpkt::Message > msg
 
std::unique_ptr
< oscpkt::PacketWriter > 
pw
 
std::unique_ptr< AuxTaskNonRTsend_task
 

Detailed Description

OscSender provides functions for sending OSC messages from Bela.

Functionality is provided for sending messages with int, float, bool, std::string and binary blob arguments. Sending a stream of floats is also supported.

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

Examples:
Communication/OSC/render.cpp.

Member Function Documentation

void OscSender::setup ( int  port,
std::string  ip_address = std::string("127.0.0.1") 
)

Initialises OscSender.

Must be called once during setup()

If address is left blank it will default to localhost (127.0.0.1)

Parameters
portthe UDP port number used to send OSC messages
addressthe IP address OSC messages are sent to (defaults to 127.0.0.1)
Examples:
Communication/OSC/render.cpp.
OscSender & OscSender::newMessage ( std::string  address)

Creates a new OSC message.

Parameters
addressthe address which the OSC message will be sent to
Examples:
Communication/OSC/render.cpp.
OscSender & OscSender::add ( int  payload)

Adds an int argument to a message.

Can optionally be chained with other calls to add(), newMessage() and send()

Parameters
payloadthe argument to be added to the message
Examples:
Communication/OSC/render.cpp.
OscSender & OscSender::add ( float  payload)

Adds a float argument to a message.

Can optionally be chained with other calls to add(), newMessage() and send()

Parameters
payloadthe argument to be added to the message
OscSender & OscSender::add ( std::string  payload)

Adds a string argument to a message.

Can optionally be chained with other calls to add(), newMessage() and send()

Parameters
payloadthe argument to be added to the message
OscSender & OscSender::add ( bool  payload)

Adds a boolean argument to a message.

Can optionally be chained with other calls to add(), newMessage() and send()

Parameters
payloadthe argument to be added to the message
OscSender & OscSender::add ( void *  ptr,
size_t  num_bytes 
)

Adds a binary blob argument to a message.

Copies binary data into a buffer, which is sent as a binary blob. Can optionally be chained with other calls to add(), newMessage() and send()

Parameters
ptrpointer to the data to be sent
num_bytesthe number of bytes to be sent
void OscSender::send ( )

Sends the message.

After creating a message with newMessage() and adding arguments to it with add(), the message is sent with this function. It is safe to call from the audio thread.

Examples:
Communication/OSC/render.cpp.
void OscSender::send ( const oscpkt::Message &  extMsg)

Sends a message.

Sends the message you pass in, which you will have created externally. It is safe to call from the audio thread.


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