diff options
Diffstat (limited to 'apps/midi.c')
-rw-r--r-- | apps/midi.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/midi.c b/apps/midi.c index 45cb12f..8110475 100644 --- a/apps/midi.c +++ b/apps/midi.c @@ -34,9 +34,9 @@ int midi_init(midi_t* m, const char* device) if(!m) return -1; - int ret = snd_rawmidi_open(&(m->input_), &(m->output_), device, SND_RAWMIDI_NONBLOCK); + int ret = snd_rawmidi_open(&(m->input_), NULL, device, SND_RAWMIDI_NONBLOCK); if(ret < 0) { - error(0, 0, "cannot open midi port '%s': %s", device, snd_strerror(ret)); + error(0, 0, "MIDI: cannot open port '%s': %s", device, snd_strerror(ret)); return ret; } @@ -59,7 +59,7 @@ void midi_run(midi_t* m) if(err < 0 && errno == EINTR) break; if(err < 0) { - error(0, errno, "poll failed"); + error(0, errno, "MIDI: poll failed"); break; } /* if(err == 0) { */ @@ -68,7 +68,7 @@ void midi_run(midi_t* m) unsigned short revents; if((err = snd_rawmidi_poll_descriptors_revents(m->input_, pfds, npfds, &revents)) < 0) { - error(0, 0, "cannot get poll events: %s", snd_strerror(errno)); + error(0, 0, "MIDI: cannot get poll events: %s", snd_strerror(errno)); break; } if(revents & (POLLERR | POLLHUP)) @@ -81,11 +81,12 @@ void midi_run(midi_t* m) if (ret == -EAGAIN) continue; if(ret < 0) { - error(0, 0, "cannot read from midi port: %s", snd_strerror(ret)); + error(0, 0, "MIDI: cannot read from midi port: %s", snd_strerror(ret)); break; } int i; + printf("MIDI:%s", ret ? " ": " no data?\n"); for (i = 0; i < ret; ++i) printf("%02X%c", buf[i], (i >= (ret-1)) ? '\n' : ' '); } |