1
//=========================================================
4
// $Id: mpevent.h,v 1.1.1.1 2003/10/29 10:05:08 wschweer Exp $
6
// (C) Copyright 1999-2002 Werner Schweer (ws@seh.de)
7
//=========================================================
18
//---------------------------------------------------------
20
//---------------------------------------------------------
23
unsigned char _port, _channel, _type, _a, _b;
28
MidiPlayEvent(const MidiPlayEvent&);
29
MidiPlayEvent(int p, int c, int t, int a, int b)
30
: _port(p), _channel(c), _type(t), _a(a), _b(b) {
33
MidiPlayEvent(int p, const unsigned char* data, int len);
34
MidiPlayEvent(int p, EvData* data);
35
MidiPlayEvent& operator=(const MidiPlayEvent&);
38
int port() const { return _port; }
39
int channel() const { return _channel; }
40
int type() const { return _type; }
41
void setType(int val) { _type = val; }
42
void setPort(int val) { _port = val; }
43
void setChannel(int val) { _channel = val; }
44
int dataA() const { return _a; }
45
int dataB() const { return _b; }
46
void setA(int val) { _a = val; }
47
void setB(int val) { _b = val; }
48
const unsigned char* data() const;
51
bool isNote() const { return _type == 0x90; }
52
bool isNoteOff() const {
53
return (_type == 0x80)||(_type == 0x90 && _b == 0);
55
EvData* eventData() const { return edata; }
59
//---------------------------------------------------------
61
//---------------------------------------------------------
63
typedef std::multimap<int, MidiPlayEvent, std::less<int>, RTalloc<MidiPlayEvent> > MPEL;
64
typedef std::pair<const int, MidiPlayEvent> MPEP;
66
struct MPEventList : public MPEL {
67
void add(int tick, int a, int b, int c, int d, int e) {
68
MPEL::insert(MPEP (tick, MidiPlayEvent(a,b,c,d,e)));
70
void add(int tick, int port, EvData* ed) {
71
MPEL::insert(MPEP (tick, MidiPlayEvent(port, ed)));
73
void add(int tick, const MidiEvent* e, int port, int channel);
77
typedef MPEventList::iterator iMPEvent;
78
typedef MPEventList::const_iterator ciMPEvent;
79
typedef std::pair <iMPEvent, iMPEvent> MPEventRange;