SDL: wasapi: Don't use the system's resampler.

From b98b5adcaea159fc6a9753f808875acf7d3ee945 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 15 Mar 2021 10:21:36 -0400
Subject: [PATCH] wasapi: Don't use the system's resampler.

---
 src/audio/wasapi/SDL_wasapi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/audio/wasapi/SDL_wasapi.c b/src/audio/wasapi/SDL_wasapi.c
index e74f80c9c..63c06e1ed 100644
--- a/src/audio/wasapi/SDL_wasapi.c
+++ b/src/audio/wasapi/SDL_wasapi.c
@@ -551,6 +551,9 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
         return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret);
     }
 
+#if 1  /* we're getting reports that WASAPI's resampler introduces distortions, so it's disabled for now. --ryan. */
+    this->spec.freq = waveformat->nSamplesPerSec;  /* force sampling rate so our resampler kicks in, if necessary. */
+#else
     /* favor WASAPI's resampler over our own, in Win7+. */
     if (this->spec.freq != waveformat->nSamplesPerSec) {
         /* RATEADJUST only works with output devices in share mode, and is available in Win7 and later.*/
@@ -558,11 +561,11 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
             streamflags |= AUDCLNT_STREAMFLAGS_RATEADJUST;
             waveformat->nSamplesPerSec = this->spec.freq;
             waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8);
-        }
-        else {
+        } else {
             this->spec.freq = waveformat->nSamplesPerSec;  /* force sampling rate so our resampler kicks in. */
         }
     }
+#endif
 
     streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
     ret = IAudioClient_Initialize(client, sharemode, streamflags, 0, 0, waveformat, NULL);