From 01f1933f69e09ccac0d0651465c412e93a354a20 Mon Sep 17 00:00:00 2001
From: mazmazz <mar.marcoz@outlook.com>
Date: Sat, 8 Dec 2018 14:05:58 -0500
Subject: [PATCH 1/2] Force directsound to fix wrong-pitch sound effects

---
 src/sdl/mixer_sound.c | 6 ++++++
 src/sdl/sdl_sound.c   | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c
index 3f9b09f10..083ef0054 100644
--- a/src/sdl/mixer_sound.c
+++ b/src/sdl/mixer_sound.c
@@ -92,6 +92,12 @@ void I_StartupSound(void)
 {
 	I_Assert(!sound_started);
 
+#ifdef _WIN32
+	// Force DirectSound instead of WASAPI
+	// SDL 2.0.6+ defaults to the latter and it screws up our sound effects
+	SDL_setenv("SDL_AUDIODRIVER", "directsound", 1);
+#endif
+
 	// EE inits audio first so we're following along.
 	if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
 	{
diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c
index f4796cd80..7fec92029 100644
--- a/src/sdl/sdl_sound.c
+++ b/src/sdl/sdl_sound.c
@@ -1186,6 +1186,12 @@ void I_StartupSound(void)
 	// Configure sound device
 	CONS_Printf("I_StartupSound:\n");
 
+	#ifdef _WIN32
+		// Force DirectSound instead of WASAPI
+		// SDL 2.0.6+ defaults to the latter and it screws up our sound effects
+		SDL_setenv("SDL_AUDIODRIVER", "directsound", 1);
+	#endif
+
 	// EE inits audio first so we're following along.
 	if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
 		CONS_Printf("SDL Audio already started\n");

From 47ee3525afed8c071c4bd2dec7251dec9db53214 Mon Sep 17 00:00:00 2001
From: mazmazz <mar.marcoz@outlook.com>
Date: Sat, 8 Dec 2018 14:10:09 -0500
Subject: [PATCH 2/2] Indentation

---
 src/sdl/sdl_sound.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c
index 7fec92029..412102790 100644
--- a/src/sdl/sdl_sound.c
+++ b/src/sdl/sdl_sound.c
@@ -1186,11 +1186,11 @@ void I_StartupSound(void)
 	// Configure sound device
 	CONS_Printf("I_StartupSound:\n");
 
-	#ifdef _WIN32
-		// Force DirectSound instead of WASAPI
-		// SDL 2.0.6+ defaults to the latter and it screws up our sound effects
-		SDL_setenv("SDL_AUDIODRIVER", "directsound", 1);
-	#endif
+#ifdef _WIN32
+	// Force DirectSound instead of WASAPI
+	// SDL 2.0.6+ defaults to the latter and it screws up our sound effects
+	SDL_setenv("SDL_AUDIODRIVER", "directsound", 1);
+#endif
 
 	// EE inits audio first so we're following along.
 	if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)