changeset 849:d7f6f60a8b30

Fix a couple of inadvertant integer divisions (from coverity scan)
author Chris Cannam
date Wed, 03 Sep 2014 11:47:41 +0100
parents 856dbe997dcd
children 0c993091a4c9
files layer/SpectrogramLayer.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Wed Sep 03 11:44:40 2014 +0100
+++ b/layer/SpectrogramLayer.cpp	Wed Sep 03 11:47:41 2014 +0100
@@ -1445,7 +1445,7 @@
 
             if (!fft->isColumnAvailable(s)) continue;
 
-	    float binfreq = (sr * q) / m_windowSize;
+	    float binfreq = (float(sr) * q) / m_windowSize;
 	    if (q == q0i) freqMin = binfreq;
 	    if (q == q1i) freqMax = binfreq;
 
@@ -2930,7 +2930,7 @@
 //    SVDEBUG << "SpectrogramLayer::setDisplayExtents: " << min << "->" << max << endl;
 
     if (min < 0) min = 0;
-    if (max > m_model->getSampleRate()/2) max = m_model->getSampleRate()/2;
+    if (max > m_model->getSampleRate()/2.f) max = m_model->getSampleRate()/2.f;
     
     int minf = lrintf(min);
     int maxf = lrintf(max);