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

Introduce a public constant for Rodio's default sample rate #646

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

PetrGlad
Copy link
Contributor

@PetrGlad PetrGlad commented Dec 1, 2024

This should help to reduce number of sample rate conversions. Setting it to current de-facto default (44.1kHz).

There is still a question whether we should use cpal::SampleRate or plain integer. With either choice it is better to use the same type everywhere in the API. Currently some functions accept cpal::SampleRate while others use u32. cpal::SampleRate helps with type-checks but does not really provide useful services.

Also partially relieves #208. The rate converter has to be fixed still but with default sample rate less resampling is needed.

Also partially relieves RustAudio#208. The rate converter has to be fixed still
but with default sample rate less resampling is needed.
@PetrGlad
Copy link
Contributor Author

PetrGlad commented Dec 1, 2024

A more advanced solution could allow processing steps to query current preferred sample rate and use that. With such API one could for example open output stream with 48kHz and all processing steps attached to it will adjust accordingly. Or make sample rate a parameter for every processing step that may be affected by it. Which cumbersome but could still help keeping 48kHz everywhere if one needs that. Alternatively it could be some global switch that can be read by all Rodio code, but I am not sure I like it since users may want more than one output stream with different sample rates.
But these are a lot bigger changes, and I do not have a clear idea how to implement those.

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.

1 participant