comparison data/midi/MIDIInput.h @ 567:e6d35670e1df

* Somewhat better MIDI-based time instant timing
author Chris Cannam
date Wed, 25 Feb 2009 11:15:22 +0000
parents ecce042cc374
children 59e7fe1b1003
comparison
equal deleted inserted replaced
566:e2281de2361c 567:e6d35670e1df
19 #include <QObject> 19 #include <QObject>
20 #include "MIDIEvent.h" 20 #include "MIDIEvent.h"
21 21
22 #include <vector> 22 #include <vector>
23 #include "base/RingBuffer.h" 23 #include "base/RingBuffer.h"
24 #include "base/FrameTimer.h"
24 25
25 class RtMidiIn; 26 class RtMidiIn;
26 27
27 class MIDIInput : public QObject 28 class MIDIInput : public QObject
28 { 29 {
29 Q_OBJECT 30 Q_OBJECT
30 31
31 public: 32 public:
32 MIDIInput(QString name); 33 MIDIInput(QString name, FrameTimer *timer);
33 virtual ~MIDIInput(); 34 virtual ~MIDIInput();
34 35
35 bool isOK() const { return m_rtmidi != 0; } 36 bool isOK() const { return m_rtmidi != 0; }
36 37
37 bool isEmpty() const { return getEventsAvailable() == 0; } 38 bool isEmpty() const { return getEventsAvailable() == 0; }
41 signals: 42 signals:
42 void eventsAvailable(); 43 void eventsAvailable();
43 44
44 protected: 45 protected:
45 RtMidiIn *m_rtmidi; 46 RtMidiIn *m_rtmidi;
47 FrameTimer *m_frameTimer;
46 48
47 static void staticCallback(double, std::vector<unsigned char> *, void *); 49 static void staticCallback(double, std::vector<unsigned char> *, void *);
48 void callback(double, std::vector<unsigned char> *); 50 void callback(double, std::vector<unsigned char> *);
49 51
50 void postEvent(MIDIEvent); 52 void postEvent(MIDIEvent);