Add quiet mode option to fluidsynth binary

Enabling the option supresses the default welcome message and
some other text output that normally gets printed to stdout.

It also slightly changes the way the welcome message and argument
errors are handled: in case of an argument error, the welcome message
is never printed.
This commit is contained in:
Marcus Weseloh 2019-08-17 09:41:41 +02:00
parent c4ebd264ca
commit 1b2e61519a

View file

@ -345,6 +345,7 @@ int main(int argc, char **argv)
char buf[512];
int c, i;
int interactive = 1;
int quiet = 0;
int midi_in = 1;
fluid_player_t *player = NULL;
fluid_midi_router_t *router = NULL;
@ -361,7 +362,7 @@ int main(int argc, char **argv)
int audio_channels = 0;
int dump = 0;
int fast_render = 0;
static const char optchars[] = "a:C:c:dE:f:F:G:g:hijK:L:lm:nO:o:p:R:r:sT:Vvz:";
static const char optchars[] = "a:C:c:dE:f:F:G:g:hijK:L:lm:nO:o:p:qR:r:sT:Vvz:";
#ifdef LASH_ENABLED
int connect_lash = 1;
int enabled_lash = 0; /* set to TRUE if lash gets enabled */
@ -384,8 +385,6 @@ int main(int argc, char **argv)
#endif
print_welcome();
/* create the settings */
settings = new_fluid_settings();
@ -421,6 +420,7 @@ int main(int argc, char **argv)
{"no-shell", 0, 0, 'i'},
{"option", 1, 0, 'o'},
{"portname", 1, 0, 'p'},
{"quiet", 0, 0, 'q'},
{"reverb", 1, 0, 'R'},
{"sample-rate", 1, 0, 'r'},
{"server", 0, 0, 's'},
@ -569,6 +569,7 @@ int main(int argc, char **argv)
break;
case 'h':
print_welcome();
print_help(settings);
break;
@ -643,6 +644,10 @@ int main(int argc, char **argv)
fluid_settings_setstr(settings, "midi.portname", optarg);
break;
case 'q':
quiet = 1;
break;
case 'R':
if((optarg != NULL) && ((FLUID_STRCMP(optarg, "0") == 0) || (FLUID_STRCMP(optarg, "no") == 0)))
{
@ -688,6 +693,7 @@ int main(int argc, char **argv)
break;
case 'V':
print_welcome();
print_configure();
exit(0);
break;
@ -727,6 +733,10 @@ int main(int argc, char **argv)
arg1 = i;
#endif
if (!quiet) {
print_welcome();
}
/* option help requested? "-o help" */
if(option_help)
{
@ -981,7 +991,9 @@ int main(int argc, char **argv)
}
fluid_settings_dupstr(settings, "audio.file.name", &filename);
printf("Rendering audio to file '%s'..\n", filename);
if (!quiet) {
printf("Rendering audio to file '%s'..\n", filename);
}
if(filename)
{
@ -1157,6 +1169,8 @@ print_help(fluid_settings_t *settings)
" Audio file format for fast rendering or aufile driver (\"help\" for list)\n");
printf(" -p, --portname=[label]\n"
" Set MIDI port name (alsa_seq, coremidi drivers)\n");
printf(" -q, --quiet\n"
" Do not print welcome message or other informational output\n");
printf(" -r, --sample-rate\n"
" Set the sample rate\n");
printf(" -R, --reverb\n"