mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-03-01 03:26:12 +00:00
stream : stop on ^C when no audio is received (#2822)
Add check for ctrl-c in potentially endless loop while calling audio.get() to receive sound. Co-authored-by: Petter Reinholdtsen <pere@debian.org>
This commit is contained in:
parent
17addf7104
commit
b5d21359c1
@ -244,6 +244,11 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
if (!use_vad) {
|
if (!use_vad) {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
// handle Ctrl + C
|
||||||
|
is_running = sdl_poll_events();
|
||||||
|
if (!is_running) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
audio.get(params.step_ms, pcmf32_new);
|
audio.get(params.step_ms, pcmf32_new);
|
||||||
|
|
||||||
if ((int) pcmf32_new.size() > 2*n_samples_step) {
|
if ((int) pcmf32_new.size() > 2*n_samples_step) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user