aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2020-10-23 19:58:58 +0200
committercbdev <cb@cbcdn.com>2020-10-23 19:58:58 +0200
commit9a5eb9c9d6592b269ba0e39f9cee22ef3313f685 (patch)
treed797fdb1bf4d2ec79559cb79a8cbdeea0a9a1bc2
parent70f1ca5bbb3156d9d2b90a115ba88495e5151b55 (diff)
downloadmidimonster-9a5eb9c9d6592b269ba0e39f9cee22ef3313f685.tar.gz
midimonster-9a5eb9c9d6592b269ba0e39f9cee22ef3313f685.tar.bz2
midimonster-9a5eb9c9d6592b269ba0e39f9cee22ef3313f685.zip
Implement ArtNet realtime option
-rw-r--r--backends/artnet.c23
-rw-r--r--backends/artnet.h1
2 files changed, 16 insertions, 8 deletions
diff --git a/backends/artnet.c b/backends/artnet.c
index 4a7907d..dae9ba3 100644
--- a/backends/artnet.c
+++ b/backends/artnet.c
@@ -168,6 +168,10 @@ static int artnet_configure_instance(instance* inst, char* option, char* value){
return mmbackend_parse_sockaddr(host, port ? port : ARTNET_PORT, &data->dest_addr, &data->dest_len);
}
+ else if(!strcmp(option, "realtime")){
+ data->realtime = strtoul(value, NULL, 10);
+ return 0;
+ }
LOGPF("Unknown instance option %s for instance %s", option, inst->name);
return 1;
@@ -294,21 +298,24 @@ static int artnet_set(instance* inst, size_t num, channel** c, channel_value* v)
}
if(mark){
- //find last frame time
+ //find output control data for the instance
for(u = 0; u < global_cfg.fd[data->fd_index].output_instances; u++){
if(global_cfg.fd[data->fd_index].output_instance[u].label == inst->ident){
break;
}
}
- frame_delta = mm_timestamp() - global_cfg.fd[data->fd_index].output_instance[u].last_frame;
- //check output rate limit, request next frame
- if(frame_delta < ARTNET_FRAME_TIMEOUT){
- global_cfg.fd[data->fd_index].output_instance[u].mark = 1;
- if(!global_cfg.next_frame || global_cfg.next_frame > (ARTNET_FRAME_TIMEOUT - frame_delta)){
- global_cfg.next_frame = (ARTNET_FRAME_TIMEOUT - frame_delta);
+ if(!data->realtime){
+ frame_delta = mm_timestamp() - global_cfg.fd[data->fd_index].output_instance[u].last_frame;
+
+ //check output rate limit, request next frame
+ if(frame_delta < ARTNET_FRAME_TIMEOUT){
+ global_cfg.fd[data->fd_index].output_instance[u].mark = 1;
+ if(!global_cfg.next_frame || global_cfg.next_frame > (ARTNET_FRAME_TIMEOUT - frame_delta)){
+ global_cfg.next_frame = (ARTNET_FRAME_TIMEOUT - frame_delta);
+ }
+ return 0;
}
- return 0;
}
return artnet_transmit(inst, global_cfg.fd[data->fd_index].output_instance + u);
}
diff --git a/backends/artnet.h b/backends/artnet.h
index ecd775e..b42646d 100644
--- a/backends/artnet.h
+++ b/backends/artnet.h
@@ -48,6 +48,7 @@ typedef struct /*_artnet_instance_model*/ {
artnet_universe data;
size_t fd_index;
uint64_t last_input;
+ uint8_t realtime;
} artnet_instance_data;
typedef union /*_artnet_instance_id*/ {