Return Device(None) as a default i/o device (#638)

In most cases, device with index 0 is NOT the default output device - in my case it happens to be the ear speaker. Returning Device(None) there makes Oboe choose the default input/output device - everything works as expected.
This commit is contained in:
alula 2022-06-07 07:46:24 +02:00 • committed by GitHub
parent 223f28262a
commit 32cee3949b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,19 +73,11 @@ impl HostTrait for Host {
}
fn default_input_device(&self) -> Option<Self::Device> {
if let Ok(devices) = oboe::AudioDeviceInfo::request(oboe::AudioDeviceDirection::Input) {
devices.into_iter().map(|d| Device(Some(d))).next()
} else {
Some(Device(None))
}
Some(Device(None))
}
fn default_output_device(&self) -> Option<Self::Device> {
if let Ok(devices) = oboe::AudioDeviceInfo::request(oboe::AudioDeviceDirection::Output) {
devices.into_iter().map(|d| Device(Some(d))).next()
} else {
Some(Device(None))
}
Some(Device(None))
}
}