Mercurial > hg > svgui
comparison layer/SpectrumLayer.cpp @ 1389:1eb560b363e7 spectrogramparam
Make "zoom to region" work sensibly for slice/spectrum layers; ensure that min/max bin are remapped properly when changing fft size
author | Chris Cannam |
---|---|
date | Tue, 13 Nov 2018 14:06:48 +0000 |
parents | bca9870301b7 |
children | c39f2d439d59 |
comparison
equal
deleted
inserted
replaced
1388:81dda64a7edc | 1389:1eb560b363e7 |
---|---|
285 | 285 |
286 void | 286 void |
287 SpectrumLayer::setWindowSize(int ws) | 287 SpectrumLayer::setWindowSize(int ws) |
288 { | 288 { |
289 if (m_windowSize == ws) return; | 289 if (m_windowSize == ws) return; |
290 | |
291 SVDEBUG << "setWindowSize: from " << m_windowSize | |
292 << " to " << ws << ": updating min and max bins from " | |
293 << m_minbin << " and " << m_maxbin << " to "; | |
294 | |
295 m_minbin = int(round((double(m_minbin) / m_windowSize) * ws)); | |
296 m_maxbin = int(round((double(m_maxbin) / m_windowSize) * ws)); | |
297 | |
298 SVDEBUG << m_minbin << " and " << m_maxbin << endl; | |
299 | |
290 m_windowSize = ws; | 300 m_windowSize = ws; |
291 m_newFFTNeeded = true; | 301 m_newFFTNeeded = true; |
292 emit layerParametersChanged(); | 302 emit layerParametersChanged(); |
293 } | 303 } |
294 | 304 |
312 | 322 |
313 void | 323 void |
314 SpectrumLayer::setOversampling(int oversampling) | 324 SpectrumLayer::setOversampling(int oversampling) |
315 { | 325 { |
316 if (m_oversampling == oversampling) return; | 326 if (m_oversampling == oversampling) return; |
327 | |
328 SVDEBUG << "setOversampling: from " << m_oversampling | |
329 << " to " << oversampling << ": updating min and max bins from " | |
330 << m_minbin << " and " << m_maxbin << " to "; | |
331 | |
332 m_minbin = int(round((double(m_minbin) / m_oversampling) * oversampling)); | |
333 m_maxbin = int(round((double(m_maxbin) / m_oversampling) * oversampling)); | |
334 | |
335 SVDEBUG << m_minbin << " and " << m_maxbin << endl; | |
336 | |
317 m_oversampling = oversampling; | 337 m_oversampling = oversampling; |
318 m_newFFTNeeded = true; | 338 m_newFFTNeeded = true; |
339 | |
319 emit layerParametersChanged(); | 340 emit layerParametersChanged(); |
320 } | 341 } |
321 | 342 |
322 int | 343 int |
323 SpectrumLayer::getOversampling() const | 344 SpectrumLayer::getOversampling() const |