1
//=========================================================
4
// $Id: mpevent.h,v 1.1 2004/02/12 18:30:31 wschweer Exp $
6
// (C) Copyright 1999-2002 Werner Schweer (ws@seh.de)
7
//=========================================================
14
//---------------------------------------------------------
16
// baseclass for MidiPlayEvent and MidiRecordEvent
17
//---------------------------------------------------------
19
//---------------------------------------------------------
21
//---------------------------------------------------------
26
unsigned char _port, _channel, _type;
31
MEvent(unsigned tm, int p, int c, int t, int a, int b)
32
: _time(tm), _port(p), _channel(c & 0xf), _type(t), _a(a), _b(b) {}
33
MEvent(unsigned t, int p, int type, const unsigned char* data, int len);
34
MEvent(unsigned t, int p, int tpe, EvData d) : _time(t), edata(d), _port(p), _type(tpe) {}
38
int port() const { return _port; }
39
int channel() const { return _channel; }
40
int type() const { return _type; }
41
int dataA() const { return _a; }
42
int dataB() const { return _b; }
43
unsigned time() const { return _time; }
45
void setPort(int val) { _port = val; }
46
void setChannel(int val) { _channel = val; }
47
void setType(int val) { _type = val; }
48
void setA(int val) { _a = val; }
49
void setB(int val) { _b = val; }
50
void setTime(unsigned val) { _time = val; }
52
const EvData& eventData() const { return edata; }
53
unsigned char* data() const { return edata.data; }
54
int len() const { return edata.dataLen; }
55
void setData(const EvData& e) { edata = e; }
56
void setData(const unsigned char* p, int len) { edata.setData(p, len); }
57
bool isNote() const { return _type == 0x90; }
58
bool isNoteOff() const { return (_type == 0x80)||(_type == 0x90 && _b == 0); }
61
//---------------------------------------------------------
63
// allocated and deleted in midiseq thread context
64
//---------------------------------------------------------
68
class MidiRecordEvent : public MEvent {
71
MidiRecordEvent(const MEvent& e) : MEvent(e) {}
72
MidiRecordEvent(unsigned tm, int p, int c, int t, int a, int b)
73
: MEvent(tm, p, c, t, a, b) {}
74
MidiRecordEvent(unsigned t, int p, int tpe, const unsigned char* data, int len)
75
: MEvent(t, p, tpe, data, len) {}
76
MidiRecordEvent(unsigned t, int p, int type, EvData data)
77
: MEvent(t, p, type, data) {}
81
//---------------------------------------------------------
83
// allocated and deleted in audio thread context
84
//---------------------------------------------------------
86
class MidiPlayEvent : public MEvent {
89
MidiPlayEvent(const MEvent& e) : MEvent(e) {}
90
MidiPlayEvent(unsigned tm, int p, int c, int t, int a, int b)
91
: MEvent(tm, p, c, t, a, b) {}
92
MidiPlayEvent(unsigned t, int p, int type, const unsigned char* data, int len)
93
: MEvent(t, p, type, data, len) {}
94
MidiPlayEvent(unsigned t, int p, int type, EvData data)
95
: MEvent(t, p, type, data) {}