ref: c965b3370fa327e0f4bebba6f7d2304f55411691
parent: 037319af38b6b3d8ad5de68bc90a843d1d5c0412
author: Paul Brossier <piem@piem.org>
date: Wed Mar 6 10:30:55 EST 2013
src/mathutils.c: freqtobin and bintofreq to not produce negative values
--- a/src/mathutils.c
+++ b/src/mathutils.c
@@ -421,7 +421,7 @@
aubio_bintofreq (smpl_t bin, smpl_t samplerate, smpl_t fftsize)
{
smpl_t freq = samplerate / fftsize;
- return freq * bin;
+ return freq * MAX(bin, 0);
}
smpl_t
@@ -435,7 +435,7 @@
aubio_freqtobin (smpl_t freq, smpl_t samplerate, smpl_t fftsize)
{
smpl_t bin = fftsize / samplerate;
- return freq * bin;
+ return MAX(freq, 0) * bin;
}
smpl_t