From dda3f958716f7a6ce644d03f753add778d6f1512 Mon Sep 17 00:00:00 2001 From: cbdev Date: Thu, 22 Jun 2017 14:30:33 +0200 Subject: Minor fixes to multiple backends --- artnet.c | 1 + loopback.c | 2 +- midi.c | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/artnet.c b/artnet.c index 98bb792..55e4e85 100644 --- a/artnet.c +++ b/artnet.c @@ -337,6 +337,7 @@ static int artnet_start(){ } if(!n){ + free(inst); return 0; } diff --git a/loopback.c b/loopback.c index 56e8759..bb93a1f 100644 --- a/loopback.c +++ b/loopback.c @@ -29,7 +29,7 @@ static int backend_configure(char* option, char* value){ return 0; } -static int backend_configure_instance(instance* instance, char* option, char* value){ +static int backend_configure_instance(instance* inst, char* option, char* value){ //intentionally ignored return 0; } diff --git a/midi.c b/midi.c index f5666ba..6546ecd 100644 --- a/midi.c +++ b/midi.c @@ -273,6 +273,12 @@ static int midi_start(){ return 1; } + //if there are no ports, do nothing + if(!n){ + free(inst); + return 0; + } + //create all ports for(p = 0; p < n; p++){ data = (midi_instance_data*) inst[p]->impl; @@ -281,8 +287,8 @@ static int midi_start(){ //make connections if(data->write){ - fprintf(stderr, "Connecting output of instance %s to MIDI device %s\n", inst[p]->name, data->write); if(snd_seq_parse_address(sequencer, &addr, data->write) == 0){ + fprintf(stderr, "Connecting output of instance %s to MIDI device %s (%d:%d)\n", inst[p]->name, data->write, addr.client, addr.port); snd_seq_connect_to(sequencer, data->port, addr.client, addr.port); } else{ @@ -293,8 +299,8 @@ static int midi_start(){ } if(data->read){ - fprintf(stderr, "Connecting input from MIDI device %s to instance %s\n", data->read, inst[p]->name); if(snd_seq_parse_address(sequencer, &addr, data->read) == 0){ + fprintf(stderr, "Connecting input from MIDI device %s to instance %s (%d:%d)\n", data->read, inst[p]->name, addr.client, addr.port); snd_seq_connect_from(sequencer, data->port, addr.client, addr.port); } else{ -- cgit v1.2.3