Commit Graph
721 Commits
Author SHA1 Message Date
athrxx 1878364c2f SCI: (CMS) - fix regression 2022-12-11 17:53:33 +01:00
Cameron Cawley e97812c296 SCI: Move MidiDriver_CMS to the new CMS API 2022-11-22 19:19:20 +02:00
Cameron Cawley 9f4f22b3bf AUDIO: Support mono audio output in the mixer 2022-11-18 17:17:00 +01:00
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
athrxx 2caa572f04 SCI: (FPFP/Demo) - fix bug no. 12610
("hanging MIDI notes")

The original interpreter resets the channels more often than we do
in the remap function. The assumption apparently was that the
loop at the very end of the function would catch everything. But
it does not catch the dontRemap channels if they are not within
the _driverFirstChannel/_driverLastChannel range.
If more bugs like this come up it might be necessary to add even
more resets, but I am very reluctant about unnecessary changes
to the remap function. And this code has been around for a long
time without any other bug reports of this sort. So I think we have
reason to be optimistic about it.
2022-09-14 23:13:20 -08:00
sluicebox aef56199cf SCI: Remove unused code from soundcmd.h 2022-09-13 22:17:05 -08:00
athrxx 92639d8ba4 SCI: fix bug no. 11683 ("QFG2 - Heavy reverb from city street sounds ...") 2022-09-02 14:55:44 -08: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
athrxx f96819149f SCI: (SCI1+) - improve channel sound flag handling
This cleans up some things I noticed when I implemented the mute flag handling. It removes the hack that manually forces flag 2 on all channels with number 9, regardless of the device.
I presume the hack was done for the earliest SCI 1 games, due to improper handling of flag 1.
2022-06-19 20:46:37 +03:00
sluicebox a5833242a1 SCI: Fix compiler warning 2022-06-06 17:30:47 -04:00
athrxx 974c51b4cd SCI: improve sound (mute handling) related comments 2022-06-05 09:10:59 +03:00
athrxx 8eba7fb4fb SCI: fix bug no. 13496 (LSL6 music plays all instruments / tracks at …
…once)

I am not sure if this bug ticket is about just one or about several bugs. This is at least something I could reproduce. The reason is that there can be channels that should start up muted. We didn't support that. I also fixed a couple of other things about the mute state that I noticed.
2022-06-05 09:10:59 +03:00
athrxx 2803adc0b8 SCI: update mutex comment
(after turning _mutex into a reference to the mixers's mutex)
2022-06-03 23:42:02 +03:00
athrxx 2ef6e24e56 SCI: avoid deadlocks by using only one mutex
Make use of the mixer's mutex instead of creating a new one. Otherwise there can still be lock-ups when the main thread and the mixer thread lock each other up in different mutexes (causing a deadlock/freeze). I just noticed this with KQ5 FM-Towns.

We had the same issue in AGOS, it was fixed by allowing to access the mixer's mutex. We can use the same thing here...
2022-06-03 23:42:02 +03: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
Donovan Watteau 5b1ec56f96 JANITORIAL: Fix some lost or outdated URLs in comments 2022-05-19 07:57:31 +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
sluicebox 0d16892c1d SCI32: Fix GK2 lockups when music volume is turned off
Fixes a bug in the original that locks up many scenes and room
transitions if the music volume slider is lowered all the way
2022-05-12 14:59:53 -04:00
athrxx 4e214c4f2a SCI: add comment to SciMusic::pauseAll() 2022-05-01 13:46:05 +03:00
athrxx c2975276a3 SCI: fix music handling during auto-save 2022-05-01 13:46:05 +03:00
D G Turner 3e32365f0f SCI: Fix Missing MusicEntry Field Initializer for time
This may fix bug #13192 (SCI: Police Quest 4 - Random Crashes), but
is good practice anyway.
2022-01-01 22:34:52 +00:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh 940c7bfc14 SCI: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
Filippos Karapetis 748dcdab65 SCI: Update a comment regarding demos without sound 2021-10-17 20:45:07 +03:00
sluicebox ecc72dce23 SCI: Don't poll input events from MIDI thread
In March, b67c2d72d6 moved some MIDI
initialization from the main thread to the MIDI thread. This caused
MidiPlayer_Midi::sysEx() to run on the MIDI thread for the first time.
This is a problem because it calls SciEngine:sleep(), which polls
events, and that causes MacOS to throw an exception for calling
SDL_PollEvent() on a non-main thread.

While investigating, it also turns out that MidiPlayer_Midi::sysEx()
and MidiPlayer_Fb01::sysEx() were calling OSystem::updateScreen(),
and that also shouldn't be happening on a non-main thread.

Now SciEngine::sleep() is only called on the main thread, and
OSystem::delayMillis() is called on the MIDI timer thread.
Continuing to call sleep() on the main thread keeps the UI responsive
when loading patches, which can take several seconds.
The OSystem::updateScreen() calls had no effect and have been removed.

Fixes bug #12947
2021-09-21 16:35:46 -05:00
Paul Gilbert 005561d305 COMMON: Increase Stream pos, seek, size from int32 to int64 2021-07-08 18:24:28 -07:00
sluicebox a54bee9430 SCI: Fix corruption when "prefer_digitalsfx" is false
Fixes an out of bounds write that occurs when the config setting
"prefer_digitalsfx" is false and a game plays a sound resource
that contains a digital channel, such as SQ1.

The MIDI branch of SciMusic:soundInitSnd() wasn't skipping the
digital channel, which has the number 0xFE, and so it used that
to index the 16 element channel array.

This problem didn't become apparent until recently when
"prefer_digitalsfx" was fixed to apply to these sounds:
648d669c2d
2021-06-14 16:58:40 -05:00
sluicebox 816f65cd68 SCI: Remove AIFF handling from SCI16 code
Only SCI32 Mac games use AIFF audio. This should have been
removed when SCI32 code was moved into its own classes.
2021-06-10 14:28:15 -06:00
sluicebox ed170da62d SCI: Validate size in AudioPlayer::getAudioStream() 2021-06-03 16:56:08 -06:00
SupSuper df4bf9d557 SCI: Fix audio resources being freed too early
Copy audio resource buffers as we don't have control over the lifetime of the resource.
2021-06-03 23:27:46 +01:00
sluicebox 4e8db68d4a SCI: Remove asserting "new" allocation results 2021-05-23 16:55:35 -06: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
Orgad Shaneh a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
sluicebox 77b93c77ab SCI: Add support for MOTHERGOOSE256 CD-Audio version
This multi-lingual version handles audio in a unique manner.
English audio is only on the CD audio track while the other
four languages are only in resource files. This is transparent
to the scripts that play audio; they're the same in all versions.
This required a custom interpreter that detects the language and
handles English differently. It even has a custom error message:
"You will not be able to play the 'ENGLISH' version."

Fixes bug #12431
2021-04-24 00:35:03 -07:00
athrxx 505e9aff15 SCI: (SCI0 sound) - ensure that pauseAll() works correctly
The last 2 commits might not be fully compliant with the ScummVM GMM code and our handling of global sound pausing/resuming. This commit makes sure that only sounds will resume that were actually playing.
2021-03-13 17:41:54 +02: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
athrxx b67c2d72d6 SCI: (SCI0 sound) - make calls to initTrack consistent with our thread handling
When _mainThreadCalled is set the function call should be enqueued just like the Midi messages that get sent before the start of a new track, so that everything happens in the right order.
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