aboutsummaryrefslogtreecommitdiffhomepage
path: root/midi.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2017-06-22 14:30:33 +0200
committercbdev <cb@cbcdn.com>2017-06-22 14:30:33 +0200
commitdda3f958716f7a6ce644d03f753add778d6f1512 (patch)
treee2772355daf3728307da26f7a441ba1c60e9d4c7 /midi.c
parent66c59fd7ec79338a47c68077674350ee2c74f326 (diff)
downloadmidimonster-dda3f958716f7a6ce644d03f753add778d6f1512.tar.gz
midimonster-dda3f958716f7a6ce644d03f753add778d6f1512.tar.bz2
midimonster-dda3f958716f7a6ce644d03f753add778d6f1512.zip
Minor fixes to multiple backends
Diffstat (limited to 'midi.c')
-rw-r--r--midi.c10
1 files changed, 8 insertions, 2 deletions
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{