aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/artnet.h
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2020-03-05 00:03:12 +0100
committercbdev <cb@cbcdn.com>2020-03-05 00:03:12 +0100
commit90b5655a6eb3837ad6f984ce4ffcd3e9aa7480ce (patch)
treea55882a266a0ae9fe0002489e39260ab48825d71 /backends/artnet.h
parent2a112633bfd56ddc9ece64973ef20654bf175429 (diff)
downloadmidimonster-90b5655a6eb3837ad6f984ce4ffcd3e9aa7480ce.tar.gz
midimonster-90b5655a6eb3837ad6f984ce4ffcd3e9aa7480ce.tar.bz2
midimonster-90b5655a6eb3837ad6f984ce4ffcd3e9aa7480ce.zip
Implement ArtNet rate-limiting to approx. 44 pps
Diffstat (limited to 'backends/artnet.h')
-rw-r--r--backends/artnet.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/backends/artnet.h b/backends/artnet.h
index 1efdee6..aac73fe 100644
--- a/backends/artnet.h
+++ b/backends/artnet.h
@@ -4,6 +4,7 @@
#include "midimonster.h"
MM_PLUGIN_API int init();
+static uint32_t artnet_interval();
static int artnet_configure(char* option, char* value);
static int artnet_configure_instance(instance* instance, char* option, char* value);
static int artnet_instance(instance* inst);
@@ -16,7 +17,10 @@ static int artnet_shutdown(size_t n, instance** inst);
#define ARTNET_PORT "6454"
#define ARTNET_VERSION 14
#define ARTNET_RECV_BUF 4096
-#define ARTNET_KEEPALIVE_INTERVAL 2000
+
+#define ARTNET_KEEPALIVE_INTERVAL 1000
+//limit transmit rate to at most 44 packets per second (1000/44 ~= 22)
+#define ARTNET_FRAME_TIMEOUT 20
#define MAP_COARSE 0x0200
#define MAP_FINE 0x0400
@@ -52,11 +56,16 @@ typedef union /*_artnet_instance_id*/ {
uint64_t label;
} artnet_instance_id;
+typedef struct /*_artnet_fd_universe*/ {
+ uint64_t label;
+ uint64_t last_frame;
+ uint8_t mark;
+} artnet_output_universe;
+
typedef struct /*_artnet_fd*/ {
int fd;
size_t output_instances;
- artnet_instance_id* output_instance;
- uint64_t* last_frame;
+ artnet_output_universe* output_instance;
} artnet_descriptor;
#pragma pack(push, 1)