aboutsummaryrefslogtreecommitdiffhomepage
path: root/osc.h
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2017-07-03 23:55:07 +0200
committercbdev <cb@cbcdn.com>2017-07-03 23:55:07 +0200
commit1ffe53ba1493741b209c3040a359799c5ada4cf4 (patch)
tree147cc41b7d65e08fa4d7a4550d34781f3fb9ba1b /osc.h
parent74edb1c34d03cc0e3787fb6c94c0398173791992 (diff)
downloadmidimonster-1ffe53ba1493741b209c3040a359799c5ada4cf4.tar.gz
midimonster-1ffe53ba1493741b209c3040a359799c5ada4cf4.tar.bz2
midimonster-1ffe53ba1493741b209c3040a359799c5ada4cf4.zip
Working OSC receiver
Diffstat (limited to 'osc.h')
-rw-r--r--osc.h54
1 files changed, 53 insertions, 1 deletions
diff --git a/osc.h b/osc.h
index 6cc321d..8fcad71 100644
--- a/osc.h
+++ b/osc.h
@@ -1,2 +1,54 @@
#include "midimonster.h"
-int osc_start();
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#define OSC_RECV_BUF 4096
+
+int init();
+static int backend_configure(char* option, char* value);
+static int backend_configure_instance(instance* instance, char* option, char* value);
+static instance* backend_instance();
+static channel* backend_channel(instance* instance, char* spec);
+static int backend_set(instance* inst, size_t num, channel** c, channel_value* v);
+static int backend_handle(size_t num, managed_fd* fds);
+static int backend_start();
+static int backend_shutdown();
+
+typedef enum {
+ not_set = 0,
+ int32 = 'i',
+ float32 = 'f',
+ /*s, b*/ //ignored
+ int64 = 'h',
+ double64 = 'd',
+} osc_parameter_type;
+
+typedef union {
+ int32_t i32;
+ float f;
+ int64_t i64;
+ double d;
+} osc_parameter_value;
+
+typedef struct /*_osc_channel*/ {
+ char* path;
+ size_t params;
+ size_t param_index;
+ size_t* param;
+ uint8_t mark;
+
+ osc_parameter_type type;
+ osc_parameter_value max;
+ osc_parameter_value min;
+ osc_parameter_value current;
+} osc_channel;
+
+typedef struct /*_osc_instance_data*/ {
+ size_t channels;
+ osc_channel* channel;
+ uint8_t output;
+ char* root;
+ socklen_t dest_len;
+ struct sockaddr_storage dest;
+ int fd;
+} osc_instance;