pub fn parse_patterns(
header: &XmHeader,
bytes: &[u8],
) -> Result<(Vec<XmPattern>, usize)>Expand description
Parse all patterns starting from the end of the file header.
For each pattern:
- Reads the 9-byte pattern header.
- If
packed_size == 0, the pattern is “all empty” — emitsnum_rowsrows ofnum_channelsdefault cells without advancing into packed data. - Otherwise, decodes
num_rows * num_channelscells from the packed block, tolerating truncation by emitting default cells for any leftover slots.
Returns the decoded patterns and the absolute byte offset after the last pattern (where the instrument table begins).