Skip to content

Commit 27864b6

Browse files
committed
feat: list available devices when no matches
1 parent 8ba280f commit 27864b6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

apps/silero-vad-whisper-realtime/src/audio_manager.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,19 @@ impl AudioManager {
2626
.input_devices()?
2727
.find(|d| d.name().map(|n| n == name).unwrap_or(false)),
2828
}
29-
.ok_or_else(|| anyhow::anyhow!("No input device found"))?;
29+
.ok_or_else(|| {
30+
anyhow::anyhow!(
31+
"No input device found, current available devices: {:?}",
32+
host
33+
.input_devices()
34+
.unwrap()
35+
.map(|d| d
36+
.name()
37+
.unwrap_or_else(|_| "Unnamed Device".to_string()))
38+
.collect::<Vec<String>>()
39+
.join(", ")
40+
)
41+
})?;
3042

3143
println!("Using audio input device: {}", device.name()?);
3244

0 commit comments

Comments
 (0)