From 149262d921751df276606e5db18ee7f78d69fa40 Mon Sep 17 00:00:00 2001 From: Bill Lash Date: Wed, 26 Jun 2019 23:34:30 -0500 Subject: [PATCH] Fix a few issues discovered on the MAC Reduce the max wait from 1 second to 1 msec to prevent pauses between sounds. Also check the return value of the samplerate converter src_process() and if there was an error, tell the caller to try calling again. --- src/curses/ux_audio.c | 10 +++++++++- src/curses/ux_input.c | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/curses/ux_audio.c b/src/curses/ux_audio.c index 2739387..3db196e 100644 --- a/src/curses/ux_audio.c +++ b/src/curses/ux_audio.c @@ -292,7 +292,15 @@ resampler_step(resampler_t *rsmp, float *block) rsmp->src_data.input_frames = smps; } - src_process(rsmp->src_state, &rsmp->src_data); + if (src_process(rsmp->src_state, &rsmp->src_data)) + { + /* + * src_process returned an error, don't update + * the rsmp structure, and tell the caller to + * re-run the resampler + */ + return 1; + } int u_in = rsmp->src_data.input_frames_used; rsmp->src_data.data_in += 2*u_in; diff --git a/src/curses/ux_input.c b/src/curses/ux_input.c index 45d7e6b..62047b9 100644 --- a/src/curses/ux_input.c +++ b/src/curses/ux_input.c @@ -181,8 +181,8 @@ static int unix_read_char(int extkeys) /* * If the timeout is 0, we still want to call os_tick once per second */ - maxwait.tv_sec=1; - maxwait.tv_usec=0; + maxwait.tv_sec=0; + maxwait.tv_usec=1000; while(1) { /* Wait with select so that we get interrupted on SIGWINCH. */ -- 2.34.1