diff --git a/sndiod/sndiod.8 b/sndiod/sndiod.8 index 404b0e1..81f868d 100644 --- a/sndiod/sndiod.8 +++ b/sndiod/sndiod.8 @@ -271,6 +271,14 @@ the need to restart programs using it. .It Fl q Ar port Expose the given MIDI port. This allows multiple programs to share the port. +If no +.Fl q +option is used, +.Nm +will use +.Pa rmidi/0 , rmidi/1 , +.No ... , +.Pa rmidi/7 . .It Fl r Ar rate Attempt to force the device to use this sample rate in Hertz. The default is 48000. diff --git a/sndiod/sndiod.c b/sndiod/sndiod.c index 56cde52..cacf8e3 100644 --- a/sndiod/sndiod.c +++ b/sndiod/sndiod.c @@ -111,6 +111,15 @@ char usagestr[] = "usage: sndiod [-d] [-a flag] [-b nframes] " "[-Q port] [-q port] [-r rate] [-s name] [-t mode] [-U unit]\n\t" "[-v volume] [-w flag] [-z nframes]\n"; +/* + * default MIDI ports + */ +static char *default_ports[] = { + "rmidi/0", "rmidi/1", "rmidi/2", "rmidi/3", + "rmidi/4", "rmidi/5", "rmidi/6", "rmidi/7", + NULL +}; + /* * SIGINT handler, it raises the quit flag. If the flag is already set, * that means that the last SIGINT was not handled, because the process @@ -352,7 +361,7 @@ mkopt(char *path, struct dev *d, int main(int argc, char **argv) { - int c, background, unit; + int c, i, background, unit; int pmin, pmax, rmin, rmax; char base[SOCKPATH_MAX], path[SOCKPATH_MAX]; unsigned int mode, dup, mmc, vol; @@ -490,6 +499,10 @@ main(int argc, char **argv) fputs(usagestr, stderr); return 1; } + if (port_list == NULL) { + for (i = 0; default_ports[i] != NULL; i++) + mkport(default_ports[i], 0); + } if (dev_list == NULL) mkdev(DEFAULT_DEV, &par, 0, bufsz, round, rate, hold, autovol); for (d = dev_list; d != NULL; d = d->next) {