704 Commits

Author SHA1 Message Date
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, b67c2d72d6c40fda2d67cfaf6a8aab9f44f7cd1e 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:
648d669c2dd3ddeaeb3d2ab4d3480ae08be85dd4
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
364542e9e149534df54ec07a07dce0b20cae897e
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
b0d45d07e4 SCI: kDoSoundPlay now restarts samples already playing
Fixes SQ4CD keypad buttons, bug #9813
2021-02-14 01:20:14 +02: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
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
sluicebox
3c71df687b SCI: Return correct kSciAudioCD value on failure
SSCI returns 0 when CD audio track can't be selected
2020-11-27 10:58:35 -08:00
sluicebox
843dd302d7 SCI: Add support for fan library sciAudio 1.1
Used by Soulshade Asylum
2020-09-29 18:36:37 -07:00
sluicebox
d592a67125 SCI32: Add kDoAudio support for Mac AIFF patch files
Fixes LSL6 hires Mac aerobics room and end credits
2020-09-01 10:31:32 -07:00
aryanrawlani28
4b6976c558 GUI: U32: Reduce number of files changed and fixes
Up until last commit, everything was working fine but the amount of files changed was too large. This commit tries to reduce the changes.

- Add a fake constructor to Keymap, text-to-speech, setDescription (save-state)
- Redirecting functions for PopUpWidget::appendEntry, ButtonWidget::setLabel, GUIErrorMessage
- Use the above functions and constructors to reduce changes in Engines
- Fix warnings being in unicode. Only output english text in - Warnings, Errors, etc.
- Mark some strings as "translation" strings. (Not yet added to POTFILES)
- Remove some CP related things from po/modules.mk
- Previously used some Common::convertToU32 where it was not necessary, replace this with u32constructor
2020-08-30 14:43:41 +02:00
aryanrawlani28
bed05ea134 GUI: U32: Fix compilation errors across entire project
After the initial changes just to scummvm/gui for u32, this commit includes the whole project

- Widget creations now always have u32 descriptions, labels, or tooltips
- Message dialogs make use of default arguments instead of providing the same argument explicitly
- encode String::format properly before passing on as argument where necessary
- Modify hugo utils (yesNoBox and notify box) to use u32
- Also provide fake constructors for the above which redirect to the u32 constructor
- Convert all keymap descriptions to u32 across all engines
- showConfirmationDialog in mohawk now uses u32
- showScummVMDialog also uses u32
- Scumm engine has dialogs now which use u32
- General fixes and wrapping convertToU32String for setLabels and related functions
- Add a fake constructor to MesssageDialog which redirects to the u32 constructor
2020-08-30 14:43:41 +02:00
Filippos Karapetis
ef6f8c008f SCI: Ignore digital channel data in midiMixChannels(), and remove some GOTOs
These are found at the end of SCI01/SCI1 SND files with sound effects
2020-08-30 13:37:19 +03:00
Filippos Karapetis
648d669c2d SCI: Properly handle alternative MIDI sound effects for SCI01/CI1 games
SCI01/SCI1 games have sound effects in SND files, which contain both
digital sounds and their alternative MIDI counterparts. Allow the user
to listen to the alternative MIDI counterparts by unchecking the
"Prefer digital sound effects" checkbox, like with other SCI versions.
Fixes bug #11587
2020-08-30 13:37:19 +03:00
Walter van Niftrik
c8293df572 SCI: Add Roland D-110/D-10/D-20 support 2020-08-27 14:56:17 +02:00
Walter van Niftrik
e0b8d8e414 SCI: Replace native_fb01 Checkbox with PopUp
Use a PopUp widget instead of a Checkbox, to allow for more devices
to be added in the future.
2020-08-27 14:56:17 +02:00
Walter van Niftrik
5f9e0eb395 SCI: Add mutexes to AmigaMac driver 2020-08-24 23:14:45 +02:00
Thierry Crozat
96efdb5575 SCI: Fix compilation of template MidiPlayer classes 2020-08-21 01:09:47 +01:00
Walter van Niftrik
099a3fac07 SCI: Relax sanity check for SQ3-DE 2020-08-20 23:58:37 +02:00
Walter van Niftrik
06210392c8 SCI: Fix error C2988 in VS2015 2020-08-20 23:58:37 +02:00