diff 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
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Apr 30 16:58:19 2008 +0000
+++ b/framework/MainWindowBase.cpp	Thu May 08 14:46:22 2008 +0000
@@ -106,7 +106,8 @@
     m_audioOutput(withAudioOutput),
     m_playSource(0),
     m_playTarget(0),
-    m_oscQueue(withOSCSupport ? new OSCQueue() : 0),
+    m_oscQueue(0),
+    m_oscQueueStarter(0),
     m_recentFiles("RecentFiles", 20),
     m_recentTransforms("RecentTransforms", 20),
     m_documentModified(false),
@@ -114,6 +115,8 @@
     m_abandoning(false),
     m_labeller(0)
 {
+    Profiler profiler("MainWindowBase::MainWindowBase");
+
     connect(CommandHistory::getInstance(), SIGNAL(commandExecuted()),
 	    this, SLOT(documentModified()));
     connect(CommandHistory::getInstance(), SIGNAL(documentRestored()),
@@ -192,13 +195,6 @@
             this,
             SLOT(preferenceChanged(PropertyContainer::PropertyName)));
 
-    if (m_oscQueue && m_oscQueue->isOK()) {
-        connect(m_oscQueue, SIGNAL(messagesAvailable()), this, SLOT(pollOSC()));
-        QTimer *oscTimer = new QTimer(this);
-        connect(oscTimer, SIGNAL(timeout()), this, SLOT(pollOSC()));
-        oscTimer->start(1000);
-    }
-
     Labeller::ValueType labellerType = Labeller::ValueFromTwoLevelCounter;
     settings.beginGroup("MainWindow");
     labellerType = (Labeller::ValueType)
@@ -208,6 +204,12 @@
 
     m_labeller = new Labeller(labellerType);
     m_labeller->setCounterCycleSize(cycle);
+
+    if (withOSCSupport) {
+        m_oscQueueStarter = new OSCQueueStarter(this);
+        connect(m_oscQueueStarter, SIGNAL(finished()), this, SLOT(oscReady()));
+        m_oscQueueStarter->start();
+    }
 }
 
 MainWindowBase::~MainWindowBase()
@@ -220,6 +222,18 @@
     Profiles::getInstance()->dump();
 }
 
+void
+MainWindowBase::oscReady()
+{
+    if (m_oscQueue && m_oscQueue->isOK()) {
+        connect(m_oscQueue, SIGNAL(messagesAvailable()), this, SLOT(pollOSC()));
+        QTimer *oscTimer = new QTimer(this);
+        connect(oscTimer, SIGNAL(timeout()), this, SLOT(pollOSC()));
+        oscTimer->start(1000);
+        std::cerr << "Finished setting up OSC interface" << std::endl;
+    }
+}
+
 QString
 MainWindowBase::getOpenFileName(FileFinder::FileType type)
 {