comparison layer/SpectrogramLayer.cpp @ 518:fe134ec37a2a

* fix unsigned overflow causing spectrogram to "disappear" in some resolution and scroll combinations
author Chris Cannam
date Fri, 06 Mar 2009 10:23:30 +0000
parents c74e511a3c96
children e6e38632e8ea
comparison
equal deleted inserted replaced
517:1c6439ef99d6 518:fe134ec37a2a
2171 displayMaxFreq = getEffectiveMaxFrequency(); 2171 displayMaxFreq = getEffectiveMaxFrequency();
2172 } 2172 }
2173 2173
2174 // std::cerr << "(giving actual minFreq " << minFreq << " and display minFreq " << displayMinFreq << ")" << std::endl; 2174 // std::cerr << "(giving actual minFreq " << minFreq << " and display minFreq " << displayMinFreq << ")" << std::endl;
2175 2175
2176 size_t increment = getWindowIncrement(); 2176 int increment = getWindowIncrement();
2177 2177
2178 bool logarithmic = (m_frequencyScale == LogFrequencyScale); 2178 bool logarithmic = (m_frequencyScale == LogFrequencyScale);
2179 /* 2179 /*
2180 float yforbin[maxbin - minbin + 1]; 2180 float yforbin[maxbin - minbin + 1];
2181 2181
2660 if (sx1 <= sx0) sx1 = sx0 + 1; 2660 if (sx1 <= sx0) sx1 = sx0 + 1;
2661 2661
2662 for (int y = 0; y < h; ++y) peaks[y] = 0.f; 2662 for (int y = 0; y < h; ++y) peaks[y] = 0.f;
2663 2663
2664 for (int sx = sx0; sx < sx1; ++sx) { 2664 for (int sx = sx0; sx < sx1; ++sx) {
2665
2666 #ifdef DEBUG_SPECTROGRAM_REPAINT
2667 // std::cerr << "sx = " << sx << std::endl;
2668 #endif
2665 2669
2666 if (sx < 0 || sx >= int(sourceModel->getWidth())) continue; 2670 if (sx < 0 || sx >= int(sourceModel->getWidth())) continue;
2667 2671
2668 if (!m_synchronous) { 2672 if (!m_synchronous) {
2669 if (!sourceModel->isColumnAvailable(sx)) { 2673 if (!sourceModel->isColumnAvailable(sx)) {