Mercurial > hg > svapp
changeset 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 | e54dff673096 |
children | ccdc5b30e54c |
files | framework/MainWindowBase.cpp framework/MainWindowBase.h |
diffstat | 2 files changed, 38 insertions(+), 9 deletions(-) [+] |
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) {
--- a/framework/MainWindowBase.h Wed Apr 30 16:58:19 2008 +0000 +++ b/framework/MainWindowBase.h Thu May 08 14:46:22 2008 +0000 @@ -21,6 +21,7 @@ #include <QUrl> #include <QMainWindow> #include <QPointer> +#include <QThread> #include "base/Command.h" #include "view/ViewManager.h" @@ -31,6 +32,7 @@ #include "SVFileReader.h" #include "widgets/FileFinder.h" #include "data/fileio/FileSource.h" +#include "data/osc/OSCQueue.h" #include <map> class Document; @@ -52,7 +54,6 @@ class PreferencesDialog; class QTreeView; class QPushButton; -class OSCQueue; class OSCMessage; class KeyReference; class Labeller; @@ -238,6 +239,7 @@ virtual void paneDropAccepted(Pane *, QString) = 0; virtual void paneDeleteButtonClicked(Pane *); + virtual void oscReady(); virtual void pollOSC(); virtual void handleOSCMessage(const OSCMessage &) = 0; @@ -260,7 +262,20 @@ AudioCallbackPlaySource *m_playSource; AudioCallbackPlayTarget *m_playTarget; + class OSCQueueStarter : public QThread + { + public: + OSCQueueStarter(MainWindowBase *mwb) : QThread(mwb), m_mwb(mwb) { } + virtual void run() { + OSCQueue *queue = new OSCQueue(); // can take a long time + m_mwb->m_oscQueue = queue; + } + private: + MainWindowBase *m_mwb; + }; + OSCQueue *m_oscQueue; + OSCQueueStarter *m_oscQueueStarter; RecentFiles m_recentFiles; RecentFiles m_recentTransforms;