mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Don't overwrite SDLs audio driver selection.
Hardcoding default driver for some of the supported platform is a remnant of SDL 1.2 and hasn't been necessary since SDL 2.0 a long time ago. In fact it has a high properbility to break things, SDL could easily end up with a non working driver. When `s_sdldriver` is set to the newly introduced value `auto` the driver is selected by SDL. In all other cases the string is the driver name which SDL will be forced to. This doesn't fix existing configs. Since the OpenAL sound backend has been the default for nearly 15 years and we haven't received bug reports for some other problem with the SDL sound backend in the past, I'm half sure that there are next to users out there. These can reset the cvar by hand if necessary. Closes #1132.
This commit is contained in:
parent
3aa051c6d2
commit
b3c47df0c8
2 changed files with 17 additions and 24 deletions
|
@ -300,6 +300,11 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
|
|||
is much more reliable than the classic sound system, especially on
|
||||
modern systems like Windows 10 or Linux with PulseAudio.
|
||||
|
||||
* **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.
|
||||
|
||||
* **s_underwater**: Dampen sounds if submerged. Enabled by default.
|
||||
|
||||
* **s_occlusion_strength**: If set bigger than `0` sound occlusion effects
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#define SDL_LOOPATTENUATE 0.003
|
||||
|
||||
/* Globals */
|
||||
static cvar_t *s_sdldriver;
|
||||
static int *snd_p;
|
||||
static sound_t *backend;
|
||||
static portable_samplepair_t paintbuffer[SDL_PAINTBUFFER_SIZE];
|
||||
|
@ -1352,18 +1351,13 @@ SDL_BackendInit(void)
|
|||
int sndfreq = (Cvar_Get("s_khz", "44", CVAR_ARCHIVE))->value;
|
||||
int sndchans = (Cvar_Get("sndchannels", "2", CVAR_ARCHIVE))->value;
|
||||
|
||||
#ifdef _WIN32
|
||||
s_sdldriver = (Cvar_Get("s_sdldriver", "directsound", CVAR_ARCHIVE));
|
||||
#elif __linux__
|
||||
s_sdldriver = (Cvar_Get("s_sdldriver", "alsa", CVAR_ARCHIVE));
|
||||
#elif __APPLE__
|
||||
s_sdldriver = (Cvar_Get("s_sdldriver", "CoreAudio", CVAR_ARCHIVE));
|
||||
#else
|
||||
s_sdldriver = (Cvar_Get("s_sdldriver", "dsp", CVAR_ARCHIVE));
|
||||
#endif
|
||||
cvar_t *s_sdldriver = (Cvar_Get("s_sdldriver", "auto", CVAR_ARCHIVE));
|
||||
|
||||
if (strcmp(s_sdldriver->string, "auto") != 0)
|
||||
{
|
||||
snprintf(reqdriver, sizeof(reqdriver), "%s=%s", "SDL_AUDIODRIVER", s_sdldriver->string);
|
||||
putenv(reqdriver);
|
||||
}
|
||||
|
||||
Com_Printf("Starting SDL audio callback.\n");
|
||||
|
||||
|
@ -1518,19 +1512,13 @@ 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;
|
||||
cvar_t *s_sdldriver = (Cvar_Get("s_sdldriver", "auto", CVAR_ARCHIVE));
|
||||
|
||||
#ifdef _WIN32
|
||||
s_sdldriver = (Cvar_Get("s_sdldriver", "directsound", CVAR_ARCHIVE));
|
||||
#elif __linux__
|
||||
s_sdldriver = (Cvar_Get("s_sdldriver", "alsa", CVAR_ARCHIVE));
|
||||
#elif __APPLE__
|
||||
s_sdldriver = (Cvar_Get("s_sdldriver", "CoreAudio", CVAR_ARCHIVE));
|
||||
#else
|
||||
s_sdldriver = (Cvar_Get("s_sdldriver", "dsp", CVAR_ARCHIVE));
|
||||
#endif
|
||||
|
||||
if (strcmp(s_sdldriver->string, "auto") != 0)
|
||||
{
|
||||
snprintf(reqdriver, sizeof(reqdriver), "%s=%s", "SDL_AUDIODRIVER", s_sdldriver->string);
|
||||
putenv(reqdriver);
|
||||
}
|
||||
|
||||
Com_Printf("Starting SDL audio callback.\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue