-
Notifications
You must be signed in to change notification settings - Fork 352
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
[ALSA] using default device on linux fails #226
Comments
I'm similarly seeing a segfault when attempting the recording demo on the Pi 3B+ with multiple USB mics. Recording on the device works with other programs. |
While writing #286 I noticed that the ALSA backend currently just assumes that there are "default" devices available in the backend without actually checking the API: #[inline]
pub fn default_input_device() -> Option<Device> {
Some(Device("default".to_owned()))
}
#[inline]
pub fn default_output_device() -> Option<Device> {
Some(Device("default".to_owned()))
} While I believe using the "default" name is the approach recommended for working with ALSA, we should actually check that it exists. Maybe a better approach would be to enumerate all devices, check if one of the devices is named "default", if so return it, otherwise return the first device that was yielded? |
That is odd. What does Falling back to the first device is completely inappropriate imho. You go from "default" to something that is poorly defined and may result in sound appearing from a source it shouldn't or not at all while it seems to be working otherwise. It only works if it is guaranteed that what should be "default" is the first device. If that guarantee is given, go for it, but otherwise erroring out is just better. EDIT: Even for devices that do not have a corresponding friendly named device listed it still works to just use the friendly prefix. Apparently aplay and arecord use the same binary, so aplay would work just as well. Given the trace, this file seems relevant: Looks like the I was able to confirm that setting |
Encountered this issue today.
|
Try with #917 |
I am using a x86 Linux machine, when trying to use the default device, e.g. using examples/recorder_wav.rs it fails with this output
The enumerate example works, this is the first few lines of output:
As a workaround changing the record example to use the first input device and not the default device (which are the same device...), solves this issue, as following:
The text was updated successfully, but these errors were encountered: