# HG changeset patch # User Chris Cannam # Date 1171475526 0 # Node ID 258af0c4dc289395f39abd478a2694706b8587e1 # Parent cec1f78fbfca325381aaab347c0273de396bdfe9 * Fix crash in short spectrogram paint * Fix incorrect apparent end point for waveforms diff -r cec1f78fbfca -r 258af0c4dc28 layer/Layer.cpp --- a/layer/Layer.cpp Fri Feb 09 11:32:34 2007 +0000 +++ b/layer/Layer.cpp Wed Feb 14 17:52:06 2007 +0000 @@ -43,7 +43,12 @@ QString Layer::getLayerPresentationName() const { - QString layerName = objectName(); +// QString layerName = objectName(); + + LayerFactory *factory = LayerFactory::getInstance(); + QString layerName = factory->getLayerPresentationName + (factory->getLayerType(this)); + QString modelName; if (getModel()) modelName = getModel()->objectName(); diff -r cec1f78fbfca -r 258af0c4dc28 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Fri Feb 09 11:32:34 2007 +0000 +++ b/layer/SpectrogramLayer.cpp Wed Feb 14 17:52:06 2007 +0000 @@ -1629,11 +1629,18 @@ int x0 = 0, x1 = v->width(); float s00 = 0, s01 = 0, s10 = 0, s11 = 0; - getXBinRange(v, x0, s00, s01); - getXBinRange(v, x1, s10, s11); + if (!getXBinRange(v, x0, s00, s01)) { + s00 = s01 = m_model->getStartFrame() / getWindowIncrement(); + } + + if (!getXBinRange(v, x1, s10, s11)) { + s10 = s11 = m_model->getEndFrame() / getWindowIncrement(); + } int s0 = int(std::min(s00, s10) + 0.0001); - int s1 = int(std::max(s01, s11)); + int s1 = int(std::max(s01, s11) + 0.0001); + +// std::cerr << "SpectrogramLayer::updateViewMagnitudes: x0 = " << x0 << ", x1 = " << x1 << ", s00 = " << s00 << ", s11 = " << s11 << " s0 = " << s0 << ", s1 = " << s1 << std::endl; if (m_columnMags.size() <= s1) { m_columnMags.resize(s1 + 1); @@ -2081,6 +2088,12 @@ if (mag.isSet()) { + + if (s >= m_columnMags.size()) { + std::cerr << "INTERNAL ERROR: " << s << " >= " + << m_columnMags.size() << " at SpectrogramLayer.cpp:2087" << std::endl; + } + m_columnMags[s].sample(mag); if (overallMag.sample(mag)) {