- Looking over the code again, I see that discarded SysEx messages can
cause the same issue as unhandled meta events, so generalize the
returning of a NOP for everything.
* OPL: specify the core to use for playing this song
* FluidSynth: specify a soundfont that should be used for playing the song.
* WildMidi: specify a config file that should be used for playing the song.
* Timidity++: specify an executable that should be used for playing the song. At least under Windows this allows using Timidity++ with different configs if the executable and each single config are placed in different directories.
* GUS: currently not operational, but should later also specify the config. This will need some work, because right now this is initialized only when the sound system is initialized.
* all other: no function.
These options should mainly be for end users who want to fine-tune how to play the music.
- increased the valid range of patch values for MUS. According to the original MIDI2MUS code it can handle numbers up to 188, not 181, and at least one track from Eternal Doom uses #183.
According to blzut3, it looks like it is a byte followed by a variable length field. It can be any value 0-15 and will be followed by that many bytes one for each bank used. If the bank count is 0 then it is shorthand for using one bank (bank 0).
Based on evidence from several songs in Eternal Doom the description in all known documents is wrong. The instruments are not stored in a 16-bit word but in an 8-bit byte, followed by some variable size data.
Known variations are:
* second byte is 0 - no additional data follows
* second byte is 1 - a third byte for the 'bank' value follows.
-- errno.h is required for 'errno';
-- don't use str(n)casecmp and rely on ZDoom CMake handling;
-- add a missing parenthesis around a 'signed char' cast;
-- remove an unneeded GNU_SOURCE redefinition;
-- the non-MSVC side of snd_mididevice was not adapted to the new code, making wildmidi unavailable through the menu.
The pointless error message in WildMidi_Shutdown was removed to keep the rest of the code simple and allowing to call this even when the device never was used.
* added global functions that check whether FMod and OpenAL are present, without initializing the sound backend.
* make sound init code more fault tolerant. It will now try to switch between FMod and OpenAL if the currently active one cannot be found but the other one can.
* added 'ifoption' checks for sound backend to menu code.
* only show sound backends which are present and hide the options for the ones which are not.
This required the addition of a few exception handlers so to avoid #ifdef overuse I also added some #defines for non-Windows systems that allow using __try and __except directly in the code without #ifdef'ing them out.
UpdateSounds will not be called during screen wipes and the entire setup of this function suggests that this is not advisable at all.
The OpenAL stream updates were done deep inside this function implicitly.
This caused music to stop while a wipe was in progress. So in order to allow uninterrupted music playback during screen wipes the music updates need to be handled separately from sound updates and be called both in the main loop and the wipe loop.
I think that the OpenAL music updating should be offloaded to a separate thread but at least it's working now without causing interruptions during wipes.
- S_PrecacheLevel() must also mark currently playing sounds as
used. If we don't, the sound could be unloaded and the underlying
channel stopped without triggering a channel callback. That would leave
the code in s_sound.cpp thinking the sound is still playing even though
it isn't.
- Added an invalid channel check to FMODSoundRenderer::StopChannel() so
that orphan channels passed to it will be returned at least when
S_StopAllChannels() is called.
- OpenAL never actualy worked properly and was removed in later FMODs.
- Sound Manager was deprecated by Apple long ago and is not supported for
64-bit applications. It was also removed in later FMODs.