Commit Graph
118 Commits
Author SHA1 Message Date
athrxx 037eec3144 SCI: implement SCI0 midi driver track initialization
I put this in an separate commit to make it easier to review/revert. I've tried to make this as minimum invasive as possible. That's why I put this in place of the former call to onNewSound().

SCI_0_LATE sound drivers (probably also SCI_0_EARLY, but I don't know that) do some midi track initialization, mostly resetting certain values and assigning voices (hardware channels) to midi parts. The information for this comes from the track header.

The SCI0 version of the PC-98 sound driver relies on this code. The driver checks the channel flags with two different masks and assigns different sound channel types accordingly. This can't be done with the 0x4B event. Using the 0x4B event is sort of counter intuitive anyway, since only some of the SCI0 drivers even support that event.

It seems that the only driver making use of onNewSound() was MT-32. I've adapted the driver to my changes, although I am quite sure that the sound will be unaffected. The only thing that the MT-32 driver does with the header information is checking whether a midi part should play or not and assign exactly one timbre (with exactly the same number) to that part if required.
2019-04-02 20:45:35 +03:00
Cameron Cawley 09dbe7686b JANITORIAL: Update all scummvm.org URLS to use https 2019-03-09 21:52:14 +01:00
Ruud Klaver 6843870af2 SCI: Set default MT-32 reverb before each sound
Set the default reverb configuration present in either the MT-32
patch data or MT32.DRV of SCI0 games before playing each sound, as
a previously played sound may have changed it.

Also, do not perform a general reverb init, since the start of a
sound will do that now.

Closes gh-1023.
2017-10-04 23:47:21 -05:00
Colin Snover d556dcc57b SCI: Switch SCI2 games to use Audio32
Upon investigation of Sound code across SCI32 games, it was
determined that there are actually (at least) 3 different
revisions, not just a single SCI2.1 version. This patch only
changes the parts of Sound code that are relevant to the correct
use of Audio32.

Fixes Trac#9736, Trac#9756, Trac#9767, Trac#9791.
2017-06-18 21:42:58 -05:00
Colin Snover 10a4e5d591 SCI32: Fix missing break statement 2017-04-23 13:07:25 -05:00
Colin Snover 4946f149b4 SCI: Improve MidiParser_SCI robustness against bad sound resources
1. KQ4 sound 104 has an extra 0xFC (MIDI Stop command/kEndOfTrack)
   at the end of the resource, which causes an out-of-bounds read
   because the filtering loop continues after the first 0xFC and
   unconditionally attempts to read 2 bytes (expecting there to
   always be a delta value + a command, whereas in this file there
   is only another kEndOfTrack command). This is corrected by
   exiting the filtering loop when a kEndOfTrack is encountered
   and there is not enough data remaining in the resource to
   continue reading.

2. KQ5 sound 699 is truncated, which causes the parser to attempt
   to read past the end of the resource. This is addressed by
   adding bounds checks that exit the mix loop early if there is
   no more data available to read. This allows truncated sounds
   to be played as far as possible (previously, trying to read
   truncated resources would result in a fatal error).

3. midiMixChannels allocates an arbitrary amount of raw memory
   for the mixed MIDI sequence, without performing any bounds
   checking when writing to this memory, potentially leading to
   a crash or silent corruption of adjacent memory. This is
   mitigated by using SciSpan instead of a raw pointer for the
   mixed data.

Fixes Trac#9727.
2017-04-16 12:23:35 -05:00
Colin Snover 5723f2f5fe SCI32: Hack around MIDI parser causing stuck harp animation in KQ7
The eventual proper fix for this is to change the current MIDI
parser to work the same as in SSCI, but for now this workaround
allows the game to continue.

Fixes Trac#9696.
2017-03-30 20:49:36 -05:00
Colin Snover 31daa956d6 SCI: Implement bounds-checked reads of game resources 2017-03-27 19:42:31 -05:00
Martin Kiewitz 0dd760724e SCI32: split up SCI2.1 into EARLY/MIDDLE/LATE
- Detection works via signatures (couldn't find a better way)
- new kString subcalls were introduced SCI2.1 LATE
- kString now has signatures and is split via subcall table
- kString fix, so that KQ7 doesn't crash, when starting a chapter
- Sci2StringFunctionType removed, because no longer needed
2015-12-29 01:44:11 +01:00
Willem Jan Palenstijn f477de2009 SCI: Add more audio debugging output 2015-02-15 18:28:57 +01:00
Willem Jan Palenstijn 165a8c26b9 SCI: Fix version check for MIDI controller 4E
This is only supported since SCI1 middle, as verified with xmas1990, SCI1 mgoose, SQ4 floppy, LSL1, Jones floppy.

Fixes missing sounds in Jones floppy.
2015-02-15 18:28:57 +01:00
Willem Jan Palenstijn 1c5722f014 SCI: Allow channel remapping from audio thread too 2015-02-15 14:05:56 +01:00
Willem Jan Palenstijn 0aadd20aea SCI: Add debugging output 2015-02-15 14:01:35 +01:00
Willem Jan Palenstijn f1e34f11d7 SCI: Initialize voice counts in SCI1+ 2015-02-14 16:06:55 +01:00
Johannes Schickel 8fc7d60feb SCI: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01:00
Alyssa Milburn bb1cd924f0 SCI: Fix breakage from f92df4c6 2014-01-27 10:10:35 +01:00
Willem Jan Palenstijn 857d2e7bef SCI: Rewrite MIDI channel remapping
This adds MIDI state tracking to allow channels to be temporarily
unmapped and later re-mapped when there are free device channels
available again.
2013-12-31 13:52:15 +01:00
Martin Kiewitz 551e263165 SCI: revert fix music start code
add workaround for eq2
the issue is known, but can't be properly fixed without rewriting the midiparser into a channel specific parser
previous commit caused issues in kq5/french and others
2013-09-22 20:13:33 +02:00
Martin Kiewitz f1b0a77408 SCI: fix music start code fixes eq2 bug #3037267
we start at offset 10 for sound SCI1 games. This is hardcoded in the interpreter. Also removing not handling signals on tick 0. This fixes Eco Quest 2 / Gonzales dancing in room 530. Thanks to wjp for the help.
2013-09-22 15:40:51 +02:00
Willem Jan Palenstijn 4b5ca10f68 Merge branch 'master' into sci_midiparser
Conflicts:
	engines/sci/sound/midiparser_sci.cpp
2013-09-21 20:05:47 +02:00
m-kiewitz 97b255ab33 SCI: fix dataInc signalling fixes bug #3035159
we set signal in parseNextEvent on dataInc events, which then effectively triggered 2 cues through kDoSoundUpdateCues instead of one. Fixes Freddy Pharkas Ballad intro on floppy + demos
2013-09-21 19:41:45 +02:00
Willem Jan Palenstijn a6d902df28 SCI: Handle !fireEvents in processEvent 2013-09-21 14:42:59 +02:00
Willem Jan Palenstijn 3792af8e95 AUDIO: Simplify SCI inFastForward flag by moving it to MidiParser 2013-09-21 09:31:08 +02:00
Willem Jan Palenstijn 11d425b76c SCI: Move MIDI event processing out of parseNextEvent 2013-09-21 01:43:04 +02:00
Willem Jan Palenstijn 5b23a251ce SCI: Fix too strict assert triggering in LSL5 2013-09-19 23:54:27 +02:00
m-kiewitz 1c9316cee0 SCI: longbow intro night rider fix (with help of wjp) - seems to fix bug 3489094 2013-09-16 00:34:49 +02:00
m-kiewitz 0fd15e6db3 SCI: fix tabs in last commit 2013-09-15 23:21:23 +02:00
m-kiewitz 0367d40647 SCI: disable signals when resuming music, so that debugger will work properly for longbow intro 2013-09-15 22:14:35 +02:00
Willem Jan Palenstijn 06cc30cf6c SCI: Add FIXME 2013-07-19 21:22:36 +02:00
Filippos Karapetis fef7d59c54 SCI: Rewrite the song loop comments in commit 6fa668e to make more sense 2013-07-08 12:32:12 +03:00
Filippos Karapetis 6fa668e32a SCI: Add some comments a possible TODO regarding song looping 2013-07-08 12:19:15 +03:00
Filippos Karapetis 0f30ba2f10 SCI: Fix bug #3614566 - "LSL6: ScummVM locks up at Electro-Shock room"
We now do the jumpToTick() for hold events after waiting for the delta
of the current event, like we do for the signal set events. This keeps
the fixes for the hold timings in QFG3, while not breaking LSL6.

Many thanks to wjp for pinpointing the actual cause of the issue.
2013-07-07 19:41:42 +03:00
Willem Jan Palenstijn f280789afe SCI: Don't suppress loop delta in SCI1 midi
This fixes bug #3293354.
2013-04-16 23:10:09 +02:00
Willem Jan Palenstijn 457f5da095 SCI: Don't suppress end-of-track delta in SCI0 midi
This fixes the main part of bug #3487090.
This seems to be a conversion error from SCI1's channel mixing to SCI0's
channel filtering code.
2013-04-16 23:04:33 +02:00
Willem Jan Palenstijn 841b6ca540 SCI: Revert "Add a more generic solution for the problem found in bug #3605269"
This reverts commit c6320a28e4.
SSCI does not interpret signals on other channels than 15.

Conflicts:
	engines/sci/sound/soundcmd.cpp
2013-04-05 21:14:55 +02:00
Filippos Karapetis c6320a28e4 SCI: Add a more generic solution for the problem found in bug #3605269
We now accept signals from all channels if channel 15 is missing. This
is a very rare edge case, but our behavior is now somewhat closer to what
the original interpreter seems to be doing. Mordack's appearance animation
is now synced properly. The more generic workaround works for songs 1840
and 1843, but not for 1849, which is still problematic and we still resort
to manually changing its dataInc selector
2013-04-02 10:03:48 +03:00
Alyssa Milburn f08978a075 JANITORIAL: Remove underscores from MidiParser variable names. 2012-09-07 23:04:34 +02:00
Filippos Karapetis 38dc6640dc SCI: Reset parameters for all channels used by a song when it starts 2011-11-20 20:59:31 +02:00
Filippos Karapetis 2798c65d75 SCI: Fixed bug #3297883 - "SCI: LB1 (Amiga) - Intro stuck" 2011-08-28 14:07:42 +03:00
Filippos Karapetis 4f3b85f4ef SCI: Fixed bug #3311911 - "SCI: QFG3: Intro music abruptly stops" 2011-08-26 11:30:19 +03:00
md5 3b75ff9132 SCI: Added a warning for SCI0 games like in bug #3297881
LB1 Amiga doesn't contain MT-32 music tracks. Added a warning for this
situation
2011-05-12 04:34:20 +03:00
strangerke 69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
Filippos Karapetis 0312235f67 SCI: Removed bogus warning
svn-id: r54512
2010-11-27 18:27:02 +00:00
Filippos Karapetis 49afe9ccff SCI: Fix for bug #3119713 - "PQ2: song-specific reverb changes are ignored" (thanks to waltervn)
svn-id: r54509
2010-11-27 17:29:42 +00:00
Walter van Niftrik 52b89206c0 SCI: Pull reverb default directly from control channel.
svn-id: r54499
2010-11-26 14:35:46 +00:00
Filippos Karapetis e793d62c8d Fixed bug with r54485
svn-id: r54488
2010-11-26 00:10:51 +00:00
Filippos Karapetis 069309f88a SCI: set the reverb setting of the current song when a relevant event is fired from the MIDI stream
svn-id: r54485
2010-11-26 00:05:27 +00:00
Filippos Karapetis 11ac03b7ab SCI: Global reverb can't be 127. Some cleanup
svn-id: r54482
2010-11-25 22:16:22 +00:00
Filippos Karapetis 601494cad4 SCI: implemented reverb handling and related functionality
svn-id: r54478
2010-11-25 16:09:45 +00:00
Filippos Karapetis dcd1326970 SCI: Some renaming and added several TODOs concerning reverb
svn-id: r54461
2010-11-24 16:01:30 +00:00