Skip to content

refactor: add DEFAULT_SAMPLE_RATE and default to 48 kHz#878

Merged
yara-blue merged 2 commits intomasterfrom
refactor/48k-default-rate
Apr 27, 2026
Merged

refactor: add DEFAULT_SAMPLE_RATE and default to 48 kHz#878
yara-blue merged 2 commits intomasterfrom
refactor/48k-default-rate

Conversation

@roderickvd
Copy link
Copy Markdown
Member

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_configs which had several smells:

  • Somewhere in the transition from SampleRate becoming NonZero this function became public. I'm not sure if that was intentional or smart, because it's conflating cpal::supported_output_configs. I reverted it to be private now, and updated the Rustdoc of with_supported_config to use the cpal version instead.

  • The supported_output_configs Rustdoc was imprecise: it did not yield all supported formats, only [max, 44_100, min] (in that order). If min or max happened to also be 44_100, it had duplicate values. I changed it to yield [48_000, 44_100, max] without duplicates.

@roderickvd roderickvd requested a review from yara-blue April 27, 2026 18:19
Copy link
Copy Markdown
Member

@yara-blue yara-blue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!

@yara-blue yara-blue merged commit 1f92796 into master Apr 27, 2026
3 checks passed
@roderickvd roderickvd deleted the refactor/48k-default-rate branch April 27, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants