Commit Graph
199 Commits
Author SHA1 Message Date
athrxx 50b5e14a73 SCI: (BRAIN) - remove redundant function 2022-11-06 14:13:48 +02:00
athrxx 47763f7bc1 SCI: (BRAIN) - fix music pause bug
When skipping the intro via 'Esc' and 'Skip' the script
sets up a pause which it won't release later. This brings
our pause counters out of sync and triggers an assert.
This fix should work around this...
2022-11-06 14:13:48 +02:00
Hubert Maier 280698c375 SCI: Correct spelling mistake
accomodate -> accommodate
2022-10-27 15:57:28 +02:00
sluicebox 6d2c4222b3 SCI32: Fix LIGHTHOUSE stuttering sounds
Works around script bugs in the original game that often accidentally
worked because of the time it took the original interpreter to load and
begin playing a sound.

Fixes bugs #10224, #10231, #10232, #10237, #10238
2022-10-09 11:23:05 -04:00
sluicebox 3c6ebd89c0 SCI32: Fix kDoSoundPause sample behavior in LSL6HIRES
Fixes bug #13555
2022-08-26 01:01:45 -07:00
sluicebox 987354c5fa SCI: Fix kDoSoundFade SCI1+ behavior when sound not playing
In SCI1 and later, kDoSoundFade does not test a sound's status.
Incoming fade properties are applied regardless of whether the
sound is playing and kDoSoundFade does not set the signal.

The code that's been doing this was added and updated in 2010
for ICEMAN and LSL3. Now it's only applied to SCI0 calls.
e41874c91d
f743468ec7

Verified in QFG2 1.000, JONES CD, and LB2 CD.

Fixes scenes in LB2 where multiple songs occasionally play at the
same time due to broken fade-outs. Hiding behind the tapestry
during a meeting is the one that occurred the most consistently.
Related to bug #6462
2022-08-19 07:12:28 -04:00
sluicebox db7699c65a SCI: Set correct SCI1.1 fade-complete signal value
As the comment says, the signal value is 0x00fe.

Verified in LB2 CD interpreter.
2022-08-19 07:12:27 -04:00
sluicebox befeca6c9b SCI: Fix kDoSound redundant fade detection
Fixes two discrepancies in redundant fade detection that were discovered
while investigating LONGBOW bug #13674:

- MusicEntry::fadeTo was altered even when the fade was ignored
- Redundant fades are allowed in SSCI when the stopOnFade flag is passed
2022-07-30 16:39:25 -04:00
sluicebox d2d46b67c5 SCI: Fix KQ5 bandit music fade workaround
The existing workaround prevented a crash but it performed volume tests
on an object's offset and abruptly ended the bandit music instead of
fading it out as in the original.

The broken kDoSoundFade call is redundant because a second script calls
kDoSoundFade correctly at the same time. Now the broken call is ignored
and the music fades out normally.

Bug #5078
2022-07-30 16:39:24 -04:00
sluicebox a5833242a1 SCI: Fix compiler warning 2022-06-06 17:30:47 -04:00
athrxx cab7e386f2 SCI: fix regression from c2975276 (fix music handling during auto-save)
This is really a necessary fix, so recommended for merging before the release.

The negative global pause counter (that I really added only for the GMM/autosave situation) may not be used from within kDoSoundPause. It causes issues, the counter will go out of the expected range (also, the "Music also seems to randomly disappear when saving / restoring games" mentioned in ticket no. 13496 might be related to this).

I didn't see this, since we were focussed on SCI0. But it can be easily tested with e. g. LSL1 VGA. Just save right at the start and restore the game, it will call kDoSoundPause and trigger the issue...
2022-06-02 11:19:58 +03:00
sluicebox fd146d77d0 SCI32: Initialize Sound:handle for non-preload samples
Fixes bug #13500 where LSL6HIRES doesn't play the audio for the death
message after the security guard launches a missile.

