shithub: aubio

Download patch

ref: a5c6182809d3df42f7f4e62b3270cdea23cc178e
parent: c853c1d12ff8aca51206f869d6711890cf010f55
author: Paul Brossier <piem@piem.org>
date: Sat Nov 17 10:20:41 EST 2018

[filterbank] move statement after declaration

--- a/src/spectral/filterbank_mel.c
+++ b/src/spectral/filterbank_mel.c
@@ -172,11 +172,6 @@
 {
   uint_t retval;
 
-  if (samplerate <= 0) {
-    AUBIO_ERR("filterbank: set_mel_coeffs_slaney samplerate should be > 0\n");
-    return AUBIO_FAIL;
-  }
-
   /* Malcolm Slaney parameters */
   smpl_t lowestFrequency = 133.3333;
   smpl_t linearSpacing = 66.66666666;
@@ -191,7 +186,14 @@
   smpl_t lastlinearCF;
 
   /* buffers to compute filter frequencies */
-  fvec_t *freqs = new_fvec (n_filters + 2);
+  fvec_t *freqs;
+
+  if (samplerate <= 0) {
+    AUBIO_ERR("filterbank: set_mel_coeffs_slaney samplerate should be > 0\n");
+    return AUBIO_FAIL;
+  }
+
+  freqs = new_fvec (n_filters + 2);
 
   /* first step: fill all the linear filter frequencies */
   for (fn = 0; fn < linearFilters; fn++) {