-
Notifications
You must be signed in to change notification settings - Fork 1
/
OscReceiver.h
48 lines (35 loc) · 901 Bytes
/
OscReceiver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef _OSC_RECEIVER_H_
#define _OSC_RECEIVER_H_
#ifdef HAVE_OSC
#include "lo/lo.h"
#include <string>
#include "MM.h"
#define CONFIG_DEBUG
namespace mmp {
/**
* General-purpose wrapper around liblo to receive OSC messages.
*/
class OscReceiver {
public:
OscReceiver(const std::string &port);
~OscReceiver();
void listen();
const char * port() const {
return port_.c_str();
}
void addHandler(const char *path, const char *types, lo_method_handler handler, void *user_data);
public:
static bool server_is_ok_;
private:
std::string toString() const;
std::string port_;
lo_server_thread server_;
#ifdef CONFIG_DEBUG
static int genericHandler(const char *path, const char *types, lo_arg **argv,
int argc, void *data, void *user_data);
#endif
static void error(int num, const char *msg, const char *path);
};
}
#endif // HAVE_OSC
#endif // _OSC_RECEIVER_H_