aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/ola.h
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2019-03-22 21:16:41 +0100
committercbdev <cb@cbcdn.com>2019-03-22 21:16:41 +0100
commit95f804bb5f8239d018e8fa440a2ca3e0111d4696 (patch)
tree3f01045d6c4ea66e311cf567d397dc2cfbd3ed8e /backends/ola.h
parent63643cc99a8d621a82111fd6d4d69f80379d2933 (diff)
downloadmidimonster-95f804bb5f8239d018e8fa440a2ca3e0111d4696.tar.gz
midimonster-95f804bb5f8239d018e8fa440a2ca3e0111d4696.tar.bz2
midimonster-95f804bb5f8239d018e8fa440a2ca3e0111d4696.zip
Implement an OLA backend (Fixes #14)
Diffstat (limited to 'backends/ola.h')
-rw-r--r--backends/ola.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/backends/ola.h b/backends/ola.h
new file mode 100644
index 0000000..c943d52
--- /dev/null
+++ b/backends/ola.h
@@ -0,0 +1,38 @@
+extern "C" {
+ #include "midimonster.h"
+ //C++ has it's own implementation of these...
+ #undef min
+ #undef max
+
+ int init();
+ static int ola_configure(char* option, char* value);
+ static int ola_configure_instance(instance* instance, char* option, char* value);
+ static instance* ola_instance();
+ static channel* ola_channel(instance* instance, char* spec);
+ static int ola_set(instance* inst, size_t num, channel** c, channel_value* v);
+ static int ola_handle(size_t num, managed_fd* fds);
+ static int ola_start();
+ static int ola_shutdown();
+}
+
+#define MAP_COARSE 0x0200
+#define MAP_FINE 0x0400
+#define MAP_SINGLE 0x0800
+#define MAP_MARK 0x1000
+#define MAPPED_CHANNEL(a) ((a) & 0x01FF)
+#define IS_ACTIVE(a) ((a) & 0xFE00)
+#define IS_WIDE(a) ((a) & (MAP_FINE | MAP_COARSE))
+#define IS_SINGLE(a) ((a) & MAP_SINGLE)
+
+//since ola seems to immediately loop back any sent data as input, we only use one buffer
+//to avoid excessive event feedback loops
+typedef struct /*_ola_universe_model*/ {
+ uint8_t data[512];
+ uint16_t map[512];
+} ola_universe;
+
+typedef struct /*_ola_instance_model*/ {
+ /*TODO does ola support remote connections?*/
+ unsigned int universe_id;
+ ola_universe data;
+} ola_instance_data;