comparison 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
comparison
equal deleted inserted replaced
160:64b09e5bda21 161:f90e277d2876
101 using std::vector; 101 using std::vector;
102 using std::map; 102 using std::map;
103 using std::set; 103 using std::set;
104 104
105 105
106 MainWindowBase::MainWindowBase(bool withAudioOutput, bool withOSCSupport) : 106 MainWindowBase::MainWindowBase(bool withAudioOutput,
107 bool withOSCSupport,
108 bool withMIDIInput) :
107 m_document(0), 109 m_document(0),
108 m_paneStack(0), 110 m_paneStack(0),
109 m_viewManager(0), 111 m_viewManager(0),
110 m_timeRulerLayer(0), 112 m_timeRulerLayer(0),
111 m_audioOutput(withAudioOutput), 113 m_audioOutput(withAudioOutput),
212 settings.endGroup(); 214 settings.endGroup();
213 215
214 m_labeller = new Labeller(labellerType); 216 m_labeller = new Labeller(labellerType);
215 m_labeller->setCounterCycleSize(cycle); 217 m_labeller->setCounterCycleSize(cycle);
216 218
217 m_midiInput = new MIDIInput(QApplication::applicationName()); 219 if (withMIDIInput) {
220 m_midiInput = new MIDIInput(QApplication::applicationName(), this);
221 }
218 222
219 if (withOSCSupport) { 223 if (withOSCSupport) {
220 m_oscQueueStarter = new OSCQueueStarter(this); 224 m_oscQueueStarter = new OSCQueueStarter(this);
221 connect(m_oscQueueStarter, SIGNAL(finished()), this, SLOT(oscReady())); 225 connect(m_oscQueueStarter, SIGNAL(finished()), this, SLOT(oscReady()));
222 m_oscQueueStarter->start(); 226 m_oscQueueStarter->start();
708 } 712 }
709 } 713 }
710 } 714 }
711 } 715 }
712 716
717 // FrameTimer method
718
719 unsigned long
720 MainWindowBase::getFrame() const
721 {
722 if (m_playSource && m_playSource->isPlaying()) {
723 return m_playSource->getCurrentPlayingFrame();
724 } else {
725 return m_viewManager->getPlaybackFrame();
726 }
727 }
728
713 void 729 void
714 MainWindowBase::insertInstant() 730 MainWindowBase::insertInstant()
715 { 731 {
716 if (m_playSource && m_playSource->isPlaying()) { 732 insertInstantAt(getFrame());
717 insertInstantAt(m_playSource->getCurrentPlayingFrame());
718 } else {
719 insertInstantAt(m_viewManager->getPlaybackFrame());
720 }
721 } 733 }
722 734
723 void 735 void
724 MainWindowBase::insertInstantsAtBoundaries() 736 MainWindowBase::insertInstantsAtBoundaries()
725 { 737 {