refactor: add DEFAULT_SAMPLE_RATE and default to 48 kHz#878
Merged
refactor: add DEFAULT_SAMPLE_RATE and default to 48 kHz#878
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In cpal I've changed the default sample rate to 48 kHz for devices that support it, falling back to 44.1 kHz, then to the device's maximum support sample rate.
In Rodio we used 44.1 and 48 kHz inconsistently, so I think it's good to follow cpal here.
Second, I changed
stream::supported_output_configswhich had several smells:Somewhere in the transition from
SampleRatebecomingNonZerothis function became public. I'm not sure if that was intentional or smart, because it's conflatingcpal::supported_output_configs. I reverted it to be private now, and updated the Rustdoc ofwith_supported_configto use the cpal version instead.The
supported_output_configsRustdoc was imprecise: it did not yield all supported formats, only[max, 44_100, min](in that order). Ifminormaxhappened to also be44_100, it had duplicate values. I changed it to yield[48_000, 44_100, max]without duplicates.