by Gez » Thu Mar 01, 2012 3:55 pm
So, the [wiki]GUS[/wiki] emulator in ZDoom is unfinished. This patch makes it a bit less unfinished.
It adds a LoadDMXGUS function to the TiMidity renderer that will be called if the new "midi_readlump" CVAR is true (otherwise, it'll load the config pointed at from midi_config as before). Instrument mapping will be performed according to the DMXGUS lump.
Since Doom, Heretic, Hexen, Strife, and Chex Quest use DMXGUS while Doom II, TNT and Plutonia use DMXGUSC, and finally Hacx, Harmony or Freedoom don't have either, I went with a brute-force approach: LoadDMXGUS will first try DMXGUS, then DMXGUSC, and if both fails it falls back to LoadConfig(midi_config).
When loading an existing lump, the midi_1024remap CVAR determines whether instruments are actually remapped as if we were on a GUS with 1024K memory. You can turn that on to listen to clear differences between
various configs, or leave it off to benefit from greater quality than was possible on the actual hardware.
The [wiki]advanced sound options[/wiki] menu is updated with the various settings (old and new) for the TiMidity GUS emulator there.
If midi_config isn't loaded, there is the question of finding the patches. To do so, LoadDMXGUS() will add to the path list a midi subdirectory within the directory set from the %ULTRADIR% variable (if it actually exists), as well as directly from the new midi_patchdir CVAR.
And that is the extent of the changes in the patch.
Note: the simplistic parser contained in this patch will gleefully ignore any syntax problem in the lumps. I couldn't get an FScanner-based parser to work, because 1. it uses #-to-EOL comments, not C++ style comments; 2. sidestepping that I got stuff like "Bad numeric constant "0,"" which was very annoying; 3. sidestepping also that, it somehow only parsed the odd numbered patches and that's when I said "screw it" and wrote some ad-hoc code instead. It's not any uglier than the Timidity config parser, and it avoids an extra #include.
A good test file to see the interest of the patch is
this. Extract the content of gravpat.zip in your GUS patch folder, then load the .wad file. Set the MIDI device to GUS, give it a listen for a few seconds, then go to advanced sound options, set the "Read DMXGUS lumps" on, back to sound options and "restart sound". Notice the difference.
- Attachments
-
- gus_emulation.zip
- (1.92 KiB) Downloaded 79 times
So, the [wiki]GUS[/wiki] emulator in ZDoom is unfinished. This patch makes it a bit less unfinished.
It adds a LoadDMXGUS function to the TiMidity renderer that will be called if the new "midi_readlump" CVAR is true (otherwise, it'll load the config pointed at from midi_config as before). Instrument mapping will be performed according to the DMXGUS lump.
Since Doom, Heretic, Hexen, Strife, and Chex Quest use DMXGUS while Doom II, TNT and Plutonia use DMXGUSC, and finally Hacx, Harmony or Freedoom don't have either, I went with a brute-force approach: LoadDMXGUS will first try DMXGUS, then DMXGUSC, and if both fails it falls back to LoadConfig(midi_config).
When loading an existing lump, the midi_1024remap CVAR determines whether instruments are actually remapped as if we were on a GUS with 1024K memory. You can turn that on to listen to clear differences between [url=http://doomwiki.org/wiki/DMXGUS]various configs[/url], or leave it off to benefit from greater quality than was possible on the actual hardware.
The [wiki]advanced sound options[/wiki] menu is updated with the various settings (old and new) for the TiMidity GUS emulator there.
If midi_config isn't loaded, there is the question of finding the patches. To do so, LoadDMXGUS() will add to the path list a midi subdirectory within the directory set from the %ULTRADIR% variable (if it actually exists), as well as directly from the new midi_patchdir CVAR.
And that is the extent of the changes in the patch.
[size=60]Note: the simplistic parser contained in this patch will gleefully ignore any syntax problem in the lumps. I couldn't get an FScanner-based parser to work, because 1. it uses #-to-EOL comments, not C++ style comments; 2. sidestepping that I got stuff like "Bad numeric constant "0,"" which was very annoying; 3. sidestepping also that, it somehow only parsed the odd numbered patches and that's when I said "screw it" and wrote some ad-hoc code instead. It's not any uglier than the Timidity config parser, and it avoids an extra #include.[/size]
A good test file to see the interest of the patch is [url=http://www.doomworld.com/idgames/?id=4850]this[/url]. Extract the content of gravpat.zip in your GUS patch folder, then load the .wad file. Set the MIDI device to GUS, give it a listen for a few seconds, then go to advanced sound options, set the "Read DMXGUS lumps" on, back to sound options and "restart sound". Notice the difference. :)