-
Notifications
You must be signed in to change notification settings - Fork 465
[macOS] Fixed SupportedStreamConfigRange returns same min_samplerate and max_samplerate
#926
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
[macOS] Fixed SupportedStreamConfigRange returns same min_samplerate and max_samplerate
#926
Conversation
a5b8ca3 to
ccb70c7
Compare
roderickvd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your (much) earlier contribution. We're breathing new life into cpal and we're going through the backlog.
|
Thanks for the quick update after all this time! I like the approach. Going into a further review, I solicited some feedback from Copilot if you want to take a look if any of that makes sense. It you would also include an entry in the changelog? |
b6aaf23 to
77c0d91
Compare
|
rebased the branch on recent master to resolve conflict in changelog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue on macOS where Device::supported_output/input_configs was returning redundant configuration entries with identical min/max sample rates. The change consolidates these duplicate entries into a single configuration that spans the full available sample rate range.
- Adds logic to detect when all sample rate ranges have identical min/max values
- Returns a single consolidated config when all ranges are identical, or individual ranges when they differ
- Updates changelog to document the behavior change
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/host/coreaudio/macos/mod.rs | Implements the consolidation logic for sample rate ranges and adds explanatory comments |
| CHANGELOG.md | Documents the new behavior for CoreAudio's supported_configs method |
|
LGTM! I'm gonna help you out with these Thanks a lot, this is a good enhancement to also consider for the other hosts. |
On MacOS,
Device::supported_output/input_configsreturns multiple configs and they are the same values except formin_samplerateandmax_samplerate. However, the pair of samplerates are always the same value likemin_samplerate:44100, max_samplerate:44100andmin_samplerate:48000, max_samplerate:48000.With this PR,
Device::supported_output/input_configsnow returns a combinedSupportedStreamConfig. I found this problem when I tried to reorder the available streamconfigs depending on the parameter in my application.On MacOS,
Device::default_input/output_configdoes not usecmp_default_heuristics(I guess wasapi&asio are the same), but I hope this could be used in every platform ideally (though this PR does not address the implementation of the default config-related method).Tested on: M1 Macbook Air(2020), macOS 15.0.1