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.
This commit is contained in:
parent
d99940b26e
commit
aa0748a5b5
2 changed files with 25 additions and 1 deletions
|
|
@ -78,7 +78,13 @@ typedef enum PaWasapiFlags
|
|||
/* force explicit sample format and do not allow PA to select suitable working format, API will
|
||||
fail if provided sample format is not supported by audio hardware in Exclusive mode
|
||||
or system mixer in Shared mode */
|
||||
paWinWasapiExplicitSampleFormat = (1 << 5)
|
||||
paWinWasapiExplicitSampleFormat = (1 << 5),
|
||||
|
||||
/* allow API to insert system-level channel matrix mixer and sample rate converter to allow
|
||||
playback formats that do not match the current configured system settings.
|
||||
this is in particular required for streams not matching the system mixer sample rate.
|
||||
only applies in Shared mode. */
|
||||
paWinWasapiAutoConvert = (1 << 6)
|
||||
}
|
||||
PaWasapiFlags;
|
||||
#define paWinWasapiExclusive (paWinWasapiExclusive)
|
||||
|
|
@ -87,6 +93,7 @@ PaWasapiFlags;
|
|||
#define paWinWasapiPolling (paWinWasapiPolling)
|
||||
#define paWinWasapiThreadPriority (paWinWasapiThreadPriority)
|
||||
#define paWinWasapiExplicitSampleFormat (paWinWasapiExplicitSampleFormat)
|
||||
#define paWinWasapiAutoConvert (paWinWasapiAutoConvert)
|
||||
|
||||
|
||||
/* Stream state.
|
||||
|
|
|
|||
Loading…
Reference in a new issue