From 02fbdbffc695d49507526870aa1ef751cfd8faf8 Mon Sep 17 00:00:00 2001 From: Seto Date: Fri, 20 Feb 2026 17:47:18 +0100 Subject: [PATCH 1/4] Improve device naming and filter unsupported configs --- src/host/aaudio/mod.rs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/host/aaudio/mod.rs b/src/host/aaudio/mod.rs index c2afe3b21..8122c2d08 100644 --- a/src/host/aaudio/mod.rs +++ b/src/host/aaudio/mod.rs @@ -405,8 +405,13 @@ impl DeviceTrait for Device { match &self.0 { None => Ok(DeviceDescriptionBuilder::new("Default Device".to_string()).build()), Some(info) => { - let mut builder = DeviceDescriptionBuilder::new(info.product_name.clone()) - .device_type(info.device_type.into()) + let device_type: DeviceType = info.device_type.into(); + let name = match device_type { + DeviceType::Unknown => info.product_name.clone(), + _ => format!("{} ({})", info.product_name, device_type), + }; + let mut builder = DeviceDescriptionBuilder::new(name) + .device_type(device_type) .interface_type(info.device_type.into()) .direction(info.direction); @@ -432,7 +437,12 @@ impl DeviceTrait for Device { &self, ) -> Result { let configs = if let Some(info) = &self.0 { - device_supported_configs(info) + // Output-only devices do not support input + if matches!(info.direction, DeviceDirection::Output) { + Vec::new().into_iter() + } else { + device_supported_configs(info) + } } else { default_supported_configs() }; @@ -443,7 +453,12 @@ impl DeviceTrait for Device { &self, ) -> Result { let configs = if let Some(info) = &self.0 { - device_supported_configs(info) + // Input-only devices do not support output + if matches!(info.direction, DeviceDirection::Input) { + Vec::new().into_iter() + } else { + device_supported_configs(info) + } } else { default_supported_configs() }; From efde3afc3e587a2d6cda1868bffaa505ddaacf87 Mon Sep 17 00:00:00 2001 From: Seto Date: Sun, 1 Mar 2026 23:54:54 +0100 Subject: [PATCH 2/4] Return error for unsupported input/output device configs --- src/host/aaudio/mod.rs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/host/aaudio/mod.rs b/src/host/aaudio/mod.rs index 8122c2d08..981153151 100644 --- a/src/host/aaudio/mod.rs +++ b/src/host/aaudio/mod.rs @@ -436,33 +436,37 @@ impl DeviceTrait for Device { fn supported_input_configs( &self, ) -> Result { - let configs = if let Some(info) = &self.0 { + if let Some(info) = &self.0 { // Output-only devices do not support input if matches!(info.direction, DeviceDirection::Output) { - Vec::new().into_iter() - } else { - device_supported_configs(info) + return Err(SupportedStreamConfigsError::BackendSpecific { + err: BackendSpecificError { + description: "output-only device does not support input".to_string(), + }, + }); } + Ok(device_supported_configs(info)) } else { - default_supported_configs() - }; - Ok(configs) + Ok(default_supported_configs()) + } } fn supported_output_configs( &self, ) -> Result { - let configs = if let Some(info) = &self.0 { + if let Some(info) = &self.0 { // Input-only devices do not support output if matches!(info.direction, DeviceDirection::Input) { - Vec::new().into_iter() - } else { - device_supported_configs(info) + return Err(SupportedStreamConfigsError::BackendSpecific { + err: BackendSpecificError { + description: "input-only device does not support output".to_string(), + }, + }); } + Ok(device_supported_configs(info)) } else { - default_supported_configs() - }; - Ok(configs) + Ok(default_supported_configs()) + } } fn default_input_config(&self) -> Result { From d5f325bdafe93b2ff720b61bb4a808a72466e4e3 Mon Sep 17 00:00:00 2001 From: Seto Date: Mon, 2 Mar 2026 06:29:43 +0100 Subject: [PATCH 3/4] Update changelog with latest AAudio fixes and improvements --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b09200a95..e797bf70c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- **AAudio**: `supported_input_configs` and `supported_output_configs` now return an error for + direction-mismatched devices (e.g. querying input configs on an output-only device) instead of + silently returning an empty list. +- **AAudio**: Device names now include the device type suffix (e.g. "Speaker (Builtin Speaker)") + for easier identification when enumerating devices. - Reintroduce `audio_thread_priority` feature. - **ASIO**: Fix enumeration returning only the first device when using `collect`. - **Emscripten**: Fix build failure introduced by newer `wasm-bindgen` versions. From 3390481bd92427ae8756513226c559e0955a2f6f Mon Sep 17 00:00:00 2001 From: Roderick van Domburg Date: Mon, 2 Mar 2026 22:36:45 +0100 Subject: [PATCH 4/4] docs: reorder changelog entries --- CHANGELOG.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e797bf70c..b2f6b3c88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,15 +17,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Public error enums are now marked `#[non_exhaustive]` to allow adding variants without SemVer-breaking changes. +- **AAudio**: Device names now include the device type suffix (e.g. "Speaker (Builtin Speaker)") + for easier identification when enumerating devices. +- **AAudio**: `supported_input_configs` and `supported_output_configs` now return an error for + direction-mismatched devices (e.g. querying input configs on an output-only device) instead of + silently returning an empty list. - **ASIO**: `Device::driver`, `asio_streams`, and `current_callback_flag` are no longer `pub`. ### Fixed -- **AAudio**: `supported_input_configs` and `supported_output_configs` now return an error for - direction-mismatched devices (e.g. querying input configs on an output-only device) instead of - silently returning an empty list. -- **AAudio**: Device names now include the device type suffix (e.g. "Speaker (Builtin Speaker)") - for easier identification when enumerating devices. - Reintroduce `audio_thread_priority` feature. - **ASIO**: Fix enumeration returning only the first device when using `collect`. - **Emscripten**: Fix build failure introduced by newer `wasm-bindgen` versions.