Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 203:258af0c4dc28
* Fix crash in short spectrogram paint
* Fix incorrect apparent end point for waveforms
author | Chris Cannam |
---|---|
date | Wed, 14 Feb 2007 17:52:06 +0000 |
parents | 45e995ed84d9 |
children | b6af2eb00780 |
comparison
equal
deleted
inserted
replaced
202:cec1f78fbfca | 203:258af0c4dc28 |
---|---|
1627 MagnitudeRange mag; | 1627 MagnitudeRange mag; |
1628 | 1628 |
1629 int x0 = 0, x1 = v->width(); | 1629 int x0 = 0, x1 = v->width(); |
1630 float s00 = 0, s01 = 0, s10 = 0, s11 = 0; | 1630 float s00 = 0, s01 = 0, s10 = 0, s11 = 0; |
1631 | 1631 |
1632 getXBinRange(v, x0, s00, s01); | 1632 if (!getXBinRange(v, x0, s00, s01)) { |
1633 getXBinRange(v, x1, s10, s11); | 1633 s00 = s01 = m_model->getStartFrame() / getWindowIncrement(); |
1634 } | |
1635 | |
1636 if (!getXBinRange(v, x1, s10, s11)) { | |
1637 s10 = s11 = m_model->getEndFrame() / getWindowIncrement(); | |
1638 } | |
1634 | 1639 |
1635 int s0 = int(std::min(s00, s10) + 0.0001); | 1640 int s0 = int(std::min(s00, s10) + 0.0001); |
1636 int s1 = int(std::max(s01, s11)); | 1641 int s1 = int(std::max(s01, s11) + 0.0001); |
1642 | |
1643 // std::cerr << "SpectrogramLayer::updateViewMagnitudes: x0 = " << x0 << ", x1 = " << x1 << ", s00 = " << s00 << ", s11 = " << s11 << " s0 = " << s0 << ", s1 = " << s1 << std::endl; | |
1637 | 1644 |
1638 if (m_columnMags.size() <= s1) { | 1645 if (m_columnMags.size() <= s1) { |
1639 m_columnMags.resize(s1 + 1); | 1646 m_columnMags.resize(s1 + 1); |
1640 } | 1647 } |
1641 | 1648 |
2079 } | 2086 } |
2080 } | 2087 } |
2081 | 2088 |
2082 if (mag.isSet()) { | 2089 if (mag.isSet()) { |
2083 | 2090 |
2091 | |
2092 if (s >= m_columnMags.size()) { | |
2093 std::cerr << "INTERNAL ERROR: " << s << " >= " | |
2094 << m_columnMags.size() << " at SpectrogramLayer.cpp:2087" << std::endl; | |
2095 } | |
2096 | |
2084 m_columnMags[s].sample(mag); | 2097 m_columnMags[s].sample(mag); |
2085 | 2098 |
2086 if (overallMag.sample(mag)) { | 2099 if (overallMag.sample(mag)) { |
2087 //!!! scaling would change here | 2100 //!!! scaling would change here |
2088 overallMagChanged = true; | 2101 overallMagChanged = true; |