Commit Graph

40 Commits

Author SHA1 Message Date
Donovan Watteau
5b1ec56f96 JANITORIAL: Fix some lost or outdated URLs in comments 2022-05-19 07:57:31 +03: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
b55b1da128 AUDIO: Add arbitrary MIDI instrument remapping
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.
2022-05-09 17:19:42 +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
Orgad Shaneh
af529f568b AUDIO: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 13:41:02 +02:00
Coen Rampen
e4887696a9 AUDIO: Fix ineffective version prop on Miles AdLib
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.
2021-11-04 22:15:38 +01:00
Coen Rampen
dfb8db2ae2 AUDIO/MIDI: Add dual OPL2 support to Miles AdLib driver
This adds support for the dual OPL2 chip configuration to the Miles AdLib MIDI
driver.
2021-08-12 14:30:52 +02:00
Coen Rampen
994609e91c AUDIO/MIDI: Make Miles pitch bend range v3 specific
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.
2021-08-08 22:12:06 +02:00
Coen Rampen
54663b953a AUDIO/MIDI: Fix Miles AdLib initialization
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.
2021-08-06 21:01:09 +02:00
Coen Rampen
d73b19b9b3 AUDIO/MIDI: Fix Miles 3 AdLib pitch bend range
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.
2021-08-06 21:01:08 +02:00
Coen Rampen
2edc3773bc AUDIO/MIDI: Fix Miles AdLib fades
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.
2021-07-29 20:24:42 +02:00
Coen Rampen
55fadd03a1 AUDIO/MIDI: Change Miles AdLib creation type to multisource
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.
2021-07-13 22:11:58 +02:00
Coen Rampen
5c287139b3 AUDIO/MIDI: Add partial multisource support to Miles AdLib driver
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.
2021-07-09 15:20:50 +02:00
NMIError
7857df2ea9 MIDI: MT-32 / GM driver
This adds a new MidiDriver subclass with functionality
for MIDI based devices like the MT-32 and GM devices
or emulators.
2020-11-28 17:59:15 +00:00
Vladimir Menshakov
201d2675ad AUDIO: Replace memsets on structures with ctors with ARRAYCLEAR() 2020-08-31 21:57:14 +01:00
Eugene Sandulenko
4da444f238 AUDIO: Added override keywords 2020-03-09 16:08:19 +01:00
Zvika Haramaty
3b4810aab4 AUDIO: Added dump-midi mechanism
This mechanism is enabled by '--dump-midi' command line parameter.
The midi events are printed to screen, and dumped to 'dump.mid' file.
2020-02-28 08:27:12 +02:00
nukeykt
e5bfead345 SCUMM HE: Use Miles AdLib driver 2018-02-04 12:56:06 +01:00
Eugene Sandulenko
355c4fa646 JANITORIAL: Remove more trailing spaces 2016-10-09 15:02:02 +02:00
Ori Avtalion
3564032330 JANITORIAL: Reduce audio header dependencies 2016-04-14 16:10:21 +03:00
Matthew Hoops
bed9da8b9d AUDIO: Remove all AudioStream access to OPL 2015-07-07 20:19:47 -04:00
Matthew Hoops
22d985f3c2 AUDIO: Use the built-in OPL timer for MidiDriver_Miles_AdLib 2015-07-07 20:19:45 -04:00
Matthew Hoops
2e8f9dcec9 AUDIO: Remove the sample rate configuration from the OPL code 2015-07-07 20:19:42 -04:00
Martin Kiewitz
76f21a2101 AUDIO: Miles Audio AdLib: set default volume 0x7F
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
2015-07-05 21:25:22 +02:00
Martin Kiewitz
ba66236c2e AUDIO: Miles Audio AdLib: OPL3 detect for timbre
tries to detect OPL3 availability and prefers OPL3 timbre data
in that case.
2015-07-05 12:17:17 +02:00
Martin Kiewitz
2104f41521 AUDIO: Miles Audio AdLib: support AD+OPL3 streams
- 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
2015-07-05 01:08:40 +02:00
Torbjörn Andersson
ef5eda2279 AUDIO: Make Miles AdLib audio stream permanent
This protects it from any calls to stopAll() in the mixer, which
is needed for Return to Zork, at the very least.
2015-07-05 00:08:15 +02:00
Martin Kiewitz
9745c97df8 AUDIO: Miles Audio AdLib: read OPL3 timbre bugfix 2015-07-04 21:59:14 +02:00
Martin Kiewitz
8e47091829 AUDIO: Miles Audio AdLib: read AdLib+OPL3 file
Checks if at least one of those exists and reads the one that does
Needed for another version of Simon The Sorcerer 2, that only
features FAT.OPL
2015-07-04 21:33:41 +02:00
Martin Kiewitz
96005c7da9 AUDIO: Miles Audio AdLib instrument stream support
- not using byte pointer + size and instead now a
  SeekableReadStream for factory
- adjusted ACCESS + AGOS engines accordingly
2015-07-04 12:55:49 +02:00
Martin Kiewitz
d6bf970a58 AUDIO: Miles Audio: pass strings via reference 2015-07-03 02:49:49 +02:00
Martin Kiewitz
04146fc9b3 AUDIO: Miles Audio AdLib: fix instrument load code
clean up, uses separate non-const pointer for reading file
and a const pointer for actually parsing the data
2015-07-03 02:05:26 +02:00
Martin Kiewitz
1d173d4811 AUDIO: Miles Audio AdLib: fix comment
Sherlock Holmes was mentioned instead of Miles Audio
2015-07-02 13:35:54 +02:00
Martin Kiewitz
903309fbb7 AUDIO: Miles Audio AdLib: implement sustain
fixes broken music in Return To Zork (demo)
also added comments about those special cases (useful for testing)
2015-07-02 13:17:21 +02:00
Martin Kiewitz
50d9fb24d3 AUDIO: Miles Audio AdLib: init panning to 63
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.
2015-07-02 12:53:20 +02:00
Martin Kiewitz
3bb36663f3 AUDIO: Miles Audio AdLib: timbre data via data-ptr
add ability to pass timbre data directly to the AdLib Miles
Audio driver as well
2015-07-01 01:28:24 +02:00
Martin Kiewitz
f3df43dcbb AUDIO: Miles Audio AdLib: initialize variable
initialize currentPitchRange (although it was properly initialized
later anyway)
2015-06-29 13:37:34 +02:00
Martin Kiewitz
d1fe3d1aa3 AUDIO: miles audio AdLib: fix left/right panning
channels were (wrongly) reversed
found and tested in discworld 1
2015-06-28 02:22:51 +02:00
Martin Kiewitz
0655839a4f COMMON: move Miles Audio AdLib+MT32 to common
- 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
2015-06-27 22:44:39 +02:00