-
Notifications
You must be signed in to change notification settings - Fork 459
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
Set conditional default backend #1158
Conversation
Thank you! This is something I wanted to do for quite some time now. While this solution is already much better than what has been there before, maybe we could go for an even "smarter" default backend selection logic. I'm thinking of something like this: const fn default_backend() -> Backend {
#[cfg(all(feature = "portaudio_backend", target_os="macos")]
return Backend::Portaudio;
#[cfg(feature = "alsa_backend")]
return Bacend::Alsa;
#[cfg(feature = "portaudio_backend")]
return Backend::Portaudio;
todo!("other backends");
#[cfg(not(any(feature = "pulseaudio_backend", feature = "portaudio_backend", ...)))]
compile_error!("Please enable at least one backend!");
} This would prevent things like this:
Although this code is only a rough sketch and quite verbose / ugly. If you don't want to look into this further, that would be fine as well, and we can just merge this version! :) |
Yes, sure, I'll take a look to this approach. |
I decided to go with the |
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.
Oh, right. That seems like a good idea! Apart from a small comment, LGTM!
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.
Thank you!
cool! |
No description provided.