Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 250:3fe622570b35 sv1-v1.0
* Fix #1712589 Reset button for thumbwheels not working properly
author | Chris Cannam |
---|---|
date | Fri, 04 May 2007 19:01:13 +0000 |
parents | 28c8e8e3c537 |
children | 8d89f8869cfb |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Mon Apr 30 14:06:45 2007 +0000 +++ b/layer/SpectrogramLayer.cpp Fri May 04 19:01:13 2007 +0000 @@ -2928,10 +2928,13 @@ // int maxStep = mapper.getPositionForValue((float(sr) / m_fftSize) + 0.001); int maxStep = mapper.getPositionForValue(0); int minStep = mapper.getPositionForValue(float(sr) / 2); - - defaultStep = mapper.getPositionForValue(m_initialMaxFrequency) - minStep; - -// std::cerr << "SpectrogramLayer::getVerticalZoomSteps: " << maxStep - minStep << " (" << maxStep <<"-" << minStep << "), default is " << defaultStep << " (from initial max freq " << m_initialMaxFrequency << ")" << std::endl; + + size_t initialMax = m_initialMaxFrequency; + if (initialMax == 0) initialMax = sr / 2; + + defaultStep = mapper.getPositionForValue(initialMax) - minStep; + +// std::cerr << "SpectrogramLayer::getVerticalZoomSteps: " << maxStep - minStep << " (" << maxStep <<"-" << minStep << "), default is " << defaultStep << " (from initial max freq " << initialMax << ")" << std::endl; return maxStep - minStep; }