Closed cgutman closed 5 years ago
I've been shipping this code in production for a few weeks across several thousand Windows users (Win7 to Win10) and haven't received any more complaints from users with 192 KHz audio.
Hey thanks for submitting your changes upstream, and thanks for the follow-up to report that user testing worked.
My application is decoding incoming audio at a fixed 48 KHz sample rate and I'm depending on WASAPI resampling to handle conversion to the mix format. Right now, libsoundio is using
AUDCLNT_STREAMFLAGS_RATEADJUST
andIAudioClockAdjustment::SetSampleRate()
to handle sample rates that differ from the native mix format.However, when setting my mix format in the Sound Control Panel to 16-bit, 192 KHz,
SetSampleRate()
fails withE_INVALIDARG
meaning "The sample rate is out of the range for the Audio Processing Object." according to MSDN. The amount of sample rate adjustment available usingSetSampleRate()
appears to be limited.It seems that what we really want here is
AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM
which automatically handles sample rate conversion to the mix format. Using this flag fixes the 48 KHz -> 192 KHz resampling case.To reproduce:
soundio_outstream_open()
fails withSoundIoErrorOpeningDevice