110
104
virtual void write(int, Xml&, int offset) const = 0;
111
105
virtual void dump() const;
112
106
virtual Event* clone() = 0;
113
virtual Event* mid(const Pos&, const Pos&) = 0;
107
virtual Event* mid(int, int) = 0;
110
//---------------------------------------------------------
112
// variable len event data (sysex, meta)
113
//---------------------------------------------------------
120
EvData() { data = 0; dataLen = 0; refCount = 0; }
126
EvData(const unsigned char* p, int l) {
129
void setData(const unsigned char* p, int l) {
130
data = new unsigned char[l];
116
136
//---------------------------------------------------------
148
167
MidiEvent(const MidiEvent&);
168
MidiEvent(const MidiPlayEvent*);
149
169
virtual ~MidiEvent();
170
MidiEvent& operator=(const MidiEvent&);
151
MidiEvent(int port, int channel, int tick, EventType type, int a, int b, int c, int len);
152
MidiEvent(int port, int channel, int tick, EventType type, int len, const unsigned char* data);
172
MidiEvent(int tick, EventType type, int a, int b, int c, int len);
173
MidiEvent(int tick, EventType type, int len, const unsigned char* data);
154
175
bool isNote() const { return _type == Note; }
155
bool isNoteOff() const {
156
return (_type == NoteOff) || ((_type == Note) && (b == 0));
176
bool isNoteOff() const {
177
return (_type == NoteOff) || ((_type == Note) && (b == 0));
158
179
bool isNoteOff(MidiEvent*);
160
int pitch() const { return a; }
161
int program() const { return a; }
162
int cntrl() const { return a; }
163
int dataA() const { return a; }
164
void setA(int val) { a = val; }
165
void setPitch(int v) { a = v; }
167
int cntrlVal() const { return b; }
168
int dataB() const { return b; }
169
int velo() const { return b; }
170
void setB(int val) { b = val; }
171
void setVelo(int v) { b = v; }
173
int veloOff() const { return c; }
174
int dataC() const { return c; }
175
void setC(int val) { c = val; }
176
void setVeloOff(int v) { c = v; }
178
const unsigned char* data() const { return _data; }
179
void setData(unsigned char* d) { _data = d; }
180
int dataLen() const { return _dataLen; }
181
void setDataLen(int l) { _dataLen = l; }
182
EventType type() const { return _type; }
183
void setType(EventType t) { _type = t; }
184
void setEnh(int enh) { _enh = enh; }
185
int enh() const { return _enh; }
186
int voice() const { return _voice; }
187
void setVoice(int v) { _voice = v; }
188
int stem() const { return _stem; }
189
void setStem(int v) { _stem = v; }
181
int pitch() const { return a; }
182
int program() const { return a; }
183
int cntrl() const { return a; }
184
int dataA() const { return a; }
185
void setA(int val) { a = val; }
186
void setPitch(int v) { a = v; }
188
int cntrlVal() const { return b; }
189
int dataB() const { return b; }
190
int velo() const { return b; }
191
void setB(int val) { b = val; }
192
void setVelo(int v) { b = v; }
194
int veloOff() const { return c; }
195
int dataC() const { return c; }
196
void setC(int val) { c = val; }
197
void setVeloOff(int v) { c = v; }
199
const unsigned char* data() const { return edata->data; }
200
int dataLen() const { return edata->dataLen; }
201
EvData* eventData() const { return edata; }
202
void setEvData(EvData* ed) { edata = ed; }
204
EventType type() const { return _type; }
205
void setType(EventType t) { _type = t; }
206
void setEnh(int enh) { _enh = enh; }
207
int enh() const { return _enh; }
208
int voice() const { return _voice; }
209
void setVoice(int v) { _voice = v; }
210
int stem() const { return _stem; }
211
void setStem(int v) { _stem = v; }
190
212
virtual void dump() const;
191
213
virtual void read(Xml&);
192
214
virtual void write(int, Xml&, int offset=0) const;
193
215
void readAttr(Xml& xml);
194
iAttribute beginAttr() { return attributes.begin(); }
195
iAttribute endAttr() { return attributes.end(); }
196
Attribute* addAttr(const Attribute& a) { return attributes.add(a); }
197
void addLyrics(const QString& s) { attributes.addLyrics(s); }
198
void eraseAttr(iAttribute i) { attributes.erase(i); }
199
virtual Event* clone() { return new MidiEvent(*this); }
200
virtual Event* mid(const Pos&, const Pos&);
216
iAttribute beginAttr() { return attributes.begin(); }
217
iAttribute endAttr() { return attributes.end(); }
218
Attribute* addAttr(const Attribute& a) { return attributes.add(a); }
219
void addLyrics(const QString& s) { attributes.addLyrics(s); }
220
void eraseAttr(iAttribute i) { attributes.erase(i); }
221
virtual Event* clone() { return new MidiEvent(*this); }
222
virtual Event* mid(int, int);
202
MidiTrack* trk() const { return _trk; }
203
void setTrk(MidiTrack*t) { _trk = t; }
224
MidiTrack* trk() const { return _trk; }
225
void setTrk(MidiTrack*t) { _trk = t; }
206
228
//---------------------------------------------------------