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

Consider using Pa_IsFormatSupported for probing sample rates #188

Closed
dechamps opened this issue Mar 5, 2023 · 2 comments
Closed

Consider using Pa_IsFormatSupported for probing sample rates #188

dechamps opened this issue Mar 5, 2023 · 2 comments

Comments

@dechamps
Copy link
Owner

dechamps commented Mar 5, 2023

Currently FlexASIO implements CanSampleRate by attempting to open an actual PortAudio stream and see what happens:

Log() << "Checking if input supports this sample rate";
OpenStream(true, false, sampleRate, paFramesPerBufferUnspecified, NoOpStreamCallback, nullptr);
Log() << "Input supports this sample rate";

It is not clear why FlexASIO is not using Pa_IsFormatSupported() instead, which is precisely aimed at this use case - for example the pa_devs PortAudio example uses it to… well, probe sample rates.

I suspect this was an oversight on my part - it's possible I didn't realize this PortAudio function existed when I wrote the code.

Using Pa_IsFormatSupported() might be less disruptive and more efficient than opening a stream.

@dechamps
Copy link
Owner Author

dechamps commented Mar 5, 2023

It's possible this would work around #159 as a side effect.

@dechamps dechamps added this to the FlexASIO 1.10 milestone May 25, 2024
dechamps added a commit that referenced this issue May 26, 2024
Since we are now using Pa_IsFormatSupported() instead of Pa_OpenStream()
to probe sample rates, we should be able to actually probe sample rates
even while an exclusive stream is running. Previously, we would just
report every sample rate as supported in this scenario.

See #188. Fixes #66 (differently)
@dechamps
Copy link
Owner Author

This is implemented in FlexASIO 1.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant