From 78b21a9ac3f975f35ec7b61108531e1495eb91c0 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sun, 12 Jan 2020 17:34:14 +0100 Subject: Rework instance creation --- backends/artnet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/artnet.h') diff --git a/backends/artnet.h b/backends/artnet.h index 59bd53f..1efdee6 100644 --- a/backends/artnet.h +++ b/backends/artnet.h @@ -6,7 +6,7 @@ MM_PLUGIN_API int init(); static int artnet_configure(char* option, char* value); static int artnet_configure_instance(instance* instance, char* option, char* value); -static instance* artnet_instance(); +static int artnet_instance(instance* inst); static channel* artnet_channel(instance* instance, char* spec, uint8_t flags); static int artnet_set(instance* inst, size_t num, channel** c, channel_value* v); static int artnet_handle(size_t num, managed_fd* fds); -- cgit v1.2.3 From 90b5655a6eb3837ad6f984ce4ffcd3e9aa7480ce Mon Sep 17 00:00:00 2001 From: cbdev Date: Thu, 5 Mar 2020 00:03:12 +0100 Subject: Implement ArtNet rate-limiting to approx. 44 pps --- backends/artnet.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'backends/artnet.h') 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) -- cgit v1.2.3 From 335196b3d3c80ee4bbe0985fd9a1f8ab5464a27c Mon Sep 17 00:00:00 2001 From: cbdev Date: Thu, 5 Mar 2020 23:46:08 +0100 Subject: Fix artnet rate limiting --- backends/artnet.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'backends/artnet.h') diff --git a/backends/artnet.h b/backends/artnet.h index aac73fe..d83999d 100644 --- a/backends/artnet.h +++ b/backends/artnet.h @@ -20,7 +20,8 @@ static int artnet_shutdown(size_t n, instance** inst); #define ARTNET_KEEPALIVE_INTERVAL 1000 //limit transmit rate to at most 44 packets per second (1000/44 ~= 22) -#define ARTNET_FRAME_TIMEOUT 20 +#define ARTNET_FRAME_TIMEOUT 15 +#define ARTNET_SYNTHESIZE_MARGIN 10 #define MAP_COARSE 0x0200 #define MAP_FINE 0x0400 -- cgit v1.2.3