diff framework/MainWindowBase.cpp @ 161:f90e277d2876

* Somewhat better MIDI-based time instant timing
author Chris Cannam
date Wed, 25 Feb 2009 11:15:22 +0000
parents 64b09e5bda21
children c17284397aa9
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Tue Feb 24 17:25:55 2009 +0000
+++ b/framework/MainWindowBase.cpp	Wed Feb 25 11:15:22 2009 +0000
@@ -103,7 +103,9 @@
 using std::set;
 
 
-MainWindowBase::MainWindowBase(bool withAudioOutput, bool withOSCSupport) :
+MainWindowBase::MainWindowBase(bool withAudioOutput,
+                               bool withOSCSupport,
+                               bool withMIDIInput) :
     m_document(0),
     m_paneStack(0),
     m_viewManager(0),
@@ -214,7 +216,9 @@
     m_labeller = new Labeller(labellerType);
     m_labeller->setCounterCycleSize(cycle);
 
-    m_midiInput = new MIDIInput(QApplication::applicationName());
+    if (withMIDIInput) {
+        m_midiInput = new MIDIInput(QApplication::applicationName(), this);
+    }
 
     if (withOSCSupport) {
         m_oscQueueStarter = new OSCQueueStarter(this);
@@ -710,14 +714,22 @@
     }
 }
 
+// FrameTimer method
+
+unsigned long
+MainWindowBase::getFrame() const
+{
+    if (m_playSource && m_playSource->isPlaying()) {
+        return m_playSource->getCurrentPlayingFrame();
+    } else {
+        return m_viewManager->getPlaybackFrame();
+    }
+}    
+
 void
 MainWindowBase::insertInstant()
 {
-    if (m_playSource && m_playSource->isPlaying()) {
-        insertInstantAt(m_playSource->getCurrentPlayingFrame());
-    } else {
-        insertInstantAt(m_viewManager->getPlaybackFrame());
-    }
+    insertInstantAt(getFrame());
 }
 
 void