Mercurial > hg > svgui
changeset 45:25a2915d351d
* 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
author | Chris Cannam |
---|---|
date | Fri, 03 Mar 2006 16:56:20 +0000 |
parents | ad214997dddb |
children | 2152e19d7db9 |
files | layer/SpectrogramLayer.cpp |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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); }