diff options
author | John Glover <j@johnglover.net> | 2013-06-21 13:00:10 +0200 |
---|---|---|
committer | John Glover <j@johnglover.net> | 2013-06-21 13:00:10 +0200 |
commit | 0c032a446907645bab4805d940e0125f666a5b69 (patch) | |
tree | 3edc6d81347f01335ac39a1da69279d9082bee70 /src | |
parent | c357d6caf3eb64d3fc2604868b696c1e34e8d16e (diff) | |
download | simpl-0c032a446907645bab4805d940e0125f666a5b69.tar.gz simpl-0c032a446907645bab4805d940e0125f666a5b69.tar.bz2 simpl-0c032a446907645bab4805d940e0125f666a5b69.zip |
[sndobj] Bug fix: only take log mag if mag > 0
Diffstat (limited to 'src')
-rw-r--r-- | src/sndobj/SinAnal.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sndobj/SinAnal.cpp b/src/sndobj/SinAnal.cpp index d6a07a2..4181d28 100644 --- a/src/sndobj/SinAnal.cpp +++ b/src/sndobj/SinAnal.cpp @@ -362,8 +362,11 @@ SinAnal::peakdetection(){ bool test1 = true, test2 = false; // take the logarithm of the magnitudes - for(i=0; i<m_numbins;i++) - m_mags[i] = log(m_mags[i]); + for(i=0; i<m_numbins;i++) { + if(m_mags[i] > 0) { + m_mags[i] = log(m_mags[i]); + } + } for(i=0;i < m_numbins-1; i++) { |