aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/osc.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2019-12-11 23:24:23 +0100
committercbdev <cb@cbcdn.com>2019-12-11 23:24:23 +0100
commit9624d46436576b415c639ea7390012cdd95c88f7 (patch)
treefb3aadbaf01fcee5da8ecdb8355ff191341b666d /backends/osc.c
parent48e12201f5c57cda581bc0c713d99da6524c49a8 (diff)
parentf6d6eefe9bb9934f4fa3e665734d746f02471cdb (diff)
downloadmidimonster-9624d46436576b415c639ea7390012cdd95c88f7.tar.gz
midimonster-9624d46436576b415c639ea7390012cdd95c88f7.tar.bz2
midimonster-9624d46436576b415c639ea7390012cdd95c88f7.zip
Merge branch 'master' into rtpmidi
Diffstat (limited to 'backends/osc.c')
-rw-r--r--backends/osc.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/backends/osc.c b/backends/osc.c
index 757ad89..2c65ecb 100644
--- a/backends/osc.c
+++ b/backends/osc.c
@@ -522,6 +522,7 @@ static int osc_configure_instance(instance* inst, char* option, char* value){
return 1;
}
+ //this requests a socket with SO_BROADCAST set, whether this is useful functionality for OSC is up for debate
data->fd = mmbackend_socket(host, port, SOCK_DGRAM, 1, 1);
if(data->fd < 0){
fprintf(stderr, "Failed to bind for instance %s\n", inst->name);
@@ -891,22 +892,10 @@ static int osc_handle(size_t num, managed_fd* fds){
return 0;
}
-static int osc_start(){
- size_t n, u, fds = 0;
- instance** inst = NULL;
+static int osc_start(size_t n, instance** inst){
+ size_t u, fds = 0;
osc_instance_data* data = NULL;
- //fetch all instances
- if(mm_backend_instances(BACKEND_NAME, &n, &inst)){
- fprintf(stderr, "Failed to fetch instance list\n");
- return 1;
- }
-
- if(!n){
- free(inst);
- return 0;
- }
-
//update instance identifiers
for(u = 0; u < n; u++){
data = (osc_instance_data*) inst[u]->impl;
@@ -915,7 +904,6 @@ static int osc_start(){
inst[u]->ident = data->fd;
if(mm_manage_fd(data->fd, BACKEND_NAME, 1, inst[u])){
fprintf(stderr, "Failed to register OSC descriptor for instance %s\n", inst[u]->name);
- free(inst);
return 1;
}
fds++;
@@ -926,21 +914,13 @@ static int osc_start(){
}
fprintf(stderr, "OSC backend registered %" PRIsize_t " descriptors to core\n", fds);
-
- free(inst);
return 0;
}
-static int osc_shutdown(){
- size_t n, u, c;
- instance** inst = NULL;
+static int osc_shutdown(size_t n, instance** inst){
+ size_t u, c;
osc_instance_data* data = NULL;
- if(mm_backend_instances(BACKEND_NAME, &n, &inst)){
- fprintf(stderr, "Failed to fetch instance list\n");
- return 1;
- }
-
for(u = 0; u < n; u++){
data = (osc_instance_data*) inst[u]->impl;
for(c = 0; c < data->channels; c++){
@@ -967,7 +947,6 @@ static int osc_shutdown(){
free(inst[u]->impl);
}
- free(inst);
fprintf(stderr, "OSC backend shut down\n");
return 0;
}