tests/src/temporal: avoid crash, clarify
authorPaul Brossier <piem@piem.org>
Thu, 12 May 2016 18:05:34 +0000 (20:05 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 12 May 2016 18:05:34 +0000 (20:05 +0200)
tests/src/temporal/test-a_weighting.c
tests/src/temporal/test-c_weighting.c

index f6399b5..4030a0d 100644 (file)
@@ -20,16 +20,22 @@ int main (void)
 
   // samplerate unknown
   f = new_aubio_filter_a_weighting (4200);
-  del_aubio_filter (f);
+  if (!f) {
+    //PRINT_MSG ("failed creating A-weighting filter with samplerate=4200Hz\n");
+  }
 
   // order to small
   f = new_aubio_filter (2);
-  aubio_filter_set_a_weighting (f, samplerate);
+  if (aubio_filter_set_a_weighting (f, samplerate) != 0) {
+    //PRINT_MSG ("failed setting filter to A-weighting\n");
+  }
   del_aubio_filter (f);
 
   // order to big
   f = new_aubio_filter (12);
-  aubio_filter_set_a_weighting (f, samplerate);
+  if (aubio_filter_set_a_weighting (f, samplerate) != 0) {
+    //PRINT_MSG ("failed setting filter to A-weighting\n");
+  }
   del_aubio_filter (f);
 
   return 0;
index 96d8ee7..84380c9 100644 (file)
@@ -19,16 +19,22 @@ int main (void)
 
   // samplerate unknown
   f = new_aubio_filter_c_weighting (4200);
-  del_aubio_filter (f);
+  if (!f) {
+    //PRINT_WRN ("failed creating C-weighting filter with samplerate=4200Hz");
+  }
 
   // order to small
   f = new_aubio_filter (2);
-  aubio_filter_set_c_weighting (f, samplerate);
+  if (aubio_filter_set_c_weighting (f, samplerate) != 0) {
+    //PRINT_WRN ("failed setting filter to C-weighting");
+  }
   del_aubio_filter (f);
 
   // order to big
   f = new_aubio_filter (12);
-  aubio_filter_set_c_weighting (f, samplerate);
+  if (aubio_filter_set_c_weighting (f, samplerate) != 0) {
+    //PRINT_WRN ("failed setting filter to C-weighting");
+  }
   del_aubio_filter (f);
 
   return 0;