Guest User

Untitled

a guest
Feb 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. BigEndian();
  2.  
  3. typedef struct {
  4. int version;
  5. int checksum;
  6. uint numEvents;
  7. uint stringTableSize;
  8. uint unk1;
  9. uint numChunks;
  10. uint numTimeSigs;
  11. uint unk3;
  12. } XmkHdr;
  13.  
  14. typedef struct {
  15. float start;
  16. uint tempo;
  17. uint unk;
  18. } XmkTempo;
  19.  
  20. typedef struct {
  21. uint unk;
  22. ushort unk1;
  23. byte unk2;
  24. byte midi_note;
  25. float start_time;
  26. float end_time;
  27. uint unk3;
  28. uint string_offset;
  29. } XmkEvent<read=EVENT>;
  30.  
  31. // Xmk File structure begins here
  32. XmkHdr hdr;
  33. XmkTempo tempo_map[hdr.numChunks];
  34. int time_signatures[4 * hdr.numTimeSigs - 1];
  35. XmkEvent midi_events[hdr.numEvents];
  36. char stringTable[hdr.stringTableSize];
  37. // Xmk File Structure ends here
  38.  
  39. // Function for reading the text content of a midi event
  40. string EVENT(XmkEvent& l) {
  41. local int offset = l.string_offset - sizeof(XmkEvent) * hdr.numEvents;
  42. local char c[128];
  43. c[0] = '\0';
  44. if(offset >= 0) {
  45. Memcpy(c, stringTable, 128, 0, offset);
  46. }
  47. return c;
  48. }
Add Comment
Please, Sign In to add comment