Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 29:9f55af9676b4
* Add ffwd/rewind
* Abstract out MultiSelection
author | Chris Cannam |
---|---|
date | Wed, 08 Feb 2006 17:59:16 +0000 |
parents | 202d1dca67d2 |
children | fc802f7b112e |
comparison
equal
deleted
inserted
replaced
28:202d1dca67d2 | 29:9f55af9676b4 |
---|---|
47 m_pixmapCache(0), | 47 m_pixmapCache(0), |
48 m_pixmapCacheInvalid(true), | 48 m_pixmapCacheInvalid(true), |
49 m_fillThread(0), | 49 m_fillThread(0), |
50 m_updateTimer(0), | 50 m_updateTimer(0), |
51 m_lastFillExtent(0), | 51 m_lastFillExtent(0), |
52 m_dormant(false), | |
52 m_exiting(false) | 53 m_exiting(false) |
53 { | 54 { |
54 if (config == MelodicRange) { | 55 if (config == MelodicRange) { |
55 setWindowSize(8192); | 56 setWindowSize(8192); |
56 setWindowOverlap(90); | 57 setWindowOverlap(90); |
589 | 590 |
590 SpectrogramLayer::FrequencyScale | 591 SpectrogramLayer::FrequencyScale |
591 SpectrogramLayer::getFrequencyScale() const | 592 SpectrogramLayer::getFrequencyScale() const |
592 { | 593 { |
593 return m_frequencyScale; | 594 return m_frequencyScale; |
595 } | |
596 | |
597 void | |
598 SpectrogramLayer::setLayerDormant() | |
599 { | |
600 m_mutex.lock(); | |
601 m_dormant = true; | |
602 delete m_cache; | |
603 m_cache = 0; | |
604 m_pixmapCacheInvalid = true; | |
605 delete m_pixmapCache; | |
606 m_pixmapCache = 0; | |
607 m_mutex.unlock(); | |
594 } | 608 } |
595 | 609 |
596 void | 610 void |
597 SpectrogramLayer::cacheInvalid() | 611 SpectrogramLayer::cacheInvalid() |
598 { | 612 { |
864 | 878 |
865 bool interrupted = false; | 879 bool interrupted = false; |
866 | 880 |
867 // std::cerr << "SpectrogramLayer::CacheFillThread::run in loop" << std::endl; | 881 // std::cerr << "SpectrogramLayer::CacheFillThread::run in loop" << std::endl; |
868 | 882 |
869 if (m_layer.m_model && m_layer.m_cacheInvalid) { | 883 if (m_layer.m_model && m_layer.m_cacheInvalid && !m_layer.m_dormant) { |
870 | 884 |
871 // std::cerr << "SpectrogramLayer::CacheFillThread::run: something to do" << std::endl; | 885 // std::cerr << "SpectrogramLayer::CacheFillThread::run: something to do" << std::endl; |
872 | 886 |
873 while (!m_layer.m_model->isReady()) { | 887 while (!m_layer.m_model->isReady()) { |
874 m_layer.m_condition.wait(&m_layer.m_mutex, 100); | 888 m_layer.m_condition.wait(&m_layer.m_mutex, 100); |
1217 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1231 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1218 std::cerr << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << m_view->getZoomLevel() << ", m_updateTimer " << m_updateTimer << ", pixmap cache invalid " << m_pixmapCacheInvalid << std::endl; | 1232 std::cerr << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << m_view->getZoomLevel() << ", m_updateTimer " << m_updateTimer << ", pixmap cache invalid " << m_pixmapCacheInvalid << std::endl; |
1219 #endif | 1233 #endif |
1220 | 1234 |
1221 if (!m_model || !m_model->isOK() || !m_model->isReady()) { | 1235 if (!m_model || !m_model->isOK() || !m_model->isReady()) { |
1236 return; | |
1237 } | |
1238 | |
1239 if (m_dormant) { | |
1240 std::cerr << "SpectrogramLayer::paint(): Layer is dormant, de-hibernating" << std::endl; | |
1241 m_dormant = false; | |
1242 ((SpectrogramLayer *)this)->fillCache(); | |
1222 return; | 1243 return; |
1223 } | 1244 } |
1224 | 1245 |
1225 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1246 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1226 std::cerr << "SpectrogramLayer::paint(): About to lock" << std::endl; | 1247 std::cerr << "SpectrogramLayer::paint(): About to lock" << std::endl; |