12 Commits

Author SHA1 Message Date
Cameron Cawley
5b1b14ad80 COMMON: Mark more symbols as const 2023-12-26 20:23:59 +01:00
Coen Rampen
36001426dc ULTIMA/NUVIE: Rework music code
This commit adds a MidiParser implementation for Ultima 6's
M format and MidiDrivers for AdLib and MT-32. This replaces
the old implementation based on AdPlug, which supports
AdLib only and does not have ScummVM's support for various
OPL emulators and devices.

Music for Savage Empire and Martian Dreams has been
temporarily disabled, because these games use a different
music format and there is no MidiParser yet.
2023-11-09 18:19:25 +01:00
Coen Rampen
8915aa3277 Revert "ULTIMA/NUVIE: Rework music code"
This reverts commit 911173f34e28a470ea11eda6625ab323ff4014cd.
2023-11-07 22:06:52 +01:00
Coen Rampen
911173f34e ULTIMA/NUVIE: Rework music code
This commit adds a MidiParser implementation for Ultima 6's
M format and MidiDrivers for AdLib and MT-32. This replaces
the old implementation based on AdPlug, which supports
AdLib only and does not have ScummVM's support for various
OPL emulators and devices.

Music for Savage Empire and Martian Dreams has been
temporarily disabled, because these games use a different
music format and there is no MidiParser yet.
2023-11-07 20:58:54 +01:00
Coen Rampen
b2cf9a580b AUDIO: Add AdLib MS driver callback frequency
This change allows a consumer to specify the desired timer callback frequency
for the AdLib multisource MIDI driver.
2022-05-09 17:19:44 +02:00
Coen Rampen
6a9fc73962 AUDIO: Small MIDI driver enhancements and fixes
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.
2022-05-09 17:19:43 +02:00
Coen Rampen
734817597b AUDIO: Add rhythm mode support to AdLib MS driver
This adds support for the OPL rhythm mode to the AdLib multisource MIDI driver.
Some games (f.e. Simon 1) use this to generate the rhythm sounds of their music.
2022-05-09 17:19:41 +02:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Coen Rampen
b70ab20fc8 AUDIO: MIDI controller defaults on track start
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.
2021-11-17 21:54:59 +01:00
Coen Rampen
d8491ecea4 AUDIO: Add default for OPL channel volume
This adds an option to the AdLib multisource driver to set the MIDI channel
volume that will be used to initialize to OPL 4x registers.
2021-10-09 16:59:44 +02:00
Coen Rampen
d897fe590e AUDIO: Fix struct and const init, add missing breaks 2021-07-02 15:40:13 +02:00
Coen Rampen
d8c3e22a54 AUDIO/MIDI: Add multisource AdLib MIDI driver.
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.
2021-07-02 14:16:50 +02:00