From c878b35610298840a54b47fdbba824a51bf2d84e Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Thu, 8 Nov 2018 15:12:47 -0600 Subject: [PATCH] GTK+: OSS: Try /dev/dspN 1 through 9. --- gtk/src/gtk_sound_driver_oss.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/gtk/src/gtk_sound_driver_oss.cpp b/gtk/src/gtk_sound_driver_oss.cpp index 79a60ba8..11bc7f31 100644 --- a/gtk/src/gtk_sound_driver_oss.cpp +++ b/gtk/src/gtk_sound_driver_oss.cpp @@ -70,17 +70,32 @@ S9xOSSSoundDriver::open_device () printf ("OSS sound driver initializing...\n"); - printf (" --> (Device: /dev/dsp)..."); + printf ("Device: /dev/dsp: "); filedes = open ("/dev/dsp", O_WRONLY | O_NONBLOCK); if (filedes < 0) { - printf ("Failed\n --> (Device: /dev/dsp1)..."); - filedes = open ("/dev/dsp1", O_WRONLY | O_NONBLOCK); + printf ("Failed.\n"); + char dspstring[16] = "/dev/dspX\0"; - if (filedes < 0) - goto fail; + for (int i = 1; i <= 9; i++) + { + 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");