shithub: aubio

Download patch

ref: ff87a6721e6100148de5a3f93844855f619491ad
parent: b2f41be62beb610ee6fc993ba6b93f8d39d35872
author: Paul Brossier <piem@piem.org>
date: Fri Dec 7 13:03:45 EST 2018

[tests] increase timestretch coverage, fix memory leak

--- a/tests/src/effects/test-timestretch.c
+++ b/tests/src/effects/test-timestretch.c
@@ -43,7 +43,7 @@
 
   fvec_t *in = new_fvec(source_hopsize);
   fvec_t *out = new_fvec(hop_size);
-  if (!out) { err = 1; goto beach_fvec; }
+  if (!out || !in) { err = 1; goto beach_fvec; }
 
   aubio_timestretch_t *ps = new_aubio_timestretch(mode, stretch, hop_size,
       samplerate);
@@ -90,6 +90,7 @@
   del_aubio_timestretch(ps);
 beach_timestretch:
   del_fvec(out);
+  del_fvec(in);
 beach_fvec:
   del_aubio_source(s);
 beach_source:
@@ -107,7 +108,8 @@
   uint_t hop_size = 256;
   uint_t samplerate = 44100;
 
-  if (new_aubio_timestretch("??", stretch, hop_size, samplerate)) return 1;
+  if (new_aubio_timestretch("ProcessOffline:?:", stretch, hop_size, samplerate)) return 1;
+  if (new_aubio_timestretch("", stretch, hop_size, samplerate)) return 1;
   if (new_aubio_timestretch(mode,     41., hop_size, samplerate)) return 1;
   if (new_aubio_timestretch(mode, stretch,        0, samplerate)) return 1;
   if (new_aubio_timestretch(mode, stretch, hop_size,          0)) return 1;
@@ -118,6 +120,8 @@
   if (!p) return 1;
 
   if (aubio_timestretch_get_latency(p) == 0) return 1;
+
+  if (aubio_timestretch_get_samplerate(p) != samplerate) return 1;
 
   aubio_timestretch_reset(p);