Skip to content

Commit 614cb70

Browse files
authored
Improve AAudio device names (#965)
1 parent 2ea518d commit 614cb70

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/host/aaudio/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,17 @@ impl DeviceTrait for Device {
313313
fn name(&self) -> Result<String, DeviceNameError> {
314314
match &self.0 {
315315
None => Ok("default".to_owned()),
316-
Some(info) => Ok(info.product_name.clone()),
316+
Some(info) => {
317+
let name = if info.address.is_empty() {
318+
format!("{}:{:?}", info.product_name, info.device_type)
319+
} else {
320+
format!(
321+
"{}:{:?}:{}",
322+
info.product_name, info.device_type, info.address
323+
)
324+
};
325+
Ok(name)
326+
}
317327
}
318328
}
319329

0 commit comments

Comments
 (0)