aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/kinet.h
diff options
context:
space:
mode:
Diffstat (limited to 'backends/kinet.h')
-rw-r--r--backends/kinet.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/backends/kinet.h b/backends/kinet.h
new file mode 100644
index 0000000..a93c576
--- /dev/null
+++ b/backends/kinet.h
@@ -0,0 +1,54 @@
+#include "midimonster.h"
+
+MM_PLUGIN_API int init();
+static int kinet_configure(char* option, char* value);
+static int kinet_configure_instance(instance* inst, char* option, char* value);
+static int kinet_instance(instance* inst);
+static channel* kinet_channel(instance* inst, char* spec, uint8_t flags);
+static int kinet_set(instance* inst, size_t num, channel** c, channel_value* v);
+static int kinet_handle(size_t num, managed_fd* fds);
+static int kinet_start(size_t n, instance** inst);
+static int kinet_shutdown(size_t n, instance** inst);
+
+#define KINET_PORT "6038"
+#define KINET_MAGIC htobe32(0x0401dc4a)
+
+enum {
+ kinet_op_dmx = 0x0101, //v1
+ kinet_op_out = 0x0108 //v2
+};
+
+//As a byproduct of the sparse documentation, a lot of these
+//fields are educated guesses.
+
+#pragma pack(push, 1)
+typedef struct /*_kinet_header*/ {
+ uint8_t magic[4]; //04 01 dc 4a
+ uint16_t version; //01 00
+ uint16_t op; //08 01
+ uint32_t seq; //00 00 00 00
+ uint8_t output_port; //00 //FIXME verify this / usage?
+ uint8_t pad; //00
+ uint16_t flags; //00 00
+} kinet_frame_hdr;
+
+typedef struct /*_kinet_dmx*/ {
+ uint32_t offset;
+ uint8_t universe;
+ uint8_t startcode; //FIXME test this
+ uint8_t data[512];
+} kinet_dmx;
+
+typedef struct /*_kinet_out*/ {
+ uint8_t port;
+ uint8_t padding;
+ uint16_t flags;
+ uint16_t length;
+ uint16_t code;
+ uint8_t data[512];
+} kinet_out;
+#pragma pack(pop)
+
+typedef struct /*_kinet_instance_data*/ {
+ size_t n;
+} kinet_instance_data;