comparison data/midi/MIDIInput.cpp @ 566:e2281de2361c

* more rudiments of midi->instants
author Chris Cannam
date Tue, 24 Feb 2009 17:53:01 +0000
parents 3086876472dc
children e6d35670e1df
comparison
equal deleted inserted replaced
565:3086876472dc 566:e2281de2361c
46 46
47 void 47 void
48 MIDIInput::callback(double timestamp, std::vector<unsigned char> *message) 48 MIDIInput::callback(double timestamp, std::vector<unsigned char> *message)
49 { 49 {
50 std::cerr << "MIDIInput::callback(" << timestamp << ")" << std::endl; 50 std::cerr << "MIDIInput::callback(" << timestamp << ")" << std::endl;
51 51 unsigned long deltaTime = 0;
52 if (timestamp > 0) deltaTime = (unsigned long)(timestamp * 100000); //!!! for now!
53 if (!message || message->empty()) return;
54 MIDIEvent ev(deltaTime,
55 (*message)[0],
56 message->size() > 1 ? (*message)[1] : 0,
57 message->size() > 2 ? (*message)[2] : 0);
58 postEvent(ev);
52 } 59 }
53 60
54 MIDIEvent 61 MIDIEvent
55 MIDIInput::readEvent() 62 MIDIInput::readEvent()
56 { 63 {