Browse Source

Support SDL_AUDIODRIVER set to "dsound", which was used by SDL 1.2

Fixes https://github.com/libsdl-org/SDL/issues/5818
Sam Lantinga 3 years ago
parent
commit
abe38bca3e
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/audio/SDL_audio.c

+ 9 - 0
src/audio/SDL_audio.c

@@ -945,6 +945,15 @@ SDL_AudioInit(const char *driver_name)
             const char *driver_attempt_end = SDL_strchr(driver_attempt, ',');
             const char *driver_attempt_end = SDL_strchr(driver_attempt, ',');
             size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt)
             size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt)
                                                                      : SDL_strlen(driver_attempt);
                                                                      : SDL_strlen(driver_attempt);
+#if SDL_AUDIO_DRIVER_DSOUND
+            /* SDL 1.2 uses the name "dsound", so we'll support both. */
+            if (driver_attempt_len == SDL_strlen("dsound") &&
+                (SDL_strncasecmp(driver_attempt, "dsound", driver_attempt_len) == 0)) {
+                driver_attempt = "directsound";
+                driver_attempt_len = SDL_strlen("directsound");
+            }
+#endif
+
 #if SDL_AUDIO_DRIVER_PULSEAUDIO
 #if SDL_AUDIO_DRIVER_PULSEAUDIO
             /* SDL 1.2 uses the name "pulse", so we'll support both. */
             /* SDL 1.2 uses the name "pulse", so we'll support both. */
             if (driver_attempt_len == SDL_strlen("pulse") &&
             if (driver_attempt_len == SDL_strlen("pulse") &&