I also posted this new in the SpriteMinds forum (devoted to 16 bits sega programming) and Sega-16 forum but i think it can be interesting to post it as well so here it is !
I released a new version of SGDK, a sort of SDK for the Sega Megadrive that you can find here :
http://stephane-d.github.io/SGDK/
The big addition of this version is the new sound driver : the XGM driver.
Here is what this driver supports :
- 5 FM + 4 PSG + 4 PCM @14 Khz playback
- 16 priority levels for SFX play through PCM.
- support music pause / resume command.
- automatic DAC enabled handling when PCM are played.
- no size limit for XGM music data and PCM data.
- PCM must have their size and address aligned to 256 bytes.
- 100% running on Z80
- protection against DMA contention to preserve good PCM playback quality (not 100% guaranteed depending the driver load).
The XGM format is similar to VGM in the way it uses chip writes logging but is optimized for the Sega Megadrive where VGM support various systems. Because of that the XGM file size is usually about 30% smaller than VGM file (of course i am speaking about optimized VGM).
The advantage of using that type of format is that SGDK enable VGM playback directly through the XGM driver !
I developed a new tool (xgmtool) which convert a VGM file into a XGM file, it was a pain in the ass to convert my java tool in C but it's working now Actually xgmtool can do a lot more than that, it is a powerful tool to optimize the Megadrive VGM file (require 1.5 vgm file at least) ! I was really disappointed with the current available VGM utilities... not able to find a working VGM optimizer, or maybe i used them incorrectly but i tried hardly at least... so i had to develop my own tool :-/
There are restrictions in the VGM optimization and the XGM convertion: the XGM format uses frame based timing so if a VGM file use sub frame timing then the conversion may fails...
Currently there is unfortunately no tracker taking advantages of the XGM 4 PCM channels and that is a reason why i decided to post the new here Of course basically the Sega Genesis has hardware support for 5FM + 4PSG + 1PCM (or 6FM + 4 PSG) so it's normal to find this configuration in dedicated Sega Megadrive tracker software. With this new driver, the number of PCM channel can be increased to 4 and i believe it could be nice to have a tracker supporting this feature (in which case only XGM export is available).
For those who are interested, here are the XGM format specifications:
https://raw.githubusercontent.com/Steph
in/xgm.txt
Note that the Z80 XGM driver does not directly play the XGM file, it requires a compiled XGM file (thanks to xgmtool) which is very similar to the XGM format with some slight changes to make file parsing a bit easier for the Z80
You can find an example in the usual sound sample:
source and binary
Last edited by Stef (Aug 25, 2015 2:39 pm)