comparison layer/SpectrogramLayer.cpp @ 1503:2c7a480f93ca

Set maximum frequency on FFT model to reduce cache size (experimental)
author Chris Cannam
date Thu, 12 Sep 2019 11:53:40 +0100
parents 5d179afc0366
children 150d4e561b07
comparison
equal deleted inserted replaced
1502:62aad7969f8b 1503:2c7a480f93ca
870 870
871 invalidateRenderers(); 871 invalidateRenderers();
872 invalidateMagnitudes(); 872 invalidateMagnitudes();
873 873
874 m_maxFrequency = mf; 874 m_maxFrequency = mf;
875
876 if (auto fftModel = ModelById::getAs<FFTModel>(m_fftModel)) {
877 fftModel->setMaximumFrequency(m_maxFrequency);
878 }
875 879
876 emit layerParametersChanged(); 880 emit layerParametersChanged();
877 } 881 }
878 882
879 int 883 int
1418 tr("Failed to create the FFT model for this spectrogram.\n" 1422 tr("Failed to create the FFT model for this spectrogram.\n"
1419 "There may be insufficient memory or disc space to continue.")); 1423 "There may be insufficient memory or disc space to continue."));
1420 return; 1424 return;
1421 } 1425 }
1422 1426
1427 newFFTModel->setMaximumFrequency(getMaxFrequency());
1428
1423 m_fftModel = ModelById::add(newFFTModel); 1429 m_fftModel = ModelById::add(newFFTModel);
1424 1430
1425 bool createWholeCache = false; 1431 bool createWholeCache = false;
1426 checkCacheSpace(&m_peakCacheDivisor, &createWholeCache); 1432 checkCacheSpace(&m_peakCacheDivisor, &createWholeCache);
1427 1433
1791 invalidateRenderers(); 1797 invalidateRenderers();
1792 invalidateMagnitudes(); 1798 invalidateMagnitudes();
1793 1799
1794 m_minFrequency = minf; 1800 m_minFrequency = minf;
1795 m_maxFrequency = maxf; 1801 m_maxFrequency = maxf;
1802
1803 if (auto fftModel = ModelById::getAs<FFTModel>(m_fftModel)) {
1804 fftModel->setMaximumFrequency(m_maxFrequency);
1805 }
1796 1806
1797 emit layerParametersChanged(); 1807 emit layerParametersChanged();
1798 1808
1799 int vs = getCurrentVerticalZoomStep(); 1809 int vs = getCurrentVerticalZoomStep();
1800 if (vs != m_lastEmittedZoomStep) { 1810 if (vs != m_lastEmittedZoomStep) {