The Roland GS MT-32 emulation option would not select the MT-32 drumkit on the
GS device, because the drumkit change was filtered out in the MT32GM driver.
This commit fixes this by adding an exception for this drumkit change when GS
MT-32 emulation is active.
This adds a command queue to the PC speaker emulator for PWM-style sounds that
need timing of less than a millisecond. The play method only supports
milliseconds and requires real time control, which is difficult to achieve with
microsecond timings.
The new playQueue method allows you to queue up playback instructions with
microsecond timing, which are executed when audio samples need to be generated.
The empty OPL instrument check would check only the ADSR envelope fields for 0,
assuming this would mean the instrument would produce no sound. However, some
of these fields are flipped, i.e. max value would produce no sound. So this
shortcut was invalid. It is replaced by checking all fields for 0.
This adds a timer proc to the null multisource MIDI driver to drive the fading
process. The null driver does not have any audio to fade, but without this the
fades will just hang and isFading will remain true. The fades are now
effectively timers so game behavior will remain consistent whether MIDI is
turned on or off.
Miles version 3 introduced support for the MIDI pitch bend range RPN using the
data entry MSB controller. The ScummVM implementation would also process this
controller for Miles version 2 games. This caused a problem in Ultima 8, which
used Miles 2 and which had MIDI data that contained some (probably leftover)
data entry MSB events. These had no effect in the original interpreter, but in
ScummVM they caused the pitch bend range to change, resulting in incorrect
playback.
This is fixed by only processing the data entry MSB controller events when
Miles version is set to 3.
The default source neutral volume for the Miles MIDI driver is set at 256.
However, the default source volume was the same as that of the regular MT-32/GM
driver: 255. This would cause a small volume decrease if a game did not set
source volume.
This commit fixes this issue by setting the default source volume for the Miles
MIDI driver at 256.
The ScummVM Miles AdLib driver would write some different initialization values
to the OPL registers than the original Miles drivers did. The most significant
difference was the amplitude and vibrato depth.
This commit changes the Miles AdLib driver to set the same values as the
original drivers. It also adds support for initializing a dual OPL2
configuration.
Miles 2 uses the default MT-32 pitch bend range of 12 semitones for its AdLib
driver. Miles 3 switched to the default GM pitch bend range of 2 semitones for
AdLib. ScummVM would always use the Miles 2 pitch bend range, which caused
pitch bend for Miles 3 games to sound wrong on AdLib.
To fix this, a property was added to the Miles AdLib driver to specify which
Miles version to emulate. Depending on the value of this option, the correct
default pitch bend range is set.
This fixes some issues which caused the fades in the Miles AdLib driver to not
work properly:
- _timerRate was not set
- end of track meta event was not handled, so active fades were not aborted by
deinitializing the source on end of track
The timerProc fields and onTimer function were removed because they duplicate
functionality from the MidiDriver_Multisource base class.
This adds a MidiDriver property which controls the Miles AIL/MSS version to
emulate. This controls the initialization of MT-32 and GM devices. MSS v3 added
GM support, which caused some differences between v2 and v3 in how MIDI devices
are initialized. Some games might rely on certain default settings for correct
playback.
This changes the return type of the Miles AdLib MIDI driver factory function to
the recently introduced superclass MidiDriver_Multisource, which allows for
easier use of multisource functionality for consumers of the factory function.
This adds applying source volume for all sources to the Miles MIDI driver. This
was missing and caused changes to user volume not to be applied for some games.
Adds an implementation of the multisource interface to the Miles AdLib driver.
This partial implementation only supports the volume management functions and
the use of a single source (0), which is sufficient for most games (that only
use MIDI for background music). Full multisource support will be added later.
This adds a MIDI driver for AdLib / OPL2 and OPL3 with support for multiple
simultaneous sources of MIDI data. Additionally, it is easier to subclass the
driver and customize its behavior than the existing AdLib MIDI driver. The
standard behavior matches the Windows 95 SB16 driver.
This is so that individual audio players can share the same mutex as the
mixer. When they have their own, it's apparently quite easy to
accidentally introduce deadlocks. Particularly when the audio player is
shut down.
At least it seems to me that the way e.g. Lure of the Temptress calls
isReady() to see if the driver has finished processing all the custom
sounds, _sysExQueue can be accessed by two threads simultaneously.
Which seems like a bad thing to me!
Identified by coverity - if the module load fails, _mixBufferSamples could be
left as an invalid pointer, which would cause a problem in the destructor.
Moved most things to initailizer list to avoid the problem.
Coverity still identifies a lot of uninitialized members, but they should all
get initialized when playback starts and have less chance of causing real bugs.