Thanks to @RayKoopa for reporting this and other discrepancies
2022-05-27 02:07:37 -04:00
athrxx 311b6fec1a SCI: fix sound pausing when loading via kRestoreGame
This is similar to what we recently fixed for the saving. It does concern only the loading from the SCI menu and from the SCI death dialog (that's how it got my attention).

I have written a long comment in SciMusic::resetGlobalPauseCounter()  which explains it.

I have decided to make this very obvious (you could say: more ugly), so it won't cause confusion in the future. Of course, it could be just hidden somewhere deep in SciMusic::saveLoadWithSerializer() and noone would ever notice. But the "ugly" way seemed the safer thing to do...
2022-05-20 09:55:07 +03:00
athrxx 6c6960b593 SCI: fix bug no. 10183 (QFG1EGA: Baba Yaga's hut sound bug)
Actually its two bugs that both come to surface in that hut... one in SoundCommandParser::processInitSound() and one in SciMusic::soundStop().
2022-05-18 21:54:26 +03:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
sluicebox b0ce6a2d79 SCI: Improve SQ4CD selection of digital samples
- Windows-only samples now respect "Prefer digital sound effects" config
- Windows-only samples now only applied when a regular digital sample
  doesn't exist. This is SSCI behavior and mildly affects two sound
  effects in the monolith burger mini-game. Confirmed in disassembly.
- Windows-only samples now play in Windows mode and DOS samples and
  MIDIs play in DOS mode.
- Default audio experience now matches the selected platform.
2021-05-18 18:33:55 -06:00
athrxx 5a626c8b78 SCI: (SCI0 sound) - fix sound restoring
This mainly concerns restoring sounds after loading savefiles, but it should make the whole relationship between playing and paused sounds more accurate.

The test case which I was told about was KQ4, room 21, picking up the golden ball under the bridge, saving during playback of the pickup sound and then loading that savegame. It would result in hanging note due toe the sound being triggered multiple times by reconstructPlaylist() and updateSci0Cues(). Now, the sound should only start once.

I've changed the code to be more in line with disasm and tested some situations that sluicebox told me about or that I found in the comments (ICEMAN room 14, LSL3 start scene). I got rid of isQueued, since the original doesn't have that, it has caused some confusion and doesn't even get saved with the savegames.

I cleaned up updateSci0Cues(), so that it (together with processUpdateCues()) does a bit more what the original Midi timer proc does there. An exception is the sound fade out code in processUpdateCues(). It seems that we need that, as we don't have the fading code in the drivers like the original.

The original SCI0 code is actually much simpler than our code. It relies on a correctly sorted playlist (based on priority), but my impression is that we got that right, even if we do it slightly differently. I added a sortPlayList() to the sound init, since the original inserts the node at the right position, too.
2021-03-13 17:41:54 +02:00
sluicebox ad336de7bb SCI32: Fix kDoAudioPlay regression
Fixes kDoSoundPlay crash when called from an SCI32 game, introduced in
364542e9e1
2021-02-26 01:19:57 -08:00
sluicebox 9982c761a2 SCI: Update all old bug tracker ticket numbers 2021-02-25 01:18:52 -08:00
sluicebox 364542e9e1 SCI: Fully implement kDoAudio(13) for PHARKAS CD
Now that we match SSCI behavior when it comes to interrupting samples
when new samples play, we need to implement kDoAudio(13) so that the CD
version of Freddy Pharkas can detect these interruptions. Otherwise,
the game will softlock if the points sound effect or narration is
interrupted.
2021-02-23 18:22:25 -08:00
sluicebox de9443407f SCI: kDoAudio stops samples played with kDoSound 2021-02-22 14:57:02 -08:00
sluicebox beee3b5f25 SCI: kDoSoundPlay now restarts MIDIs already playing
Fixes KQ6CD wallflower lockup, bug #10812
Fixes QFG4 door bell puzzle, bug #12105
2021-02-14 01:20:14 +02:00
Filippos Karapetis bd7e708fc3 SCI: Move resource related functionality into a separate folder 2020-11-29 14:34:55 +02:00
Filippos Karapetis 76161cce3f SCI: Adjust comment 2020-05-24 12:42:59 +03:00
Zvika Haramaty a4e01b46f4 SCI: fix #10907 - Wrong music when restoring games 2020-05-24 12:42:58 +03:00
sluicebox 23fc7f52e0 SCI: Fix SoundResource error handling, ctor, dtor
Fixes several problems with the SoundResource class:

- Constructor doesn't fully initialize object if resource doesn't exist
- Destructor crashes if object not fully initialized
- Constructor has no mechanism to report failure
- Callers believe failure is reported by constructor returning null
- SoundCommandParser::initSoundResource attempts to pre-detect failure
  insufficiently in the absence of a formal mechanism.

SoundResource now always fully initializes, the destructor no longer
accesses uninitialized memory, and an exists() method has been added
which callers now test.

SQ6 Mac can now progress past the main menu.
2020-04-12 01:47:15 -07:00
Zvika Haramaty 0b747dba48 SCI: fix #9907 by choosing queued sound with highest priority 2020-03-17 09:34:45 +02:00
sluicebox 99a7478cd6 SCI: Update Sound:vol in processUpdateCues
Sound:vol is updated when updating cues starting in SCI_VERSION_1_MIDDLE.

Fixes bug #10244. SQ4 localized floppy versions depend on this when getting
in the orange ship, they fade music and wait for the volume to reach zero.

Confirmed against asm that this is not in SQ4 floppy (early) but is in
LSL1VGA (middle) and SQ4 localized floppies and SQ4CD (late).
2019-08-12 03:30:31 -07:00
Filippos Karapetis bcb044fa5b SCI: Fix typo 2018-08-28 02:03:50 +03:00
Filippos Karapetis 7cbd3782f1 SCI: Load the correct sound effects in Hoyle 4
Fixes bug #10412
2018-08-27 23:45:34 +03:00
Filippos Karapetis 16fab2d480 SCI32: Ignore invalid kernel call when toggling the music in Hoyle 5 2018-08-21 03:36:07 +03:00
Colin Snover 42180527c4 SCI32: Fix music volume not being restored after speech in Torin
This was a regression introduced by
d556dcc57b.
2017-10-06 22:11:02 -05:00
Colin Snover 93c8044f69 SCI32: Clean up Audio32
* Rewrap comments to 80 columns
* Remove resolved TODOs
* Use containers and smart pointers where appropriate
2017-10-06 22:10:52 -05:00
Colin Snover 7feccaaa98 SCI32: Implement SCI3-variant volume handling
Trying to find differences in Lighthouse's audio sample playback,
I discovered that SCI3 had its own variant of handling volumes and
sending this volume information back to game scripts. It is not
known if this fixes any sound bug.
2017-09-27 20:27:33 -05:00
Martin Kiewitz d9dfca2fcb SCI: SQ4: Now using additional and enhanced Win3.11 samples
Which were originally only played, when using the Windows interpreter.
Afaik the DOS interpreter was incapable of playing more than 1
sample at a time, which was probably the reason why Sierra only
added these for the Windows interpreter.

For example a sample is now played, when points are awarded.

Those samples are currently used all the time and will also
enhance the game, when platform DOS is chosen.
In case someone wishes to opt-out of this, we could add a game
specific option.

We do something like this for Space Quest 3 already,
that's why I don't see a reason to add a game option right now.
2017-09-25 00:44:04 +02:00
Colin Snover 200c8c442b SCI: Remove dead code 2017-09-10 22:17:17 -05:00
Colin Snover 87895b97f7 SCI: Fix looping of sounds that are not initialized yet
This fixes at least the character selection screen in QFG4CD,
where the sound for the torches is supposed to loop, but wasn't
because kDoSoundSetLoop would bail out before setting the loop
property on the soundObj.
2017-06-18 21:42:58 -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 eb9965274d SCI32: Fix race conditions in Audio32 2017-04-23 13:07:25 -05:00
Colin Snover 3303a88139 SCI: Improve audio volume & settings sync code
This patch includes enhancements to the ScummVM integration with
SCI engine, with particular focus on SCI32 support.

1. Fixes audio volumes syncing erroneously to ScummVM in games
   that modify the audio volume without user action (e.g. SCI1.1
   talkies that reduce music volume during speech playback). Now,
   volumes will only be synchronised when the user interacts with
   the game's audio settings. This mechanism works by looking for
   a known volume control object in the stack, and only syncing
   when the control object is present. (Ports and planes were
   researched and found unreliable.)

2. Fixes audio syncing in SCI32 games that do not set game
   volumes through kDoSoundMasterVolume/kDoAudioVolume, like GK1,
   GK2, Phant1, and Torin.

3. Fixes speech/subtitles syncing in SCI32 games that do not use
   global 90, like LSL6hires.

4. Fixes in-game volume controls in SCI32 games reflecting
   outdated audio volumes when a change is made during the game
   from the ScummVM launcher.

5. Fixes SCI32 games that would restore volumes from save games
   or reset volumes on startup, which caused game volumes to be
   out-of-sync with ScummVM when started.

6. ScummVM integration code for audio sync has been abstracted
   into a new GuestAdditions class. This keeps the ScummVM-
   specific code all in one place, with only small hooks into the
   engine code. ScummVM integrated save/load code should probably
   also go here in the future.

Fixes Trac#9700.
2017-04-21 19:00:27 -05:00
Colin Snover 53ab0b2805 SCI32: Fix broken background volume in Torin during speech 2016-07-11 16:23:46 -05:00
Colin Snover e8552cf96c SCI32: Fix audio fading 2016-07-01 12:42:39 -05:00
Colin Snover f02107f682 SCI: Minor cleanup of kDoSound
Replaces unused kernel calls to use kEmpty, and set correct
signatures for SCI32 kernel calls.
2016-06-20 21:02:21 -05:00
Colin Snover 46551fd4b5 SCI32: Rewrite digital audio engine
This provides a complete implementation of kDoAudio through
SCI2.1mid, plus partial implementation of SCI3 features.

Digital audio calls shunted through kDoSound have also been
updated to go through the SCI32 audio mixer, though these shunts
are a bit hacky because the ScummVM implementation of kDoSound
does not currently match how SSCI kDoSound is designed.

It is probably possible in the future to just replace the SCI1.1
audio code (audio.cpp) with the new SCI32 code, since the major
differences seem to be that (1) SCI1.1 only supported one digital
audio playback channel (this is configurable already), (2) it
had extra commands for CD audio playback and queued sample
playback.
2016-06-20 21:02:21 -05:00
Colin Snover b51d60f85c SCI: Fix uninitialized read in SoundCommandParser 2016-06-12 20:28:34 -05:00
Ori Avtalion 3564032330 JANITORIAL: Reduce audio header dependencies 2016-04-14 16:10:21 +03:00
Filippos Karapetis 6958aa9890 SCI: Separate the demos of QFG4, PQ4 and GK1 from their full versions
The demo versions of these games were using a very different engine -
SCI1.1 vs SCI2/SCI2.1. Thus, we split them into different game IDs,
to avoid mixing specific game checks for them, as well as specific
game workarounds, which are different for the demos than the full
versions. Also, the demos should be working when SCI32 is disabled.
For these games, we don't use ADGF_DEMO, to avoid game IDs like
foodemo-demo
2016-03-08 20:36:02 +02:00
Willem Jan Palenstijn 4f6f0fb148 SCI: Fix digital audio
Regression from 5028487038, where I assumed all songs were MIDI.
2015-02-18 09:33:03 +01:00
Willem Jan Palenstijn 2b49b5f95e SCI: Fix sound object frame selector rate
Thanks waltervn. Verified against asm (QfG2, KQ6CD)
2015-02-15 14:14:46 +01:00
Willem Jan Palenstijn 5028487038 SCI: Use sound resource priority by default for songs
SCI1 sound resources can have an embedded priority. We now use that by
default, unless an explicit DoSound/SetPriority call overrides it.
Thanks waltervn.

This fixes relative priority of songs in at least PQ3 room 29.

Also increase savegame version to 33.
2015-02-15 14:05:36 +01:00