binarymaster wrote:So, here is my development branch for HERAD format support in AdPlug:
https://github.com/adplug/adplug/tree/herad-dev […]
Show full quote
So, here is my development branch for HERAD format support in AdPlug:
https://github.com/adplug/adplug/tree/herad-dev
Almost everything works, but there are still some bugs with note transposition macro and strange AGD sounding at different places. Hope you can help out with that, since I'm stuck for a week.
Replayer code is here:
https://github.com/adplug/adplug/blob/herad-dev/src/herad.h
https://github.com/adplug/adplug/blob/herad-d … v/src/herad.cpp
For MegaRace, the transpose macro is different then Dune and KGB. After messing around with the DOSBox Debugger, I finally figured out how the transpose macro for HERAD 2 works! For MegaRace, the subroutine is found at 3B08:068B or sub_058B in the DFADP.HSQ driver.
Every time the driver grabs the transpose value, it subtracts the value by 31 then compares that value with 60. If the value is greater than 60, the transpose macro value is added to the MIDI pitch value. But if the value is less than 60, the MIDI pitch is overridden and that subtracted value + 18 becomes the new MIDI pitch.
For example the song NewSan uses a transpose value of 0x6B for it's snare instrument.
6B - 31 = 3A
3A < 60
If the value is less than 60, then 18 is added to the subtracted transpose value and that becomes the new MIDI pitch for the instrument.
3A + 18 = 52 = Final MIDI pitch
If the value is more than 60, then the value just modifies the MIDI pitch directly. In this example, we'll use NewSan's hihat instrument, which is the very last instrument in the file. The transpose macro value is 2E and the MIDI pitch is 44.
2E - 31 = FD
FD > 60
Since FD is greater than 60, the original transpose value is added to the MIDI pitch, giving us our final transposed pitch.
44 + 2E = 72 = Final MIDI Pitch
I'm not exactly sure how HERAD v1 handles the transpose value since I haven't reverse engineered Dune or KGB's drivers yet but I'm confident it's much simpler and acts like a adding the value to the MIDI pitch. Hope this helps!
Binarymaster, is it possible for you to build a binary of AdPlug with HERAD beta support? I would very much like to try it out!
Also, just curious, how did you come up with 51968 for the timer?