The MIDI Forum

  Tuesday, 01 September 2020
  1 Replies
  8.6K Visits
Section 2.1 of the XMF Specification says "TreeEnd is the offset from the start of the XMF file to the last byte of the tree".
This would seem to indicate that if a tree starts at say offset 100, and is 100 bytes in length, then TreeEnd would be 199, which is the offset of the last byte.
However the diagram that follows appears to show TreeEnd pointing at the beginning of the next resource, which in my above example would mean TreeEnd equals 200.

Which of these two interpretations is correct? I'm seeing some files in the wild that conform to the text, and other files that conform to the diagram.
The diagram does not show individual bytes, so it is not clear where exactly the arrow points to. So you'd have to go from the text, which is unambiguous.
(And this is an unusual construction; most begin/end values in other file formats indeed use begin+length=end.)

When writing files, you should conform to the text. When reading files, you should be able to handle both.
  • Page :
  • 1
There are no replies made for this post yet.