Mercurial > hg > svgui
diff layer/SliceLayer.cpp @ 1403:10e768adaee5
Retain consistent min freq (rather than min bin no) when changing fft parameters in spectrum; scale ffts by window size rather than fft size in case of oversampling, to avoid fading out because of scale factor including zero padding
author | Chris Cannam |
---|---|
date | Thu, 15 Nov 2018 15:08:08 +0000 |
parents | 28075cc658c9 |
children | c8a6fd3f9dff |
line wrap: on
line diff
--- a/layer/SliceLayer.cpp Thu Nov 15 14:18:26 2018 +0000 +++ b/layer/SliceLayer.cpp Thu Nov 15 15:08:08 2018 +0000 @@ -1203,7 +1203,23 @@ m_minbin = int(lrint(min)); m_maxbin = int(lrint(max)); - + + if (m_minbin < 0) { + m_minbin = 0; + } + if (m_maxbin < 0) { + m_maxbin = 0; + } + if (m_minbin > m_sliceableModel->getHeight()) { + m_minbin = m_sliceableModel->getHeight(); + } + if (m_maxbin > m_sliceableModel->getHeight()) { + m_maxbin = m_sliceableModel->getHeight(); + } + if (m_maxbin < m_minbin) { + m_maxbin = m_minbin; + } + emit layerParametersChanged(); return true; } @@ -1238,14 +1254,9 @@ int dist = m_sliceableModel->getHeight() - step; if (dist < 1) dist = 1; double centre = m_minbin + (m_maxbin - m_minbin) / 2.0; - m_minbin = int(lrint(centre - dist/2.0)); - if (m_minbin < 0) m_minbin = 0; - m_maxbin = m_minbin + dist; - if (m_maxbin > m_sliceableModel->getHeight()) m_maxbin = m_sliceableModel->getHeight(); - -// SVDEBUG << "SliceLayer::setVerticalZoomStep(" <<step <<"): after: minbin = " << m_minbin << ", maxbin = " << m_maxbin << endl; - - emit layerParametersChanged(); + int minbin = int(lrint(centre - dist/2.0)); + int maxbin = minbin + dist; + setDisplayExtents(minbin, maxbin); } RangeMapper *