shithub: aubio

Download patch

ref: 9bd769a638c5e83ca90e71686a46763f90838ea8
parent: 992ac886336e88302c69da2a3d6072b63375e7e5
author: Paul Brossier <piem@piem.org>
date: Thu Sep 29 19:07:19 EDT 2016

src/effects/timestretch_rubberband.c: fix eof when last available == hopsize, change _set messages to warnings

--- a/src/effects/timestretch_rubberband.c
+++ b/src/effects/timestretch_rubberband.c
@@ -136,7 +136,7 @@
     rubberband_set_time_ratio(p->rb, 1./p->stretchratio);
     return AUBIO_OK;
   } else {
-    AUBIO_ERR("timestretch: could not set stretch ratio to %.2f\n", stretch);
+    AUBIO_WRN("timestretch: could not set stretch ratio to %.2f\n", stretch);
     return AUBIO_FAIL;
   }
 }
@@ -155,7 +155,7 @@
     rubberband_set_pitch_scale(p->rb, p->pitchscale);
     return AUBIO_OK;
   } else {
-    AUBIO_ERR("timestretch: could not set pitchscale to %.2f\n", pitchscale);
+    AUBIO_WRN("timestretch: could not set pitchscale to %.2f\n", pitchscale);
     return AUBIO_FAIL;
   }
 }
@@ -173,7 +173,7 @@
     smpl_t pitchscale = POW(2., transpose / 12.);
     return aubio_timestretch_set_pitchscale(p, pitchscale);
   } else {
-    AUBIO_ERR("timestretch: could not set transpose to %.2f\n", transpose);
+    AUBIO_WRN("timestretch: could not set transpose to %.2f\n", transpose);
     return AUBIO_FAIL;
   }
 }
@@ -209,9 +209,12 @@
   if (available >= (int)p->hopsize) {
     rubberband_retrieve(p->rb, (float* const*)&(out->data), p->hopsize);
     *read = p->hopsize;
-  } else {
+  } else if (available > 0) {
     rubberband_retrieve(p->rb, (float* const*)&(out->data), available);
     *read = available;
+  } else {
+    fvec_zeros(out);
+    *read = 0;
   }
 }