in = reinterpret_cast<double *> (fftw_malloc(sizeof(double) * FFT_LENGTH / PAD_FACTOR));
in_windowed = reinterpret_cast<double *> (fftw_malloc(sizeof(double) * FFT_LENGTH));
out = reinterpret_cast<std::complex<double> *> (fftw_malloc(sizeof(std::complex<double>) * (FFT_LENGTH / 2 + 1)));
- bins = reinterpret_cast<double *> (fftw_malloc(sizeof(double) * FFT_LENGTH / 2 + 1));
+ bins = reinterpret_cast<double *> (fftw_malloc(sizeof(double) * (FFT_LENGTH / 2 + 1)));
memset(in, 0, sizeof(double) * FFT_LENGTH / PAD_FACTOR);
}
}
+ if (best_bin == 0 || best_bin == num_samples / 2) {
+ return std::make_pair(-1.0, 0.0);
+ }
std::pair<double, double> peak =
interpolate_peak(in[best_bin - 1],
in[best_bin],