Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 1481:e540aa5d89cd by-id
Update for removal of (public) getId from Model
author | Chris Cannam |
---|---|
date | Fri, 05 Jul 2019 15:34:50 +0100 |
parents | 886c1cd48f9d |
children | 5d179afc0366 |
comparison
equal
deleted
inserted
replaced
1480:232262e38051 | 1481:e540aa5d89cd |
---|---|
213 if (newModel) { | 213 if (newModel) { |
214 recreateFFTModel(); | 214 recreateFFTModel(); |
215 | 215 |
216 connectSignals(m_model); | 216 connectSignals(m_model); |
217 | 217 |
218 connect(newModel.get(), SIGNAL(modelChanged()), | 218 connect(newModel.get(), |
219 this, SLOT(cacheInvalid())); | 219 SIGNAL(modelChanged(ModelId)), |
220 connect(newModel.get(), SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), | 220 this, SLOT(cacheInvalid(ModelId))); |
221 this, SLOT(cacheInvalid(sv_frame_t, sv_frame_t))); | 221 connect(newModel.get(), |
222 SIGNAL(modelChangedWithin(ModelId, sv_frame_t, sv_frame_t)), | |
223 this, SLOT(cacheInvalid(ModelId, sv_frame_t, sv_frame_t))); | |
222 } | 224 } |
223 | 225 |
224 emit modelReplaced(); | 226 emit modelReplaced(); |
225 } | 227 } |
226 | 228 |
1056 // us and we just fill in | 1058 // us and we just fill in |
1057 return false; | 1059 return false; |
1058 } | 1060 } |
1059 | 1061 |
1060 void | 1062 void |
1061 SpectrogramLayer::cacheInvalid() | 1063 SpectrogramLayer::cacheInvalid(ModelId) |
1062 { | 1064 { |
1063 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1065 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1064 cerr << "SpectrogramLayer::cacheInvalid()" << endl; | 1066 cerr << "SpectrogramLayer::cacheInvalid()" << endl; |
1065 #endif | 1067 #endif |
1066 | 1068 |
1068 invalidateMagnitudes(); | 1070 invalidateMagnitudes(); |
1069 } | 1071 } |
1070 | 1072 |
1071 void | 1073 void |
1072 SpectrogramLayer::cacheInvalid( | 1074 SpectrogramLayer::cacheInvalid( |
1075 ModelId, | |
1073 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1076 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1074 sv_frame_t from, sv_frame_t to | 1077 sv_frame_t from, sv_frame_t to |
1075 #else | 1078 #else |
1076 sv_frame_t , sv_frame_t | 1079 sv_frame_t , sv_frame_t |
1077 #endif | 1080 #endif |
1415 tr("Failed to create the FFT model for this spectrogram.\n" | 1418 tr("Failed to create the FFT model for this spectrogram.\n" |
1416 "There may be insufficient memory or disc space to continue.")); | 1419 "There may be insufficient memory or disc space to continue.")); |
1417 return; | 1420 return; |
1418 } | 1421 } |
1419 | 1422 |
1420 ModelById::add(newFFTModel); | 1423 m_fftModel = ModelById::add(newFFTModel); |
1421 m_fftModel = newFFTModel->getId(); | |
1422 | 1424 |
1423 bool createWholeCache = false; | 1425 bool createWholeCache = false; |
1424 checkCacheSpace(&m_peakCacheDivisor, &createWholeCache); | 1426 checkCacheSpace(&m_peakCacheDivisor, &createWholeCache); |
1425 | 1427 |
1426 if (createWholeCache) { | 1428 if (createWholeCache) { |
1427 | 1429 |
1428 auto whole = std::make_shared<Dense3DModelPeakCache>(m_fftModel, 1); | 1430 auto whole = std::make_shared<Dense3DModelPeakCache>(m_fftModel, 1); |
1429 ModelById::add(whole); | 1431 m_wholeCache = ModelById::add(whole); |
1430 m_wholeCache = whole->getId(); | |
1431 | 1432 |
1432 auto peaks = std::make_shared<Dense3DModelPeakCache>(m_wholeCache, | 1433 auto peaks = std::make_shared<Dense3DModelPeakCache>(m_wholeCache, |
1433 m_peakCacheDivisor); | 1434 m_peakCacheDivisor); |
1434 ModelById::add(peaks); | 1435 m_peakCache = ModelById::add(peaks); |
1435 m_peakCache = peaks->getId(); | |
1436 | 1436 |
1437 } else { | 1437 } else { |
1438 | 1438 |
1439 auto peaks = std::make_shared<Dense3DModelPeakCache>(m_fftModel, | 1439 auto peaks = std::make_shared<Dense3DModelPeakCache>(m_fftModel, |
1440 m_peakCacheDivisor); | 1440 m_peakCacheDivisor); |
1441 ModelById::add(peaks); | 1441 m_peakCache = ModelById::add(peaks); |
1442 m_peakCache = peaks->getId(); | |
1443 } | 1442 } |
1444 } | 1443 } |
1445 | 1444 |
1446 void | 1445 void |
1447 SpectrogramLayer::checkCacheSpace(int *suggestedPeakDivisor, | 1446 SpectrogramLayer::checkCacheSpace(int *suggestedPeakDivisor, |