From 302a6e62aae5797b2c2ee7c4b28e4b7c4067c940 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 11 Nov 2016 12:41:06 -0800 Subject: [PATCH] Fixed bug 3484 - DSP driver does not detect /dev/dsp0 Tobias Kortkamp using SDL 2.0.5 (and a repository checkout) on FreeBSD 11.0 I get this output from testaudioinfo with SDL_AUDIODRIVER=dsp: INFO: Found 8 output devices: INFO: 0: /dev/dsp INFO: 1: /dev/dsp1 INFO: 2: /dev/dsp2 INFO: 3: /dev/dsp3 INFO: 4: /dev/dsp4 INFO: 5: /dev/dsp5 INFO: 6: /dev/dsp6 INFO: 7: /dev/dsp7 INFO: INFO: Found 3 capture devices: INFO: 0: /dev/dsp INFO: 1: /dev/dsp4 INFO: 2: /dev/dsp5 INFO: This is /dev/sndstat: Installed devices: pcm0: (play) pcm1: (play) pcm2: (play) pcm3: (play) pcm4: (play/rec) pcm5: (play/rec) default pcm6: (play) pcm7: (play) No devices installed from userspace. I'd expect to find /dev/dsp0 in the output device list. It's not detected because of a a small logic error in SDL_audiodev.c (see attached patch). With the patch applied I get this which is what I'd expect: INFO: Found 9 output devices: INFO: 0: /dev/dsp INFO: 1: /dev/dsp0 INFO: 2: /dev/dsp1 INFO: 3: /dev/dsp2 INFO: 4: /dev/dsp3 INFO: 5: /dev/dsp4 INFO: 6: /dev/dsp5 INFO: 7: /dev/dsp6 INFO: 8: /dev/dsp7 --- src/audio/SDL_audiodev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/SDL_audiodev.c b/src/audio/SDL_audiodev.c index 5c392cfb7..bd3c0b99b 100644 --- a/src/audio/SDL_audiodev.c +++ b/src/audio/SDL_audiodev.c @@ -103,9 +103,10 @@ SDL_EnumUnixAudioDevices_Internal(const int iscapture, const int classic, int (* if (SDL_strlen(audiodev) < (sizeof(audiopath) - 3)) { int instance = 0; - while (instance++ <= 64) { + while (instance <= 64) { SDL_snprintf(audiopath, SDL_arraysize(audiopath), "%s%d", audiodev, instance); + instance++; test_device(iscapture, audiopath, flags, test); } }