changeset 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 e6d0b097d102
children 948a3b05798b
files layer/SpectrogramLayer.cpp
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
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;
 }