Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
1402:b0eeec95ab5b | 1403:10e768adaee5 |
---|---|
1201 { | 1201 { |
1202 if (!m_sliceableModel) return false; | 1202 if (!m_sliceableModel) return false; |
1203 | 1203 |
1204 m_minbin = int(lrint(min)); | 1204 m_minbin = int(lrint(min)); |
1205 m_maxbin = int(lrint(max)); | 1205 m_maxbin = int(lrint(max)); |
1206 | 1206 |
1207 if (m_minbin < 0) { | |
1208 m_minbin = 0; | |
1209 } | |
1210 if (m_maxbin < 0) { | |
1211 m_maxbin = 0; | |
1212 } | |
1213 if (m_minbin > m_sliceableModel->getHeight()) { | |
1214 m_minbin = m_sliceableModel->getHeight(); | |
1215 } | |
1216 if (m_maxbin > m_sliceableModel->getHeight()) { | |
1217 m_maxbin = m_sliceableModel->getHeight(); | |
1218 } | |
1219 if (m_maxbin < m_minbin) { | |
1220 m_maxbin = m_minbin; | |
1221 } | |
1222 | |
1207 emit layerParametersChanged(); | 1223 emit layerParametersChanged(); |
1208 return true; | 1224 return true; |
1209 } | 1225 } |
1210 | 1226 |
1211 int | 1227 int |
1236 // SVDEBUG << "SliceLayer::setVerticalZoomStep(" <<step <<"): before: minbin = " << m_minbin << ", maxbin = " << m_maxbin << endl; | 1252 // SVDEBUG << "SliceLayer::setVerticalZoomStep(" <<step <<"): before: minbin = " << m_minbin << ", maxbin = " << m_maxbin << endl; |
1237 | 1253 |
1238 int dist = m_sliceableModel->getHeight() - step; | 1254 int dist = m_sliceableModel->getHeight() - step; |
1239 if (dist < 1) dist = 1; | 1255 if (dist < 1) dist = 1; |
1240 double centre = m_minbin + (m_maxbin - m_minbin) / 2.0; | 1256 double centre = m_minbin + (m_maxbin - m_minbin) / 2.0; |
1241 m_minbin = int(lrint(centre - dist/2.0)); | 1257 int minbin = int(lrint(centre - dist/2.0)); |
1242 if (m_minbin < 0) m_minbin = 0; | 1258 int maxbin = minbin + dist; |
1243 m_maxbin = m_minbin + dist; | 1259 setDisplayExtents(minbin, maxbin); |
1244 if (m_maxbin > m_sliceableModel->getHeight()) m_maxbin = m_sliceableModel->getHeight(); | |
1245 | |
1246 // SVDEBUG << "SliceLayer::setVerticalZoomStep(" <<step <<"): after: minbin = " << m_minbin << ", maxbin = " << m_maxbin << endl; | |
1247 | |
1248 emit layerParametersChanged(); | |
1249 } | 1260 } |
1250 | 1261 |
1251 RangeMapper * | 1262 RangeMapper * |
1252 SliceLayer::getNewVerticalZoomRangeMapper() const | 1263 SliceLayer::getNewVerticalZoomRangeMapper() const |
1253 { | 1264 { |