Mercurial > hg > beaglert
view include/OSCServer.h @ 287:4815ed0f21de prerelease
Makefile refactoring:
- avoids recursive call to build with/without main
- takes EXAMPLE parameter. Copies the examples/$(EXAMPLE) folder to projects/$(PROJECT) and $PROJECT defaults to exampleTestProject
- you can now `make run` (TODO: currently re-links, should instead run without linking)
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Wed, 18 May 2016 01:46:32 +0100 |
parents | de37582ce6f3 |
children | e4392164b458 |
line wrap: on
line source
/***** OSCServer.h *****/ #ifndef __OSCServer_H_INCLUDED__ #define __OSCServer_H_INCLUDED__ #include <UdpServer.h> #include <oscpkt.hh> #include <BeagleRT.h> #include <queue> #define UDP_RECIEVE_TIMEOUT_MS 20 #define UDP_RECIEVE_MAX_LENGTH 16384 class OSCServer{ public: OSCServer(); // must be called once during setup void setup(int port); // returns true if messages are queued // audio-thread safe bool messageWaiting(); // removes and returns the oldest message from the queue // audio-thread safe, but don't call unless messageWaiting() returns true oscpkt::Message popMessage(); // if there are OSC messages waiting, decode and queue them // not audio-thread safe! void recieveMessageNow(int timeout); private: int port; UdpServer socket; AuxiliaryTask OSCRecieveTask; void createAuxTasks(); void messageCheck(); static void checkMessages(void*); int inBuffer[UDP_RECIEVE_MAX_LENGTH]; std::queue<oscpkt::Message> inQueue; oscpkt::Message poppedMessage; oscpkt::PacketReader pr; }; #endif