From 8cc336173050ffe3c2efe5e3981fc5a30e5ac42f Mon Sep 17 00:00:00 2001 From: Yamagi Date: Thu, 8 Aug 2024 18:39:29 +0200 Subject: [PATCH] Hardcode the SDL audio driver (again) to `directsound` under Windows. Windows defaults to `wassapi`, which is a sensible choice. But WASAPI only guarantees 32 bit float samples, anything else only works if the driver or something supports it and YQ2 requires 16 bit samples. That can be worked around by having SDL recode the audio, but I don't want such a invasive change right before a release. Another part of #1132. --- CHANGELOG | 5 +++-- doc/040_cvarlist.md | 3 ++- src/client/sound/sdl.c | 9 +++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 96ecd7a8..2dff72cf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,10 +1,11 @@ Quake II 8.40 to 8.41: - Fix an endless loop in the OpenGL 1.4 renderer crashing the game and blocking further progress under some circumstances. (by protocultor) -- Don't force a platform dependend ,hard coded SDL audio driver, let SDL +- Don't force a platform dependend, hard coded SDL audio driver, let SDL choose the driver instead. This may fix the SDL audio backend on some platforms. The driver can still be overridden by setting `s_sdldriver` - to something else than `auto`. + to something else than `auto`. Under Windows `s_sdldriver` defaults + `directsound` because `auto` may choose an incompatible driver. Quake II 8.30 to 8.40: - Implement `g_quick_weap`. If set to 1, both weapprev and weapnext diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index e8612c34..c38b992d 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -303,7 +303,8 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable` * **s_sdldriver**: Can be set to the name of a SDL audio driver. If set to `auto`, SDL chooses the driver. If set to anything else the given driver is forced, regardless if supported by SDL or the platform or - not. + not. By default set to `directsound` under Windows and `auto` on all + other platforms. * **s_underwater**: Dampen sounds if submerged. Enabled by default. diff --git a/src/client/sound/sdl.c b/src/client/sound/sdl.c index 08110690..8e3ae6a0 100644 --- a/src/client/sound/sdl.c +++ b/src/client/sound/sdl.c @@ -1351,7 +1351,11 @@ SDL_BackendInit(void) int sndfreq = (Cvar_Get("s_khz", "44", CVAR_ARCHIVE))->value; int sndchans = (Cvar_Get("sndchannels", "2", CVAR_ARCHIVE))->value; +#if _WIN32 + cvar_t *s_sdldriver = (Cvar_Get("s_sdldriver", "directsound", CVAR_ARCHIVE)); +#else cvar_t *s_sdldriver = (Cvar_Get("s_sdldriver", "auto", CVAR_ARCHIVE)); +#endif if (strcmp(s_sdldriver->string, "auto") != 0) { @@ -1512,7 +1516,12 @@ SDL_BackendInit(void) int sndbits = (Cvar_Get("sndbits", "16", CVAR_ARCHIVE))->value; int sndfreq = (Cvar_Get("s_khz", "44", CVAR_ARCHIVE))->value; int sndchans = (Cvar_Get("sndchannels", "2", CVAR_ARCHIVE))->value; + +#if _WIN32 + cvar_t *s_sdldriver = (Cvar_Get("s_sdldriver", "directsound", CVAR_ARCHIVE)); +#else cvar_t *s_sdldriver = (Cvar_Get("s_sdldriver", "auto", CVAR_ARCHIVE)); +#endif if (strcmp(s_sdldriver->string, "auto") != 0) {