SDL-Mixer-X
SDL-Mixer-X copied to clipboard
Broken .vgm playback
It seems that .vgm files that are not just Genesis/MD rips from https://project2612.org/ don't 100% play correctly.
Stuff from https://vgmrips.net/ or made with Deflemask won't seem to play right, for example the drum track in the below vgm: https://www.dropbox.com/s/agvzwoyips9sgdg/Castlevania%20Dracula%20X%20-%20Bloodlines.vgm?dl=0
The major difference between MegaDrive rips and Deflemask-crafted files is that they use different ways of sample playback:
- MegaDrive rips keep the most of the PCM data of the song (except for silent parts) and that gets played as raw chip's commands
- Deflemask-crafted files do use the "PCM database" style: there is a small bunch of PCM chunks stored and they get played like they are samples for the wavetable synthesizer
This file uses the sort of "PCM database" style which doesn't work in the VGM module implemented at the libGME library used here. I could make an attempt to implement the support for this. Until to start the work I'll make an issue on the GME side. Once I get a moment, I'll try to implement some, otherwise, somebody also could contribute that.
There is sort of these data blocks :thinking: https://vgmrips.net/wiki/VGM_Specification#Data_blocks
Alternatively, I could pick up this thing to use as an alternative for VGM format exclusively
I would like to recommend libvgm too, it's much more "modern" than GME
The only con I just now found at libVGM it completely lacks the C-API, which will need me to make the C++-based module to integrate it, so, on platforms where C++ sucks, this module will not work. At least, the big proc of MixerX it's modular and it's possible to disable/enable every codec depending on purposes easily.
I did a little dirty attempt to use libVGM, however, it didn't work properly yet, and also, it conflicts with libOPNMIDI on an attempt to statically link both libraries because of the MAME emulator code.
Okay, after some moment I got it working, but it lacks some features:
- tempo doesn't change (maybe I did some mistake?)
- no way to seek (GME had that ability), however, displays the current time
- need to figure how to properly break the playback after all loops have been done (if non-infinite looping was been set)
- still need to tune up the libOPNMIDi side because of MAME cores conflict at both libraries
btw: tempo is really didn't implemented yet (see ValleyBell's reply: https://github.com/ValleyBell/libvgm/issues/87)
The tempo change is a very important thing as it's already used by some users with chiptunes, trackers, and MIDIs. So, waiting once ValleyBell will implement the tempo support. In parallel, try to implement the support for samples database at the GME...