projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
037319a
)
src/mathutils.c: freqtobin and bintofreq to not produce negative values
author
Paul Brossier
<piem@piem.org>
Wed, 6 Mar 2013 20:30:55 +0000
(15:30 -0500)
committer
Paul Brossier
<piem@piem.org>
Wed, 6 Mar 2013 20:30:55 +0000
(15:30 -0500)
src/mathutils.c
patch
|
blob
|
history
diff --git
a/src/mathutils.c
b/src/mathutils.c
index 74063a27a1fd2672137371b50eb5d6aa1abfa418..b0a958b9dde1e2cb977c69ce563121e72b4d56a5 100644
(file)
--- a/
src/mathutils.c
+++ b/
src/mathutils.c
@@
-421,7
+421,7
@@
smpl_t
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
@@
smpl_t
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