Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
OscSender.h
1 #pragma once
2 
3 #include <memory>
4 #include <vector>
5 
6 class UdpClient;
7 class AuxTaskNonRT;
8 namespace oscpkt{
9  class Message;
10  class PacketWriter;
11 }
12 
22 class OscSender{
23  public:
24  OscSender();
25  OscSender(int port, std::string ip_address=std::string("127.0.0.1"));
26  ~OscSender();
27 
39  void setup(int port, std::string ip_address=std::string("127.0.0.1"));
40 
47  OscSender &newMessage(std::string address);
56  OscSender &add(int payload);
65  OscSender &add(float payload);
74  OscSender &add(std::string payload);
83  OscSender &add(bool payload);
94  OscSender &add(void *ptr, size_t num_bytes);
103  void send();
104 
105  std::unique_ptr<UdpClient> socket;
106 
107  std::unique_ptr<oscpkt::Message> msg;
108  std::unique_ptr<oscpkt::PacketWriter> pw;
109 
110  std::unique_ptr<AuxTaskNonRT> send_task;
111  void send_task_func(void* buf, int size);
112 };
void send()
Sends the message.
Definition: OscSender.cpp:61
OscSender & newMessage(std::string address)
Creates a new OSC message.
Definition: OscSender.cpp:35
OscSender & add(int payload)
Adds an int argument to a message.
Definition: OscSender.cpp:40
void setup(int port, std::string ip_address=std::string("127.0.0.1"))
Initialises OscSender.
Definition: OscSender.cpp:22
Definition: UdpClient.h:21
Definition: AuxTaskNonRT.h:20
OscSender provides functions for sending OSC messages from Bela.
Definition: OscSender.h:22