]> Repos - portaudio/commit
wasapi: Add paWinWasapiAutoConvert flag, which sets AUDCLNT_STREAMFLAGS_AUTOCONVERTPC...
authorJörn Heusipp <osmanx@problemloesungsmaschine.de>
Mon, 1 Apr 2019 07:05:18 +0000 (09:05 +0200)
committerdmitrykos <dmitrykos@neutroncode.com>
Fri, 5 Apr 2019 07:02:17 +0000 (10:02 +0300)
commitaa0748a5b59491ba2cfa9943825653cde6e1f748
treee6a8e671a4e8cc674bd15e2c435153ab473ca79a
parentd99940b26eb6a48d1a069b3195a50d06badabb46
wasapi: Add paWinWasapiAutoConvert flag, which sets AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM | AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY for Shared mode streams.

AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM is required in order to allow for sample rates other than the system mixer configured sample rate. Otherwise, WASAPI is limited to a single system configured sample rate in Shared mode, which is a severe limitation compared to other APIs supported by PortAudio.
AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY is recommended to be used additionally.
See <https://docs.microsoft.com/en-us/windows/desktop/coreaudio/audclnt-streamflags-xxx-constants> for documentation.

GetClosestFormat is modified to exit early when paWinWasapiAutoConvert is set in Shared mode because we trust the WASAPI conversions to succeed.

We restrict these changes to Windows 7 (and later) because documentation does not clearly state the minimum required Windows version. Windows Vista was not available for testing.

This patch has been in production in OpenMPT (<https://openmpt.org/>) since version 1.27.01.00 (2017-09-27). PortAudio WASAPI Shared mode is the default output device type in OpenMPT for Windows 7 (and later) and also for Wine setups.
include/pa_win_wasapi.h
src/hostapi/wasapi/pa_win_wasapi.c