comparison framework/MainWindowBase.cpp @ 113:0c1ea5ff6518

* Speed up spectrogram painting by releasing mutex in FFTDataServer while calculating data prior to writing it, and by adding whole-column value query methods to FFT objects * Add paint cache to Thumbwheel -- repaints of this widget were slowing down the whole spectrogram repaint * More uses of MutexLocker (named and with debug) and more profile points * Make startup much quicker some of the time, with OSC server in place
author Chris Cannam
date Thu, 08 May 2008 14:46:22 +0000
parents 2dd30a7cd21a
children 087662afe778
comparison
equal deleted inserted replaced
112:e54dff673096 113:0c1ea5ff6518
104 m_viewManager(0), 104 m_viewManager(0),
105 m_timeRulerLayer(0), 105 m_timeRulerLayer(0),
106 m_audioOutput(withAudioOutput), 106 m_audioOutput(withAudioOutput),
107 m_playSource(0), 107 m_playSource(0),
108 m_playTarget(0), 108 m_playTarget(0),
109 m_oscQueue(withOSCSupport ? new OSCQueue() : 0), 109 m_oscQueue(0),
110 m_oscQueueStarter(0),
110 m_recentFiles("RecentFiles", 20), 111 m_recentFiles("RecentFiles", 20),
111 m_recentTransforms("RecentTransforms", 20), 112 m_recentTransforms("RecentTransforms", 20),
112 m_documentModified(false), 113 m_documentModified(false),
113 m_openingAudioFile(false), 114 m_openingAudioFile(false),
114 m_abandoning(false), 115 m_abandoning(false),
115 m_labeller(0) 116 m_labeller(0)
116 { 117 {
118 Profiler profiler("MainWindowBase::MainWindowBase");
119
117 connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()), 120 connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()),
118 this, SLOT(documentModified())); 121 this, SLOT(documentModified()));
119 connect(CommandHistory::getInstance(), SIGNAL(documentRestored()), 122 connect(CommandHistory::getInstance(), SIGNAL(documentRestored()),
120 this, SLOT(documentRestored())); 123 this, SLOT(documentRestored()));
121 124
190 connect(Preferences::getInstance(), 193 connect(Preferences::getInstance(),
191 SIGNAL(propertyChanged(PropertyContainer::PropertyName)), 194 SIGNAL(propertyChanged(PropertyContainer::PropertyName)),
192 this, 195 this,
193 SLOT(preferenceChanged(PropertyContainer::PropertyName))); 196 SLOT(preferenceChanged(PropertyContainer::PropertyName)));
194 197
195 if (m_oscQueue && m_oscQueue->isOK()) {
196 connect(m_oscQueue, SIGNAL(messagesAvailable()), this, SLOT(pollOSC()));
197 QTimer *oscTimer = new QTimer(this);
198 connect(oscTimer, SIGNAL(timeout()), this, SLOT(pollOSC()));
199 oscTimer->start(1000);
200 }
201
202 Labeller::ValueType labellerType = Labeller::ValueFromTwoLevelCounter; 198 Labeller::ValueType labellerType = Labeller::ValueFromTwoLevelCounter;
203 settings.beginGroup("MainWindow"); 199 settings.beginGroup("MainWindow");
204 labellerType = (Labeller::ValueType) 200 labellerType = (Labeller::ValueType)
205 settings.value("labellertype", (int)labellerType).toInt(); 201 settings.value("labellertype", (int)labellerType).toInt();
206 int cycle = settings.value("labellercycle", 4).toInt(); 202 int cycle = settings.value("labellercycle", 4).toInt();
207 settings.endGroup(); 203 settings.endGroup();
208 204
209 m_labeller = new Labeller(labellerType); 205 m_labeller = new Labeller(labellerType);
210 m_labeller->setCounterCycleSize(cycle); 206 m_labeller->setCounterCycleSize(cycle);
207
208 if (withOSCSupport) {
209 m_oscQueueStarter = new OSCQueueStarter(this);
210 connect(m_oscQueueStarter, SIGNAL(finished()), this, SLOT(oscReady()));
211 m_oscQueueStarter->start();
212 }
211 } 213 }
212 214
213 MainWindowBase::~MainWindowBase() 215 MainWindowBase::~MainWindowBase()
214 { 216 {
215 if (m_playTarget) m_playTarget->shutdown(); 217 if (m_playTarget) m_playTarget->shutdown();
216 // delete m_playTarget; 218 // delete m_playTarget;
217 delete m_playSource; 219 delete m_playSource;
218 delete m_viewManager; 220 delete m_viewManager;
219 delete m_oscQueue; 221 delete m_oscQueue;
220 Profiles::getInstance()->dump(); 222 Profiles::getInstance()->dump();
223 }
224
225 void
226 MainWindowBase::oscReady()
227 {
228 if (m_oscQueue && m_oscQueue->isOK()) {
229 connect(m_oscQueue, SIGNAL(messagesAvailable()), this, SLOT(pollOSC()));
230 QTimer *oscTimer = new QTimer(this);
231 connect(oscTimer, SIGNAL(timeout()), this, SLOT(pollOSC()));
232 oscTimer->start(1000);
233 std::cerr << "Finished setting up OSC interface" << std::endl;
234 }
221 } 235 }
222 236
223 QString 237 QString
224 MainWindowBase::getOpenFileName(FileFinder::FileType type) 238 MainWindowBase::getOpenFileName(FileFinder::FileType type)
225 { 239 {