comparison include/OSCServer.h @ 475:faa5f58c71af prerelease

Headers
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 20 Jun 2016 20:39:00 +0100
parents e4392164b458
children
comparison
equal deleted inserted replaced
474:efc9a9f8e63d 475:faa5f58c71af
5 #include <UdpServer.h> 5 #include <UdpServer.h>
6 #include <oscpkt.hh> 6 #include <oscpkt.hh>
7 #include <Bela.h> 7 #include <Bela.h>
8 #include <queue> 8 #include <queue>
9 9
10 #define UDP_RECIEVE_TIMEOUT_MS 20 10 #define UDP_RECEIVE_TIMEOUT_MS 20
11 #define UDP_RECIEVE_MAX_LENGTH 16384 11 #define UDP_RECEIVE_MAX_LENGTH 16384
12 12
13 class OSCServer{ 13 class OSCServer{
14 public: 14 public:
15 OSCServer(); 15 OSCServer();
16 16
25 // audio-thread safe, but don't call unless messageWaiting() returns true 25 // audio-thread safe, but don't call unless messageWaiting() returns true
26 oscpkt::Message popMessage(); 26 oscpkt::Message popMessage();
27 27
28 // if there are OSC messages waiting, decode and queue them 28 // if there are OSC messages waiting, decode and queue them
29 // not audio-thread safe! 29 // not audio-thread safe!
30 void recieveMessageNow(int timeout); 30 void receiveMessageNow(int timeout);
31 31
32 private: 32 private:
33 int port; 33 int port;
34 UdpServer socket; 34 UdpServer socket;
35 35
36 AuxiliaryTask OSCRecieveTask; 36 AuxiliaryTask OSCReceiveTask;
37 37
38 void createAuxTasks(); 38 void createAuxTasks();
39 void messageCheck(); 39 void messageCheck();
40 40
41 static void checkMessages(void*); 41 static void checkMessages(void*);
42 42
43 int inBuffer[UDP_RECIEVE_MAX_LENGTH]; 43 int inBuffer[UDP_RECEIVE_MAX_LENGTH];
44 std::queue<oscpkt::Message> inQueue; 44 std::queue<oscpkt::Message> inQueue;
45 oscpkt::Message poppedMessage; 45 oscpkt::Message poppedMessage;
46 oscpkt::PacketReader pr; 46 oscpkt::PacketReader pr;
47 }; 47 };
48 48