Mercurial > hg > svapp
changeset 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 |
files | framework/MainWindowBase.cpp framework/MainWindowBase.h |
diffstat | 2 files changed, 25 insertions(+), 9 deletions(-) [+] |
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
--- a/framework/MainWindowBase.h Tue Feb 24 17:25:55 2009 +0000 +++ b/framework/MainWindowBase.h Wed Feb 25 11:15:22 2009 +0000 @@ -27,6 +27,7 @@ #include "view/ViewManager.h" #include "base/PropertyContainer.h" #include "base/RecentFiles.h" +#include "base/FrameTimer.h" #include "layer/LayerFactory.h" #include "transform/Transform.h" #include "SVFileReader.h" @@ -69,12 +70,12 @@ * to use different subclasses retaining the same general structure. */ -class MainWindowBase : public QMainWindow +class MainWindowBase : public QMainWindow, public FrameTimer { Q_OBJECT public: - MainWindowBase(bool withAudioOutput, bool withOSCSupport); + MainWindowBase(bool withAudioOutput, bool withOSCSupport, bool withMIDIInput); virtual ~MainWindowBase(); enum AudioFileOpenMode { @@ -104,6 +105,9 @@ virtual bool saveSessionFile(QString path); + /// Implementation of FrameTimer interface method + virtual unsigned long getFrame() const; + signals: // Used to toggle the availability of menu actions void canAddPane(bool);