changeset 25648:2438052a176e

Another small simplification. Slightly worse performance in the case where a buffer underrun happens, but this really should not matter.
author reimar
date Fri, 11 Jan 2008 20:36:33 +0000
parents e93a3c68757f
children 5cf7cb85128f
files libao2/ao_jack.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_jack.c	Fri Jan 11 20:32:42 2008 +0000
+++ b/libao2/ao_jack.c	Fri Jan 11 20:36:33 2008 +0000
@@ -120,6 +120,8 @@
   return len;
 }
 
+static void silence(float **bufs, int cnt, int num_bufs);
+
 /**
  * \brief read data from buffer and splitting it into channels
  * \param bufs num_bufs float buffers, each will contain the data of one channel
@@ -137,10 +139,8 @@
   int buffered = buf_used();
   int i, j;
   if (cnt * sizeof(float) * num_bufs > buffered) {
-    int orig_cnt = cnt;
+    silence(bufs, cnt, num_bufs);
     cnt = buffered / sizeof(float) / num_bufs;
-    for (i = 0; i < num_bufs; i++)
-      memset(&bufs[i][cnt], 0, (orig_cnt - cnt) * sizeof(float));
   }
   for (i = 0; i < cnt; i++) {
     for (j = 0; j < num_bufs; j++) {