changeset 304:fdbb3971bafc

* more rudiments of midi->instants
author Chris Cannam
date Tue, 24 Feb 2009 17:53:01 +0000
parents 5d691489a84f
children f76efdd7d180
files main/MainWindow.cpp main/MainWindow.h
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Tue Feb 24 17:25:55 2009 +0000
+++ b/main/MainWindow.cpp	Tue Feb 24 17:53:01 2009 +0000
@@ -62,6 +62,7 @@
 #include "data/fileio/BZipFileDevice.h"
 #include "data/fileio/FileSource.h"
 #include "data/fft/FFTDataServer.h"
+#include "data/midi/MIDIInput.h"
 #include "base/RecentFiles.h"
 #include "transform/TransformFactory.h"
 #include "transform/ModelTransformerFactory.h"
@@ -282,6 +283,9 @@
     newSession();
 
     m_activityLog->show();
+
+    connect(m_midiInput, SIGNAL(eventsAvailable()),
+            this, SLOT(midiEventsAvailable()));
     
     TransformFactory::getInstance()->startPopulationThread();
 }
@@ -3400,6 +3404,18 @@
 }
 
 void
+MainWindow::midiEventsAvailable()
+{
+    //!!! for now.  but this won't do -- we are passing a signal/slot
+    //!!! connection across threads here, so timing will not be good
+    //!!! -- we do need to use the original midi event timestamp
+    MIDIEvent ev(m_midiInput->readEvent());
+    if (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON) {
+        insertInstant();
+    }
+}    
+
+void
 MainWindow::layerRemoved(Layer *layer)
 {
     setupExistingLayersMenus();
--- a/main/MainWindow.h	Tue Feb 24 17:25:55 2009 +0000
+++ b/main/MainWindow.h	Tue Feb 24 17:53:01 2009 +0000
@@ -165,6 +165,7 @@
     virtual void mouseLeftWidget();
 
     virtual void handleOSCMessage(const OSCMessage &);
+    virtual void midiEventsAvailable();
 
     virtual void website();
     virtual void help();