aseqdump: Drop ifdef for UMP support

Now that the latest alsa-lib 1.2.12 is mandatory, drop the ugly
ifdefs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2024-07-22 17:30:46 +02:00
parent c7b342db82
commit 946ea467cf

View file

@ -29,9 +29,7 @@
#include <poll.h> #include <poll.h>
#include <alsa/asoundlib.h> #include <alsa/asoundlib.h>
#include "version.h" #include "version.h"
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
#include <alsa/ump_msg.h> #include <alsa/ump_msg.h>
#endif
enum { enum {
VIEW_RAW, VIEW_NORMALIZED, VIEW_PERCENT VIEW_RAW, VIEW_NORMALIZED, VIEW_PERCENT
@ -41,11 +39,7 @@ static snd_seq_t *seq;
static int port_count; static int port_count;
static snd_seq_addr_t *ports; static snd_seq_addr_t *ports;
static volatile sig_atomic_t stop = 0; static volatile sig_atomic_t stop = 0;
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
static int ump_version; static int ump_version;
#else
#define ump_version 0
#endif
static int view_mode = VIEW_RAW; static int view_mode = VIEW_RAW;
/* prints an error message to stderr, and dies */ /* prints an error message to stderr, and dies */
@ -368,7 +362,6 @@ static void dump_event(const snd_seq_event_t *ev)
} }
} }
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
static int group_number(unsigned char c) static int group_number(unsigned char c)
{ {
if (view_mode != VIEW_RAW) if (view_mode != VIEW_RAW)
@ -986,7 +979,6 @@ static void dump_ump_event(const snd_seq_ump_event_t *ev)
break; break;
} }
} }
#endif /* HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION */
static void list_ports(void) static void list_ports(void)
{ {
@ -1029,10 +1021,8 @@ static void help(const char *argv0)
" -N,--normalized-view show normalized values\n" " -N,--normalized-view show normalized values\n"
" -P,--percent-view show percent values\n" " -P,--percent-view show percent values\n"
" -R,--raw-view show raw values (default)\n" " -R,--raw-view show raw values (default)\n"
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
" -u,--ump=version set client MIDI version (0=legacy, 1= UMP MIDI 1.0, 2=UMP MIDI2.0)\n" " -u,--ump=version set client MIDI version (0=legacy, 1= UMP MIDI 1.0, 2=UMP MIDI2.0)\n"
" -r,--raw do not convert UMP and legacy events\n" " -r,--raw do not convert UMP and legacy events\n"
#endif
" -p,--port=client:port,... source port(s)\n", " -p,--port=client:port,... source port(s)\n",
argv0); argv0);
} }
@ -1049,11 +1039,7 @@ static void sighandler(int sig ATTRIBUTE_UNUSED)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
static const char short_options[] = "hVlp:NPR" static const char short_options[] = "hVlp:NPRu:r";
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
"u:r"
#endif
;
static const struct option long_options[] = { static const struct option long_options[] = {
{"help", 0, NULL, 'h'}, {"help", 0, NULL, 'h'},
{"version", 0, NULL, 'V'}, {"version", 0, NULL, 'V'},
@ -1062,10 +1048,8 @@ int main(int argc, char *argv[])
{"normalized-view", 0, NULL, 'N'}, {"normalized-view", 0, NULL, 'N'},
{"percent-view", 0, NULL, 'P'}, {"percent-view", 0, NULL, 'P'},
{"raw-view", 0, NULL, 'R'}, {"raw-view", 0, NULL, 'R'},
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
{"ump", 1, NULL, 'u'}, {"ump", 1, NULL, 'u'},
{"raw", 0, NULL, 'r'}, {"raw", 0, NULL, 'r'},
#endif
{0} {0}
}; };
@ -1100,7 +1084,6 @@ int main(int argc, char *argv[])
case 'N': case 'N':
view_mode = VIEW_NORMALIZED; view_mode = VIEW_NORMALIZED;
break; break;
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
case 'u': case 'u':
ump_version = atoi(optarg); ump_version = atoi(optarg);
snd_seq_set_client_midi_version(seq, ump_version); snd_seq_set_client_midi_version(seq, ump_version);
@ -1108,7 +1091,6 @@ int main(int argc, char *argv[])
case 'r': case 'r':
snd_seq_set_client_ump_conversion(seq, 0); snd_seq_set_client_ump_conversion(seq, 0);
break; break;
#endif
default: default:
help(argv[0]); help(argv[0]);
return 1; return 1;
@ -1150,7 +1132,6 @@ int main(int argc, char *argv[])
break; break;
for (;;) { for (;;) {
snd_seq_event_t *event; snd_seq_event_t *event;
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
snd_seq_ump_event_t *ump_ev; snd_seq_ump_event_t *ump_ev;
if (ump_version > 0) { if (ump_version > 0) {
err = snd_seq_ump_event_input(seq, &ump_ev); err = snd_seq_ump_event_input(seq, &ump_ev);
@ -1160,7 +1141,6 @@ int main(int argc, char *argv[])
dump_ump_event(ump_ev); dump_ump_event(ump_ev);
continue; continue;
} }
#endif
err = snd_seq_event_input(seq, &event); err = snd_seq_event_input(seq, &event);
if (err < 0) if (err < 0)