- avoid sending unnecessary sysex messages
- add a delay after certain sysex messages
(but without calling OSystem::delayMillis(), since
that has negative impact on the playback).
The builds distributed over the website have long version strings
(which include the revison number) that don't fit the MT-32 display.
So we just trim them after the version number...
If infoStr was longer than 20 characters, 20 - infoStr.size() would turn
into a very large positive number, causing the string-padding loop to
run "forever".
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.
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...
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)
Make sure GM init is only done with an actual GM setup.
These are mostly the same checks we already do in the
engine, but it still seems better to do this
In SAMNMAX the player wouldn't properly distinguish between GM and AdLib, because the sound all have the same 'Midi' tag. Now, this gets tested in a way than works for all targets.
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...
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.
The size in snprintf includes the final null character, so here
3 bytes are not enough to store a space, 2 digits and the null
character.
The compiler complained and the output used to display 1 digit
instead of 2, for each byte.
Extend this size from 3 to 4 in the snprintf call.
After the initial changes just to scummvm/gui for u32, this commit includes the whole project
- Widget creations now always have u32 descriptions, labels, or tooltips
- Message dialogs make use of default arguments instead of providing the same argument explicitly
- encode String::format properly before passing on as argument where necessary
- Modify hugo utils (yesNoBox and notify box) to use u32
- Also provide fake constructors for the above which redirect to the u32 constructor
- Convert all keymap descriptions to u32 across all engines
- showConfirmationDialog in mohawk now uses u32
- showScummVMDialog also uses u32
- Scumm engine has dialogs now which use u32
- General fixes and wrapping convertToU32String for setLabels and related functions
- Add a fake constructor to MesssageDialog which redirects to the u32 constructor