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

This commit is contained in:
Ryan C. Gordon 2021-03-15 10:21:36 -04:00
parent 8ba735c208
commit b98b5adcae
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 5 additions and 2 deletions

View File

@ -551,6 +551,9 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream)
return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret); 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+. */ /* favor WASAPI's resampler over our own, in Win7+. */
if (this->spec.freq != waveformat->nSamplesPerSec) { if (this->spec.freq != waveformat->nSamplesPerSec) {
/* RATEADJUST only works with output devices in share mode, and is available in Win7 and later.*/ /* 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; streamflags |= AUDCLNT_STREAMFLAGS_RATEADJUST;
waveformat->nSamplesPerSec = this->spec.freq; waveformat->nSamplesPerSec = this->spec.freq;
waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8); waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8);
} } else {
else {
this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in. */ this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in. */
} }
} }
#endif
streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK; streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
ret = IAudioClient_Initialize(client, sharemode, streamflags, 0, 0, waveformat, NULL); ret = IAudioClient_Initialize(client, sharemode, streamflags, 0, 0, waveformat, NULL);