This commit enables the Accolade AdLib driver's OPL3 mode for Elvira 1. It adds
some extra notes, most notable in the intro track. A small fix is applied to
one of the instruments in the intro track to make it work properly with this
mode.
This change improves the accuracy of the timing of the AdLib SFX of Elvira 2
and Waxworks. The frequency of the SFX script timer is now synchronized with
the callback timer of the AdLib driver, which makes the timing of the OPL
register writes match that of the original interpreter.
This adds support for the AdLib and MT-32 sound effects in Elvira 2 and
Waxworks. It adds an option to the UI to toggle between sampled and
synthesized SFX. It also adds the following enhancements:
- AdLib OPL3 mode for Elvira 2, Waxworks and Simon 1 floppy demo. This can be
selected using a new UI option.
- Mixed AdLib/MIDI mode for Elvira 2 and Waxworks.
- Implemented "monophonic chords", a feature of the original MIDI code which
would play only the highest note of a chord on AdLib. Most noticable in the
Waxworks music.
- Added UI option to select Simon 1 DOS music tempos.
- Rewrite of the AdLib and MT-32 drivers to remove duplication and make use of
features of the standard multisource drivers.
- Refactored MidiPlayer to standardize interface and remove code moved to the
drivers and parsers.
The AGOS PC-98 MIDI driver did not check the native_mt32 flag when determining
the type of MIDI device. This would cause a hardware MT-32 or external
softsynth to be treated as a GM device.
This commit fixes this by adding the missing check.
This updates the Simon 1 DOS AdLib driver and adds an AdLib driver for Windows.
The DOS driver now has OPL3 support, which eliminates the note cut off that
frequently occurs on an OPL2. It also allows for some limited use of stereo.
The driver now plays the floppy SFX accurately compared to the original
interpreter. It also implements multisource functionality, allowing for
separate volume control for music and SFX for the floppy version.
The Windows driver just maps the MT-32 instruments of the Simon 1 MIDI data to
the equivalent GM instruments.
At this point, the driver still tries to play notes at the maximum
allowed volume or louder, but ScummVM's music volume setting can bring
them back down to the expected range. That may have to be good enough
for now.
Also, since the master volume is only used internally there's no need to
keep converting back and forth. Just use the interval 0-255 throughout.
After feedback from NMIError, and some more guesswork. The master volume
isn't applied until noteOnSetVolume(), so that the correct adjusted
volume can be stored in the channel data structure.
Now the volume seems too low to me, but of course that could be fixed by
having some other default value than 15 for _masterVolume.
Because only the unused channelVolueAdjust value was clipped, the actual
velocity of the note would often overflow, causing the note to be almost
muted instead of played at full volume.
I assume it was an oversight that chanelVolumeAdjust wasn't used, so
I've fixed that and moved the clipping to after all adjustments have
been made. Also eliminated some unneeded floating-point math.
Is it correct now? I honestly don't know. It seems that, at least in
Waxworks, almost all notes end up being played at max volume. But maybe
that's how it should be?
I have also made the necessary changes to the PC-98 audio drivers which were written to work around the current situation, but now also need a different order in the destructors.
These were broken by the last PR merge which included a cpp file in a
way which will not build reliably. This splits the Accolade MIDI driver
structure definitions into headers allowing these to be included
instead.
Also, minor cleanup by removal of unused header includes.
- renamed _MT32 to _nativeMT32
this name doesn't really make sense, because MUNT isn't a native
MT32, but the name is common to the other engines
- implement MT32 -> General MIDI mapping in case no MT32 is
available
- implement dialog screen, so that user is told about General MIDI
mapping and that it may sound awful
- Kirben told me that Elvira 2 is shipped with MUSIC.DRV and
INSTR.DAT file. Using MUSIC.DRV file makes the music work properly
I couldn't check, b/c I own none of these games.
- also commented out implemented bug of INSTR.DAT/MUSIC.DRV
This bug only affected the adlib drivers, so I guess we should
rather fix it instead of implementing the same buggy behavior
- both known variants are supported (INSTR.DAT + MUSIC.DRV)
- INSTR.DAT/MUSIC.DRV holds channel mapping, instrument mapping, etc.
- fixed bug inside S1D MidiParser, that ruined some instrument changes
0xFC header was seen as 2 byte header, but it's 4 bytes in Elvira 2
and 5 bytes in Waxworks / Simon 1 demo
- dynamic channel allocation for the MUSIC.DRV adlib driver is not
implemented atm, simply because at least the demos of Waxworks and
Simon 1 do not use this feature
- sound effects of Waxworks are not implemented atm
- note: the game "Altered Destiny" uses Accolade INSTR.DAT variant too