As a safety check...
Also throw out some warnings when loading savegames
with instrument data for a different device (the savegame
incompatibility would be very nice to be fixed, but it is not
trivial.
(fixes bug no. 1248 - "SAM: some MIDI channels missing on MT-32")
This is a very obvious bug if the speech is turned off (otherwise the speech will
kind of cover it up). In the SAMNMAX intro it is hardly playing anything.
The reason is that the newer sound system has an extra driver layer between the
imuse parts and the actual hardware which mananges the channels (similar to
what we already do for AdLib, Amiga, FM-Towns...). Whenever the songs are
attempting to use a Midi part > 9 our current system will fail.
I have written the MT-32 player to also handle the older games music and sound
effects. This will allow cleaning up various more hacks in the common sound code.
I have done only little cleanup here, since it is not the main purpose of the commit.
I will also write a GM driver. This is going to be easier. Currently, there is a only
some init and skeleton code for it, the rest is just pass-through...
I noticed broken sound when starting DOTT with MT-32
setting, then returning to the launcher and then starting in
GM mode.
Turns out that there was a nasty static var in instrument.cpp
that was not always reset to the correct value.
Instead of just doing that I cleaned it up a bit and got rid of
the static var.
The way the condition for checking if an instrument is valid, it should
be valid if the music player and MIDI driver agree on whether it's MT-32
MIDI. Otherwise, it's only valid if the instrument can be mapped to or
from MT-32.
But the way the check was written, it would always look for an
instrument mapping, since || binds harder than the ? operator.
All MT-32 instruments can be mapped to General MIDI, but a few General
MIDI instrument can't be mapped to MT-32. So theoretically, this should
have happened a lot. However, the GM instruments that can't be mapped
are mostly sound effects. The only cases where I've actually heard it
is with the Mac versions of Monkey Island 2 and Fate of Atlantis. They
provide their own digitized instruments, so who knows how those numbers
were assigned.
Two obvious early cases were the swamp music in Monkey Island 2 and the
New York music in Fate of Atlantis. Both were missing a "wood block"
instrument, among other things.