changeset 566:e2281de2361c

* more rudiments of midi->instants
author Chris Cannam
date Tue, 24 Feb 2009 17:53:01 +0000
parents 3086876472dc
children e6d35670e1df
files data/midi/MIDIInput.cpp
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/data/midi/MIDIInput.cpp	Tue Feb 24 17:25:55 2009 +0000
+++ b/data/midi/MIDIInput.cpp	Tue Feb 24 17:53:01 2009 +0000
@@ -48,7 +48,14 @@
 MIDIInput::callback(double timestamp, std::vector<unsigned char> *message)
 {
     std::cerr << "MIDIInput::callback(" << timestamp << ")" << std::endl;
-
+    unsigned long deltaTime = 0;
+    if (timestamp > 0) deltaTime = (unsigned long)(timestamp * 100000); //!!! for now!
+    if (!message || message->empty()) return;
+    MIDIEvent ev(deltaTime,
+                 (*message)[0],
+                 message->size() > 1 ? (*message)[1] : 0,
+                 message->size() > 2 ? (*message)[2] : 0);
+    postEvent(ev);
 }
 
 MIDIEvent