23
28
MPEventList _stuckNotes;
24
29
MPEventList _playEvents;
25
30
iMPEvent _nextPlayEvent;
26
MREventList _recordEvents;
27
MREventList _recordEvents2;
31
///MREventList _recordEvents;
32
///MREventList _recordEvents2;
34
// Used for multiple reads of fifos during process.
35
//int _tmpRecordCount;
36
int _tmpRecordCount[MIDI_CHANNELS + 1];
37
bool _sysexFIFOProcessed;
39
///bool _recBufFlipped;
29
40
// Holds sync settings and detection monitors.
30
41
//MidiSyncInfo _syncInfo;
36
47
int _openFlags; // configured open flags
37
48
bool _readEnable; // set when opened/closed.
38
49
bool _writeEnable; //
50
//int _sysexWriteChunk;
51
//int _sysexReadChunk;
52
//bool _sysexWritingChunks;
53
bool _sysexReadingChunks;
56
//MidiFifo _recordFifo;
57
// Recording fifos. To speed up processing, one per channel plus one special system 'channel' for channel-less events like sysex.
58
MidiFifo _recordFifo[MIDI_CHANNELS + 1];
60
RouteList _inRoutes, _outRoutes;
40
63
virtual bool putMidiEvent(const MidiPlayEvent&) = 0;
66
enum { ALSA_MIDI=0, JACK_MIDI=1, SYNTH_MIDI=2 };
44
69
MidiDevice(const QString& name);
45
70
virtual ~MidiDevice() {}
72
virtual int deviceType() = 0;
74
virtual void* clientPort() { return 0; }
47
75
virtual QString open() = 0;
48
76
virtual void close() = 0;
77
virtual void writeRouting(int, Xml&) const { };
79
RouteList* inRoutes() { return &_inRoutes; }
80
RouteList* outRoutes() { return &_outRoutes; }
81
bool noInRoute() const { return _inRoutes.empty(); }
82
bool noOutRoute() const { return _outRoutes.empty(); }
50
84
const QString& name() const { return _name; }
51
void setName(const QString& s) { _name = s; }
85
virtual void setName(const QString& s) { _name = s; }
53
87
int midiPort() const { return _port; }
54
88
void setPort(int p) { _port = p; }
67
101
virtual void processInput() {}
68
102
virtual void discardInput() {}
70
void recordEvent(MidiRecordEvent&);
104
virtual void recordEvent(MidiRecordEvent&);
72
106
virtual bool putEvent(const MidiPlayEvent&);
108
// For Jack-based devices - called in Jack audio process callback
109
virtual void collectMidiEvents() {}
110
virtual void processMidi() {}
74
112
MPEventList* stuckNotes() { return &_stuckNotes; }
75
113
MPEventList* playEvents() { return &_playEvents; }
76
MREventList* recordEvents();
77
void flipRecBuffer() { _recBufFlipped = _recBufFlipped ? false : true; }
78
bool recBufFlipped() { return _recBufFlipped; }
115
///MREventList* recordEvents();
116
///void flipRecBuffer() { _recBufFlipped = _recBufFlipped ? false : true; }
117
///bool recBufFlipped() { return _recBufFlipped; }
118
void beforeProcess();
120
//int tmpRecordCount() { return _tmpRecordCount; }
121
int tmpRecordCount(const unsigned int ch) { return _tmpRecordCount[ch]; }
122
//MidiFifo& recordEvents() { return _recordFifo; }
123
MidiFifo& recordEvents(const unsigned int ch) { return _recordFifo[ch]; }
124
bool sysexFIFOProcessed() { return _sysexFIFOProcessed; }
125
void setSysexFIFOProcessed(bool v) { _sysexFIFOProcessed = v; }
126
//bool sysexWritingChunks() { return _sysexWritingChunks; }
127
//void setSysexWritingChunks(bool v) { _sysexWritingChunks = v; }
128
bool sysexReadingChunks() { return _sysexReadingChunks; }
129
void setSysexReadingChunks(bool v) { _sysexReadingChunks = v; }
130
//virtual void getEvents(unsigned /*from*/, unsigned /*to*/, int /*channel*/, MPEventList* /*dst*/);
79
132
iMPEvent nextPlayEvent() { return _nextPlayEvent; }
80
133
void setNextPlayEvent(iMPEvent i) { _nextPlayEvent = i; }
81
134
bool sendNullRPNParams(int, bool);
88
141
typedef std::list<MidiDevice*>::iterator iMidiDevice;
90
class MidiDeviceList : public std::list<MidiDevice*> {
143
class MidiDeviceList : public std::list<MidiDevice*>
92
146
void add(MidiDevice* dev);
93
147
void remove(MidiDevice* dev);
94
MidiDevice* find(const QString& name);
148
MidiDevice* find(const QString& name, int typeHint = -1);
95
149
iMidiDevice find(const MidiDevice* dev);
98
152
extern MidiDeviceList midiDevices;
99
153
extern void initMidiDevices();
154
extern bool filterEvent(const MEvent& event, int type, bool thru);