Fix a few issues discovered on the MAC
authorBill Lash <william.lash@gmail.com>
Thu, 27 Jun 2019 04:34:30 +0000 (23:34 -0500)
committerDavid Griffith <dave@661.org>
Sat, 29 Jun 2019 00:37:07 +0000 (17:37 -0700)
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
src/curses/ux_input.c

index 27393871bb362b9af87ed6dba07e93fd669de820..3db196e52de57442645064fa7b59b630bb026a58 100644 (file)
@@ -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;
index 45d7e6b64e7a49ed020befa1bd2e117c691a59b0..62047b990ce711e59d18288bf05aab7bbace2f00 100644 (file)
@@ -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. */