diff layer/SpectrogramLayer.cpp @ 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 1986c9b0d9c3 0fe1f4407261
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);