Move some Midi related code into the new drivers. I have
kept some handling for Mac and PCSpk for now, since I'll
have to do more research, before I touch them. But eventually
it would be nice to get rid of as much of these sound
type checks/exceptions in the common code as possible.
Also, I finally verified that Samnmax does actually init the
pitchbend factor to 2, but it can be set to 0 by control
change 16. In this case the pitchbend message will alter
the volume instead of the pitch. I don't know if that method
is used anywhere, though.
(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...
Currently, Roland MT-32 sound is broken for
SAMNMAX. Just try the intro song with shut off
speech. It is very obvious that it plays with a quite
reduced number of channels compared to the
original interpreter.
Now, due to the not-so-helpful code design (much
of the iMuse code has been drawn into the common
code) it has become increasingly difficult to fix Midi
related thing in iMuse. I have added more and more
crude hacks over time.
SAMNMAX requires more elaborate channel
allocation. To make it happen I have added driver
wrappers for Midi to the iMuse code.
Other than that, I have done only minor cleanup here.
Actually, I would have liked to withdraw much more
of the iMuse code from the common code and move
it to SCUMM (basically all the MidiChannel
stuff which is exclusively used by iMuse. But it turns
out that it is so thoroughly intertwined (the major
blocker here being the AdLib driver) that it requires
more thought and effort and would just distract me
from fixing the SAMNMAX sound.
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.
Reduce abuse of the property function to set init vars.
Better distinction between drivers to prevent a GM init on
the Mac driver (which could happen depending on the
launcher sound setting).
(I have checked some more drivers. It seems that the AdLib and PC Speaker
drivers of the earlier games have larger boundaries, the MT-32 drivers have
smaller ones)
Continued bug fixing for ticket no. 13460 ("Incorrect MIDI
pitch bending"). This time the AdLib part (which applies
to FM-Towns, too, since it is more or less the same driver).
This fixes the sound when the bird is dropping from the
sky in the DOTT intro.
Also separate the GM code for SAMNMAX a bit after
checking the original code.
(General Midi Part only)
The bug report says that the AdLib part is broken, too. I am not sure about that device. For GM it was very obvious, though...
Albeit the code is marked as a hack inside the source, the original behaved
exaclty the same. If the code is removed the PC Speaker output will miss notes,
since unlike the original we only output to parts, which have an instrument set
up.
1) Don't skip transpose setting in sysex command 0. There are only a few sounds where this setting is used (mainly sfx).
2) Make MI2 and INDY4 read certain player start parameters from the sound resource. The start parameters usually match our default parameters (exception: e.g. LeChuck's Fortress). The use of these parameters has been dropped in DOTT (they use default parameters like we do).