Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BigEndian();
- typedef struct {
- int version;
- int checksum;
- uint numEvents;
- uint stringTableSize;
- uint unk1;
- uint numChunks;
- uint numTimeSigs;
- uint unk3;
- } XmkHdr;
- typedef struct {
- float start;
- uint tempo;
- uint unk;
- } XmkTempo;
- typedef struct {
- uint unk;
- ushort unk1;
- byte unk2;
- byte midi_note;
- float start_time;
- float end_time;
- uint unk3;
- uint string_offset;
- } XmkEvent<read=EVENT>;
- // Xmk File structure begins here
- XmkHdr hdr;
- XmkTempo tempo_map[hdr.numChunks];
- int time_signatures[4 * hdr.numTimeSigs - 1];
- XmkEvent midi_events[hdr.numEvents];
- char stringTable[hdr.stringTableSize];
- // Xmk File Structure ends here
- // Function for reading the text content of a midi event
- string EVENT(XmkEvent& l) {
- local int offset = l.string_offset - sizeof(XmkEvent) * hdr.numEvents;
- local char c[128];
- c[0] = '\0';
- if(offset >= 0) {
- Memcpy(c, stringTable, 128, 0, offset);
- }
- return c;
- }
Add Comment
Please, Sign In to add comment