From 3a7f46c00f94bee3f236ca61c2906d7e9d1717c3 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 2 May 2006 15:43:07 +0200 Subject: [PATCH] aplaymidi: list only MIDI-capable ports When listing ports with aplaymidi/arecordmidi, show only ports that understand MIDI messages, i.e., that have the SND_SEQ_PORT_TYPE_MIDI_GENERIC flag set. --- seq/aplaymidi/aplaymidi.c | 4 ++++ seq/aplaymidi/arecordmidi.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/seq/aplaymidi/aplaymidi.c b/seq/aplaymidi/aplaymidi.c index 625e9e9..c2819d0 100644 --- a/seq/aplaymidi/aplaymidi.c +++ b/seq/aplaymidi/aplaymidi.c @@ -786,6 +786,10 @@ static void list_ports(void) snd_seq_port_info_set_client(pinfo, client); snd_seq_port_info_set_port(pinfo, -1); while (snd_seq_query_next_port(seq, pinfo) >= 0) { + /* port must understand MIDI messages */ + if (!(snd_seq_port_info_get_type(pinfo) + & SND_SEQ_PORT_TYPE_MIDI_GENERIC)) + continue; /* we need both WRITE and SUBS_WRITE */ if ((snd_seq_port_info_get_capability(pinfo) & (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE)) diff --git a/seq/aplaymidi/arecordmidi.c b/seq/aplaymidi/arecordmidi.c index c8e2865..243ec56 100644 --- a/seq/aplaymidi/arecordmidi.c +++ b/seq/aplaymidi/arecordmidi.c @@ -659,6 +659,10 @@ static void list_ports(void) snd_seq_port_info_set_client(pinfo, client); snd_seq_port_info_set_port(pinfo, -1); while (snd_seq_query_next_port(seq, pinfo) >= 0) { + /* port must understand MIDI messages */ + if (!(snd_seq_port_info_get_type(pinfo) + & SND_SEQ_PORT_TYPE_MIDI_GENERIC)) + continue; /* we need both READ and SUBS_READ */ if ((snd_seq_port_info_get_capability(pinfo) & (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ))