Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
848:856dbe997dcd | 849:d7f6f60a8b30 |
---|---|
1443 | 1443 |
1444 for (int s = s0i; s <= s1i; ++s) { | 1444 for (int s = s0i; s <= s1i; ++s) { |
1445 | 1445 |
1446 if (!fft->isColumnAvailable(s)) continue; | 1446 if (!fft->isColumnAvailable(s)) continue; |
1447 | 1447 |
1448 float binfreq = (sr * q) / m_windowSize; | 1448 float binfreq = (float(sr) * q) / m_windowSize; |
1449 if (q == q0i) freqMin = binfreq; | 1449 if (q == q0i) freqMin = binfreq; |
1450 if (q == q1i) freqMax = binfreq; | 1450 if (q == q1i) freqMax = binfreq; |
1451 | 1451 |
1452 if (peaksOnly && !fft->isLocalPeak(s, q)) continue; | 1452 if (peaksOnly && !fft->isLocalPeak(s, q)) continue; |
1453 | 1453 |
2928 if (!m_model) return false; | 2928 if (!m_model) return false; |
2929 | 2929 |
2930 // SVDEBUG << "SpectrogramLayer::setDisplayExtents: " << min << "->" << max << endl; | 2930 // SVDEBUG << "SpectrogramLayer::setDisplayExtents: " << min << "->" << max << endl; |
2931 | 2931 |
2932 if (min < 0) min = 0; | 2932 if (min < 0) min = 0; |
2933 if (max > m_model->getSampleRate()/2) max = m_model->getSampleRate()/2; | 2933 if (max > m_model->getSampleRate()/2.f) max = m_model->getSampleRate()/2.f; |
2934 | 2934 |
2935 int minf = lrintf(min); | 2935 int minf = lrintf(min); |
2936 int maxf = lrintf(max); | 2936 int maxf = lrintf(max); |
2937 | 2937 |
2938 if (m_minFrequency == minf && m_maxFrequency == maxf) return true; | 2938 if (m_minFrequency == minf && m_maxFrequency == maxf) return true; |