Russian-Doom / russian-doom

A limit-removing source port of Doom, Heretic and Hexen. It has numerous vanilla bug fixes, enhanced 640x400 and 1280x800 rendering resolutions, improved game palettes and offers many optional aesthetic game enhancements along with the maximum possible translation to the Russian language.
GNU General Public License v2.0
81 stars 13 forks source link

Questions about Heretic music #274

Open vanfanel opened 3 years ago

vanfanel commented 3 years ago

Hi again @JNechaevsky!

I have also some questions about Heretic music.

First question I use digital OST in OGG format. For that, I use OGG files without extension inside a WAD that I pass via the -file parameter. Well: if I let demos play for, let's say, 1 hour, music stops working (even if I start a new game) and I start seeing these in the console:

Error loading midi: Couldn't read first 12 bytes of audio data
P_CheckMapFormat: Doom format (BSP)
Error loading midi: Couldn't read first 12 bytes of audio data
P_CheckMapFormat: Doom format (BSP)
Error loading midi: Couldn't read first 12 bytes of audio data
Error loading midi: Couldn't read first 12 bytes of audio data
P_CheckMapFormat: Doom format (BSP)
Error loading midi: Couldn't read first 12 bytes of audio data
P_CheckMapFormat: Doom format (BSP)
Error loading midi: Couldn't read first 12 bytes of audio data
P_CheckMapFormat: Doom format (BSP)
Error loading midi: Couldn't read first 12 bytes of audio data
Error loading midi: Couldn't read first 12 bytes of audio data

May it be a bug?

Second question How can I use GUS emulation? I have copied over the gus_patches directory to the same directory where russian-heretic lives, and I have set gus_patch_path like this on russian-heretic.ini: gus_patch_path "gus_patches/"

However, no music can be heard if I configure GUS emulation. Does GUS emulation require SDL_Mixer to be built with timidity support?

Thanks!

JNechaevsky commented 3 years ago

Uh-oh. That's a problem... Neither me, nor a co-author @Dasperal aren't using Linux, and we mostly dropped it's support, so I really can't tell what is happening outside of Windows. :/

Could you please share your PWAD with OGG lumps? Not sure if I can do something about it in Linux, since Windows version is using Midiproc for digital music, but still worth to check out.

As about second question, what is full path to the gus_patches folder?

vanfanel commented 3 years ago

@JNechaevsky Oh, but Russian-Doom works SO beautifully on GNU/Linux! You should try it on a Raspberry Pi with a minimal system, it's VERY nice to have a system that boots in seconds to the console, and then directly run Russian-Doom on the TTY via SDL2 with KMSDRM support! (NO desktop, DOS-style!)

But well, if there's something else I can do to convince you, please tell me.

Here's the WAD I am using (maybe the same problem happens on Windows? Remember you have to let demo mode run for maybe 1 hour...): https://www.dropbox.com/s/klpcpk8dm6uw55y/heretic_music.wad?dl=0

Full path for gus_patches would be /home/pi/heretic/gus_patches Are you sure I don't need to provide a timidity.cfg with the GUS patches, too?

Also I am seeing this message on the console when trying GUS emulation: Error loading midi: Unrecognized audio format

Dasperal commented 3 years ago

I don't know if the special version of SDL is needed. For me, GUS works on KUbuntu with the default setup.

In the current master branch, Russian-Doom by default uses bundled GUS patches from /usr/local/share/russian-doom/gus_patches/. If command line parameter -gus_patches <path> used or config file variable gus_patch_path set then given path is used. if Russian-Doom is correctly installed and bundled GUS patches don't work then it might be a problem with your SDL.

As for Linux support, we officially don't support Linux but I didn't drop it. You should expect that there may be problems on Linux and those problems may not be fixed because we don't know how to fix them or even why they happening, like #252. But if I understand the problem I probably fix it at some point.

JNechaevsky commented 3 years ago

