Thanks for the clarification. A few more points came up...
1. The unofficial MO3 specs mention that the header flag 0x4000 is "currently used" but not what it is supposed to be. At least in my tests with the latest MO3 and MO3 2.2, I couldn't generate a file that uses this flag. Is it ever set?
2. I have found that in some files the flags 0x20 and 0x40 are set (e.g. Skaven's ramagardens_remake.mo3), but I cannot quite deduce their meaning from that.
3. Also, regarding Zxx macros... As far as I understand there is no flag for these as there is in the IT header, right? When the macros are all 0, the default IT macro config (SF0 = Cutoff, Z80-Z8F = resonance) is assumed, is that correct? This effectively means that an all-empty MIDI macro config cannot be generated with MO3 (which in return means that Zxx effects would need to be stripped by MO3, but it does currently not do that). This might seem like a theoretical construct at first, but Zxx effects could be used for syncing if used like that - and in fact, in IT files made with older versions of Impulse Tracker these commands need to be either removed or the macro config needs to be emptied anyway (I didn't test if MO3 does either).
4. I noticed that in some older MO3 files, the IT and S3M frequency is not stored in Hz. The formula seems to be freq = 15787.0 * pow(2.0, finetune / 1536.0) - is this correct, and how can I determine when to use this formula? It seems to be independent from the linear slides flag, the MO3 version or any of the unknown header flags.
5. Interestingly, it seems like the "global volume" field in the sample headers doubles for the sample finetune in the XM format for some reason. I think I caught most fields that are supposed to be interpreted only in some formats, but can you maybe provide a list of fields that are only valid in some formats (like the global volume field) or need to interpreted differently (like the instrument sample map or sample frequency)? Maybe you could have a quick look over
my implementation and check if you see any missing format checks?
6. And are there any other structural changes in the format apart from this and the
other additions in version 5? I know flags have been added in various versions, but are there any other things that need to be interpreted differently based on the format version apart from that?
7. Regarding shared OGG headers... To reconstruct those, I suppose MO3 uses the first two Ogg frames (and adjusts the stream serial number)? Or is there more behind it?
8. How does the encoding delay in the sample header work? On first sight it seems to be in bytes rather than samples, and additionally it seems to include the LAME padding, which makes it a bit difficult to use with MP3 decoders that already remove the padding?
9. The encoder delay seems to be set for OGG samples as well, although it seems to be unnecessary?
10. From reading the manual (
) I deduced that there must be a header flag for VBlank mods - 0x80000, right? With this and the two unknown 0x20 and 0x40 flags, the "holes" in the flag set are slowly filling up. However, the 0x1000-0x4000 range and 0x40000 are still missing and I have not seen them in the wild so far - But I guess you didn't leave arbitrary holes in the flag set and surely these values have meaning, too?