-
Notifications
You must be signed in to change notification settings - Fork 353
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
Expose max buffer size for WASAPI #667
Comments
I'm bumping this, as there is still no API for getting the actual buffer size used by a stream. I'm not sure if any other hosts behave like this, but the library would benefit from some kind of support for this behavior. |
When a stream is built with an unknown buffer size, it would be very useful to get at least an upper limit, so that any intermediate buffers can be constructed up front. The WASAPI host already appears to have access to such a value through the
IAudioClient::GetBufferSize
method. However, this is only available after the client has been initialized, which requires some information from the config, which is only available during the call tobuild_output_stream
.As I see it, these are the possible ways that this could be achieved:
Putting this value in the
OutputCallbackInfo
. I don't think this would be optimal, as it would force some setup logic into the callback, likely behind anif first_run
or something.Either obtaining an
IAudioClient2
or higher that exposes theIAudioClient2::GetBufferSizeLimits
before it is initialized, or initializing theIAudioClient
early, and using theIAudioClient::GetBufferSize
method.Both of these require a
WAVEFORMATEX
, which needs some info from the config (channels, sample rate, etc.). One solution would be simply feeding it back its own list of supported configs and finding the biggest value, but this seems a bit inefficient and imprecise, since a more appropriate value could have been gotten by knowing the actual configuration.Altering the API by breaking up the
build_output_stream
method. One part initializes the client and returns the max buffer size, allowing the intermediate buffers to be constructed, and another part takes the callback closure with ownership of the buffers. These could even coexist with the current method.The text was updated successfully, but these errors were encountered: