aplaymidi2: Add --silent option

For suppressing the messages, add -s / --silent option.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2024-07-09 07:46:09 +02:00
parent 99ce4b1d8a
commit b1269eefdd
2 changed files with 17 additions and 5 deletions

View file

@ -44,8 +44,9 @@ environment variable if none is given on the command line.
.B aplaymidi2
supports only basic UMP events: in addition to the standard MIDI1 and
MIDI2 CVMs and 7bit SysEx, only the following are supported:
DCTPQ, DC, Set Tempo, Start Clip and End Clip.
Lyrics and other meta data in Flex Data are skipped, so far.
DCTPQ, DC, Set Tempo, Start Clip, End Clip.
Lyrics and other meta data in Flex Data are printed, too, unless
\fI\-s\fP option is given.
The multiple output ports are useful when the given MIDI Clip file
contains the UMP packets for multiple Groups.
@ -62,6 +63,10 @@ Specifies how long to wait after the end of each MIDI Clip file,
to allow the last notes to die away.
Default is 2 seconds.
.TP
.I \-s, \-\-silent
Don't show message texts.
.SH SEE ALSO
pmidi(1)
.br

View file

@ -20,6 +20,7 @@ static int port_count;
static snd_seq_addr_t ports[16];
static int queue;
static int end_delay = 2;
static int silent;
static unsigned int _current_tempo = 50000000; /* default 120 bpm */
static unsigned int tempo_base = 10;
@ -432,6 +433,7 @@ static void play_midi(FILE *file)
if (fh->meta.status_bank == SND_UMP_FLEX_DATA_MSG_BANK_METADATA ||
fh->meta.status_bank == SND_UMP_FLEX_DATA_MSG_BANK_PERF_TEXT) {
if (!silent)
show_text(ump);
continue;
}
@ -493,7 +495,8 @@ static void usage(const char *argv0)
"-h, --help this help\n"
"-V, --version print current version\n"
"-p, --port=client:port,... set port(s) to play to\n"
"-d, --delay=seconds delay after song ends\n",
"-d, --delay=seconds delay after song ends\n"
"-s, --silent don't show texts\n",
argv0);
}
@ -509,13 +512,14 @@ int main(int argc, char *argv[])
{"version", 0, NULL, 'V'},
{"port", 1, NULL, 'p'},
{"delay", 1, NULL, 'd'},
{"silent", 1, NULL, 's'},
{0}
};
int c;
init_seq();
while ((c = getopt_long(argc, argv, "hVp:d:",
while ((c = getopt_long(argc, argv, "hVp:d:s",
long_options, NULL)) != -1) {
switch (c) {
case 'h':
@ -530,6 +534,9 @@ int main(int argc, char *argv[])
case 'd':
end_delay = atoi(optarg);
break;
case 's':
silent = 1;
break;
default:
usage(argv[0]);
return 1;