shithub: aubio

Download patch

ref: 6b98ab95cd5c58734143f73501a437f8f34b059d
parent: a4e5a1a2b271b9b1897bfbdf03c33d21d64f78f4
parent: 99c7aa2e3efec988a5f81018b48d9388ff24bba1
author: Paul Brossier <piem@piem.org>
date: Mon Aug 6 13:46:13 EDT 2018

Merge branch 'fix/negative_samplerate'

--- a/src/io/source_wavread.c
+++ b/src/io/source_wavread.c
@@ -195,8 +195,8 @@
     goto beach;
   }
 
-  if ( sr == 0 ) {
-    AUBIO_ERR("source_wavread: Failed opening %s (samplerate can not be 0)\n", s->path);
+  if ( (sint_t)sr <= 0 ) {
+    AUBIO_ERR("source_wavread: Failed opening %s (samplerate can not be <= 0)\n", s->path);
     goto beach;
   }
 
--- a/src/notes/notes.c
+++ b/src/notes/notes.c
@@ -83,6 +83,7 @@
   o->onset_output = new_fvec (1);
 
   o->pitch = new_aubio_pitch (pitch_method, o->pitch_buf_size, o->hop_size, o->samplerate);
+  if (o->pitch == NULL) goto fail;
   if (o->pitch_tolerance != 0.) aubio_pitch_set_tolerance (o->pitch, o->pitch_tolerance);
   aubio_pitch_set_unit (o->pitch, "midi");
   o->pitch_output = new_fvec (1);