@vanfanel I remember our talks about Pi. :) I'm always all for various optimizations, because I like the Idea of having fast engine, which "abuses less CPU and making less CPU fan noise". From another side, we are not in 1994th, nowadays CPUs are fast enough to "scroll" all 32 vanilla maps of Doom II in less than half-of second (w/o wiping effect).

I have ported three significant rendering optimizations from PrBoom+: sprite sorting, visplane hashing and column clipping, and in most of extreme complex scenes renderer becomes far, far more faster. It takes about three months of time spending on NUTS.wad and Sunder MAP15, but it's worth it. Not sure if it will helps on low-end CPUs, though, hopefully it does. I've also done some benchmark testing between RD and PrBoom+ in same scenes / same window size / same game behavior, results are pretty well: in -timedemo runs PrBoom still faster for about 3-4%, but in some static complex scenes RD can give more FPS. Not sure why, probably because of PrBoom making some extra checks/calculations for game world.

But still, software renderer is a real bottleneck. I believe any farther significant optimizations can be done only via using GPU, but this will require -- at least -- some serious knowledge of OpenGL which I don't have and will never have. I'm not doing anything programming-related outside of RD project.

Ah yes, as about OGG... The situation even worse than expected. :( Once OGG music start playing, it can not be changed, matters no what I'm doing: starting another map, loading or ending the game. This is totally confusing, because digital music is playing via Midiproc, and AFAIR, Midiproc does not have any special specifications between MIDI/digital tracks, all of them are playing using various DLLs. More of that, this bug exist even in previously released RD version, which is 9 months old now and have an older version of Midiproc. Midi music working and changing fine, though. So what the heck is happening - a real question.

But can we pause this issue for some time? I'm planning to release both Doom and Heretic updates on 2021-09-16 (five years anniversary), and then take some rest.

vanfanel commented 3 years ago

@JNechaevsky Sure! No need to do anything until you feel like it! After all, this is opensource and free software, I am simply deeply thankful for Russian-Doom/Heretic/Hexen as it is! And I have noticed it's way faster than Crispy Doom, I guess it's because of these awesome optimizations :)

But I think I can't make GUS emulation work because I am missing something and I don't know what: it seems that the message I am seeing about Error loading midi: Unrecognized audio format is coming from SDL_Mixer, but midi support thru fluidsynth IS activated on my SDL_Mixer build, so in general SDL_Mixer is supposed to support MIDI here.

So, how does GUS emulation work? Is it an internal GUS emulation that loads music lumps in heretic.wad? Or is GUS emulation just MIDI playback using gus_patches and SDL_Mixer? I am puzzled, there's something here I am missing...

Dasperal commented 3 years ago

As was discovered in another issue, GUS uses Timidity

vanfanel commented 3 years ago

@Dasperal So GUS emulation uses SDL_Mixer's MIDI support, which in turn uses Timidity. Is that correct?

But if that's correct, there's something I don't fully understand: SDL_Mixer can also use use Fluidsynth for MIDI support. Why would Timidity be explicitly required?

Maybe I am wrong, and Russian-Doom uses Timidity directly (ie: not via SDL_Mixer MIDI support)?

Dasperal commented 3 years ago

GUS emulation uses SDL_Mixer's Timidity. Timidity config is created from DMXGUS lump. Fluidsynth is disabled while Timidity is used because SDL_mixer considers Fluidsynth a higher priority than Timidity and therefore can end up circumventing Timidity entirely.

vanfanel commented 3 years ago

@Dasperal Would it be possible to use fluidsynth sirectly via libfluidsynth or via SDL_Mixer's fluidsynth support instead of Timidity? After all, Timidity isn't developed anymore, while fluidsynth us constantly improving. Projects like Scummvm use it.

Dasperal commented 3 years ago

If someone implements GUS emulation with Fluidsynth. I have no idea how to do that.

The main problem with SDL_Mixer's Timidity is that it doesn't understand quoted strings in the Timidity config. This result in a problem described in #275