Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use WASAPI AUTOCONVERTPCM to automatically convert sample rate and channel count in shared mode #32

Closed
dechamps opened this issue Dec 3, 2018 · 0 comments
Labels
enhancement portaudio Requires changes in PortAudio upstream.

Comments

@dechamps
Copy link
Owner

dechamps commented Dec 3, 2018

Following the investigation in #23 it was my understanding that it is fundamentally impossible to use WASAPI Shared with a sample rate and channel count other than the one used by the Windows audio engine.

However, I recently stumbled upon this official blog post and related WASAPI flags that seem to contradict the above conclusions.

The two interesting flags for format negotiation are AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM and AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY, which tell Windows that you want the WASAPI audio engine to do any necessary conversions between the client format you are giving it and the playback mix format or recording split format.

AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM 0x80000000 | A channel matrixer and a sample rate converter are inserted as necessary to convert between the uncompressed format supplied to IAudioClient::Initialize and the audio engine mix format.

It would be nice if we could use this in FlexASIO to make it easier to use WASAPI Shared, as format negotiation is a well-known pain point of that particular backend. This will likely require changes to the PortAudio WASAPI backend, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement portaudio Requires changes in PortAudio upstream.
Projects
None yet
Development

No branches or pull requests

1 participant