Commit graph

184 commits

Author SHA1 Message Date
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
Willem Jan Palenstijn
58ef44eb8d SCI: Register and save playBed option to PlaySound
The playBed option is not handled yet, only stored. This increases
the savegame format version.
2015-02-14 16:06:55 +01:00
Matthew Hoops
a83ce70467 SCI: Silence a gcc conversion warning 2014-06-01 17:28:34 -04:00
Johannes Schickel
8fc7d60feb SCI: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01:00
Willem Jan Palenstijn
8cc82d0a0b SCI: Make fade signal version check more precise 2013-11-23 16:11:07 +01:00
Willem Jan Palenstijn
35617bf601 SCI: Fix SCI1late fade complete signal
This fixes duplicate music playing in LauraBow2CD (#6462)
2013-11-23 15:27:16 +01:00
m-kiewitz
158d12e555 SCI: abbrev. ffs to FE and priority check fix 2013-09-21 14:34:42 +02:00
m-kiewitz
4443793b97 SCI: sfx/music priority int16 fixes bug #3615038
it seems that sound system up till SCI0_LATE uses int16, afterwards it seems they changed to byte
main music object (conMusic) in Laura Bow 1 uses -1 as priority. This was truncated to 255 till now, which resulted in many sound effects not getting played, because those used priority 0
2013-09-21 14:27:16 +02:00
Filippos Karapetis
125b146b06 SCI: Implement the 4-param version of kDoSoundSendMidi - bug #3614447
Many thanks to wjp for his help with disassembly
2013-06-19 02:08:06 +03:00
Willem Jan Palenstijn
6e3510ac61 SCI: Add note about LSL1vga DoSoundSendMidi 2013-06-18 18:46:54 +02:00
Filippos Karapetis
d0697addab SCI: Change wording for a function reference 2013-04-28 23:31:11 +03:00
Filippos Karapetis
46ebf37ec9 SCI: Change wording for bug/further info references 2013-04-27 14:04:27 +03:00
Willem Jan Palenstijn
e273a387a7 SCI: Replace workaround for bug #3605269 by script patch 2013-04-19 23:50:04 +02:00
Willem Jan Palenstijn
cdf1900ce0 SCI: Add signal/fade related CHECKME 2013-04-07 18:22:41 +02:00
Willem Jan Palenstijn
6f3c83bd51 SCI: Minor cleanup
(Thanks waltervn)
2013-04-06 22:28:42 +02:00
Willem Jan Palenstijn
1e1cc7309f SCI: Further clarify comment 2013-04-06 22:11:15 +02:00