From 32cee3949b802038bb368c9c408af81650873d80 Mon Sep 17 00:00:00 2001 From: alula <6276139+alula@users.noreply.github.com> Date: Tue, 7 Jun 2022 07:46:24 +0200 Subject: [PATCH] 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. --- src/host/oboe/mod.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/host/oboe/mod.rs b/src/host/oboe/mod.rs index 4e245cd..45441f9 100644 --- a/src/host/oboe/mod.rs +++ b/src/host/oboe/mod.rs @@ -73,19 +73,11 @@ impl HostTrait for Host { } fn default_input_device(&self) -> Option { - 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 { - 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)) } }