add alsa example for vad+offline asr (#2020)

This commit is contained in:
Fangjun Kuang
2025-03-18 20:06:24 +08:00
committed by GitHub
parent 0e0afb2cc8
commit 1f52ac2126
5 changed files with 174 additions and 1 deletions

View File

@@ -115,11 +115,20 @@ to download models for offline ASR.
PaDeviceIndex num_devices = Pa_GetDeviceCount();
fprintf(stderr, "Num devices: %d\n", num_devices);
if (num_devices == 0) {
fprintf(stderr,
" If you are using Linux, please try "
"./build/bin/sherpa-onnx-vad-alsa-offline-asr\n");
exit(-1);
}
int32_t device_index = Pa_GetDefaultInputDevice();
if (device_index == paNoDevice) {
fprintf(stderr, "No default input device found\n");
fprintf(stderr,
" If you are using Linux, please try "
"./build/bin/sherpa-onnx-vad-alsa-offline-asr\n");
exit(EXIT_FAILURE);
}