# HG changeset patch # User Chris Cannam # Date 1141404980 0 # Node ID 25a2915d351db6aca3c2dc5aab69e50d262be760 # Parent ad214997dddb5e92cb4beb49dcd6e900e8d0808b * Continue MainWindow refactoring by making MainWindow actually use the new Document class -- still somewhat unstable * Fix crash in spectrogram layer * Rename tonalestimator to TonalEstimator and add to project file diff -r ad214997dddb -r 25a2915d351d layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Thu Mar 02 16:58:49 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Fri Mar 03 16:56:20 2006 +0000 @@ -1686,8 +1686,10 @@ #ifdef DEBUG_SPECTROGRAM_REPAINT std::cerr << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << ", m_updateTimer " << m_updateTimer << ", pixmap cache invalid " << m_pixmapCacheInvalid << std::endl; #endif - - m_candidateFillStartFrame = v->getStartFrame(); + + long sf = v->getStartFrame(); + if (sf < 0) m_candidateFillStartFrame = 0; + else m_candidateFillStartFrame = sf; if (!m_model || !m_model->isOK() || !m_model->isReady()) { return; @@ -1883,6 +1885,15 @@ int s0i = int(s0 + 0.001); int s1i = int(s1); + if (s1i >= m_cache->getWidth()) { + if (s0i >= m_cache->getWidth()) { + m_mutex.unlock(); + continue; + } else { + s1i = s0i; + } + } + for (size_t q = minbin; q < bins; ++q) { float f0 = (float(q) * sr) / m_windowSize; @@ -1890,8 +1901,7 @@ float y0 = 0, y1 = 0; - if (m_binDisplay != PeakFrequencies || - s1i >= int(m_cache->getWidth())) { + if (m_binDisplay != PeakFrequencies) { y0 = v->getYForFrequency(f1, minFreq, maxFreq, logarithmic); y1 = v->getYForFrequency(f0, minFreq, maxFreq, logarithmic); }