Skip to content

Commit 864d8ab

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

File tree

1 file changed

+13
-1
lines changed
  • apps/silero-vad-realtime-minimum/src

1 file changed

+13
-1
lines changed

apps/silero-vad-realtime-minimum/src/main.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,19 @@ fn setup_audio_capture(args: &Args) -> Result<(cpal::Stream, mpsc::Receiver<Vec<
4747
.unwrap_or(false)
4848
}),
4949
}
50-
.ok_or_else(|| anyhow::anyhow!("Failed to find input device"))?;
50+
.ok_or_else(|| {
51+
anyhow::anyhow!(
52+
"No input device found, current available devices: {:?}",
53+
host
54+
.input_devices()
55+
.unwrap()
56+
.map(|d| d
57+
.name()
58+
.unwrap_or_else(|_| "Unnamed Device".to_string()))
59+
.collect::<Vec<String>>()
60+
.join(", ")
61+
)
62+
})?;
5163

5264
println!("Using input device: {}", device.name()?);
5365

0 commit comments

Comments
 (0)