This commit adds the following functionality to the MIDI drivers:
- Add checking if a driver is ready to process MIDI events for a specific
source (rather than any source). To facilitate this, SysExes can now be sent
using a source number. This is stored with the SysEx data in the SysEx queue
and can be checked when isReady is called with a source number.
- Allow specifying controller default values per MIDI channel. Currently this
is only implemented for program.
- The OPL dynamic channel allocation algorithm will now respect statically
allocated channels, in case a subclass uses combined static and dynamic channel
allocation.
It also fixes the following bugs:
- Instrument remapping can now be specified using const arrays.
- OPL instrument writing code is refactored to a separate function.
- OPL note on with velocity 0 would be handled as a note off, and then
continued to be processed as a note on.
- OPL writeFrequency would always write key on bit, even if the note is not
active.
- MT-32 default channel volume was incorrect.
This commit adds a function to the multisource MIDI drivers for specifying an
arbitrary instrument map for remapping the instruments in the MIDI data.
This is used for remapping instruments from two Simon 2 GM tracks to MT-32
because they are missing from the MT-32 MIDI data set.
This commit adds a feature to the multisource MIDI drivers which allows setting
a default value for most controllers. This default is then applied at the start
of every new track, which ensures controllers are in the correct state.
This can be used for games which use some controller, but do not reset it at
the start of each track, which can lead to incorrect playback.
Setting the Miles driver version property to 3 was meant to set the pitch bend
range to 2. In the AdLib driver, the pitch bend range was set during
construction, before the version property could be set, so this did not work
properly. This is fixed by moving the MIDI data initialization from the
constructor to the open function.
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 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 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.
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.
set default volume of every midi channel to 0x7F right on startup
fixes Amazon Guardians of Eden logo jingle music
those values were actually sent to the driver right on startup
default value for panning was 0x40, this was adjusted as well
- support AdLib + OPL3 streams
- also support stream(s) and filenames getting passed at the same time
in that case filenames are checked first, streams are used
as fallback
simon 2 + return to zork are getting output on one speaker only atm.
both games don't get panning controller at all and the original
driver itself definitely did initialize it to 0.
We initialize panning to 63, so that this gets fixed for the moment.
needs to get investigated further.
- remove Miles Audio from Sherlock engine
- put Miles Audio into common audio (namespace Audio)
- Miles Audio is used at least by the engines
TINSEL, GROOVIE, TOLTECS, SAGA and KYRA
This way it can be used by the other engines