Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
OSCClient.h
1 /***** OSCClient.h *****/
2 #ifndef __OSCClient_H_INCLUDED__
3 #define __OSCClient_H_INCLUDED__
4 
5 #include <UdpClient.h>
6 #include <Bela.h>
7 #include <oscpkt.hh>
8 #include <queue>
9 
25  public:
36  OSCMessageFactory& to(std::string address);
37 
50  OSCMessageFactory& add(std::string);
51  OSCMessageFactory& add(int);
52  OSCMessageFactory& add(float);
53  OSCMessageFactory& add(bool);
54  OSCMessageFactory& add(void *ptr, int size);
55 
66  oscpkt::Message end();
67 
68  private:
69  oscpkt::Message msg;
70 };
71 
80 class OSCClient{
81  public:
82  OSCClient();
83 
100  void setup(int port, const char* address="127.0.0.1", bool scheduleTask = true);
101 
113  void queueMessage(oscpkt::Message);
114 
126  void sendMessageNow(oscpkt::Message);
127 
137 
138  private:
139  const char* address;
140  int port;
141 
142  UdpClient socket;
143  AuxiliaryTask OSCSendTask;
144  std::queue<oscpkt::Message> outQueue;
145  oscpkt::PacketWriter pw;
146  char* outBuffer;
147 
148  static void sendQueue(void*);
149 
150  void createAuxTasks();
151  void queueSend();
152 
153 };
154 
155 #endif
OSCMessageFactory provides functions for building OSC messages within Bela.
Definition: OSCClient.h:24
void sendMessageNow(oscpkt::Message)
Send an OSC message immediately *** do not use on audio thread! ***.
OSCMessageFactory & add(std::string)
Adds a parameter to an OSC message.
void setup(int port, const char *address="127.0.0.1", bool scheduleTask=true)
Sets the port and optionally the IP address used to send OSC messages.
oscpkt::Message end()
Finalises and returns the OSC message.
void queueMessage(oscpkt::Message)
Queue an OSC message to be sent at the end of the current audio block.
OSCClient provides functions for sending OSC messages from Bela.
Definition: OSCClient.h:80
OSCMessageFactory & to(std::string address)
Sets the address of the OSC message.
OSCMessageFactory newMessage
Create a new oscpkt::Message object representing an OSC message.
Definition: OSCClient.h:136
Main Bela public API.
Definition: UdpClient.h:21
void * AuxiliaryTask
Definition: Bela.h:445