use device name instead of node id to get audio device

This commit is contained in:
2025-10-05 23:26:29 +03:00
parent d877f79d5c
commit 874c8063aa
11 changed files with 35 additions and 42 deletions
+2 -2
View File
@@ -199,12 +199,12 @@ pub async fn get_all_devices() -> Result<(Vec<AudioDevice>, Vec<AudioDevice>), B
}
}
pub async fn get_device(node_id: u32) -> Result<AudioDevice, Box<dyn Error>> {
pub async fn get_device(device_name: &str) -> Result<AudioDevice, Box<dyn Error>> {
let (mut input_devices, output_devices) = get_all_devices().await?;
input_devices.extend(output_devices);
for device in input_devices {
if device.id == node_id {
if device.name == device_name {
return Ok(device);
}
}