GTK+: OSS: Try /dev/dspN 1 through 9.

This commit is contained in:
Brandon Wright 2018-11-08 15:12:47 -06:00
parent 7ae93a539e
commit c878b35610
1 changed files with 20 additions and 5 deletions

View File

@ -70,17 +70,32 @@ S9xOSSSoundDriver::open_device ()
printf ("OSS sound driver initializing...\n"); printf ("OSS sound driver initializing...\n");
printf (" --> (Device: /dev/dsp)..."); printf ("Device: /dev/dsp: ");
filedes = open ("/dev/dsp", O_WRONLY | O_NONBLOCK); filedes = open ("/dev/dsp", O_WRONLY | O_NONBLOCK);
if (filedes < 0) if (filedes < 0)
{ {
printf ("Failed\n --> (Device: /dev/dsp1)..."); printf ("Failed.\n");
filedes = open ("/dev/dsp1", O_WRONLY | O_NONBLOCK); char dspstring[16] = "/dev/dspX\0";
if (filedes < 0) for (int i = 1; i <= 9; i++)
goto fail; {
dspstring[8] = '0' + i;
printf ("Trying %s: ", dspstring);
filedes = open (dspstring, O_WRONLY | O_NONBLOCK);
if (filedes < 0)
{
if (i == 9)
goto fail;
printf ("Failed.\n");
}
else
break;
}
} }
printf ("OK\n"); printf ("OK\n");