Commit Graph
222 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
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
athrxx 92639d8ba4 SCI: fix bug no. 11683 ("QFG2 - Heavy reverb from city street sounds ...") 2022-09-02 14:55:44 -08: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
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 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 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
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 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
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 9982c761a2 SCI: Update all old bug tracker ticket numbers 2021-02-25 01:18:52 -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
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 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 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 786059a34c SCI: Refactor AmigaMac sound driver 2020-08-20 23:58:37 +02:00
Walter van NiftrikandMatthew Hoops 8529d2649b SCI: Add new Amiga and Mac sound drivers
Co-authored-by: Matthew Hoops <clone2727@gmail.com>
2020-08-20 23:58:37 +02:00
athrxx e16ab73cc1 SCI: fix bug #11476 (QFG1: Incomplete Music)
(regression from  3154d57)
2020-05-23 16:25:43 +03:00
sluicebox ee139e1684 SCI32: Update GM detection for MOTHERGOOSE Mac
Fixes MOTHERGOOSE Mac music, which unlike PC is not General MIDI.
2020-05-06 15:50:28 -07:00
sluicebox ed9318494d SCI32: Fix Mac sound initialization error 2020-02-07 13:15:43 -08:00
athrxx 9ea6c43c97 SCI: error dialog for missing sound patch/driver files
After implementing such a dialog into the fb01 driver it did make sense to me to also have this as a feature for all other aftermarket drivers/patches.

So now the sound drivers can report missing files after the failed open() call which will then be displayed in a dialog. Which will at least be more helpful than our usual error messages...
2019-08-07 16:43:07 +02:00
athrxx 926388b8f4 SCI: (CMS sound driver) - add support for SCI0
I haven't found an elegant and non-intrusive way to squeeze SCI0 support into LordHoto's existing code. The drivers are too different. So I made some rearrangements. The basic mechanisms of LordHoto's SCI1 code should remain the same as before, though. I only introduced some more classes, moved some code into these classes and renamed some things (mainly for myself, so as not to get confused).

I fixed two voice mapping bugs in the existing driver code. The first bug in bindVocies() effectively hindered the driver from playing anything at all when the CMS_DISABLE_VOICE_MAPPING #define wasn't set (_voice[i].channel == 0xFF instead of _voice[i].channel != 0xFF). The second bug in unbindVoices() was not a complete show stopper, but the function simply did not "unbind the voice". The line which does the actual removal of the channel assignment was missing.

The SCI0 driver portions have been tested with: PQ2, KQ4, LSL3, QFG1, ICE and COC.

SCI_0_EARLY versions apparently don't support the CMS. At least I haven't seen a driver file so far. And there seems to be no no instrument patch resource. Although the latter issue needn't necessarily be one, since the patch data array in the driver is actually preset with data (which gets overwritten as soon as a patch file is loaded). Maybe this would work for SCI_0_EARLY. However, I haven't tested this, since I really would have have a look at a driver file first if one actually exists. For now, I have limited the driver to SCI_0_LATE.

SCI1 has been tested with KQ5 and LSL5 (not extensively, just to see whether anything got broken and whether my voice mapping fixes work).
2019-07-22 20:17:38 +02:00
athrxx a6bf63bc1a SCI: revert accidental commits 2019-07-17 20:46:32 +02:00
athrxx 77dbefb907 SCI: (CMS sound driver) - add support for SCI0
I haven't found an elegant and non-intrusive way to squeeze SCI0 support into LordHoto's existing code. The drivers are too different. So I made some rearrangements. The basic mechanisms of LordHoto's SCI1 code should remain the same as before, though. I only introduced some more classes, moved some code into these classes and renamed some things (mainly for myself, so as not to get confused).

I fixed two voice mapping bugs in the existing driver code. The first bug in bindVocies() effectively hindered the driver from playing anything at all when the CMS_DISABLE_VOICE_MAPPING #define wasn't set (_voice[i].channel == 0xFF instead of _voice[i].channel != 0xFF). The second bug in unbindVoices() was not a complete show stopper, but the function simply did not "unbind the voice". The line which does the actual removal of the channel assignment was missing.

The SCI0 driver portions have been tested with: PQ2, KQ4, LSL3, QFG1, ICE and COC.

SCI_0_EARLY versions apparently don't support the CMS. At least I haven't seen a driver file so far. And there seems to be no no instrument patch resource. Although the latter issue needn't necessarily be one, since the patch data array in the driver is actually preset with data (which gets overwritten as soon as a patch file is loaded). Maybe this would work for SCI_0_EARLY. However, I haven't tested this, since I really would have have a look at a driver file first if one actually exists. For now, I have limited the driver to SCI_0_LATE.

SCI1 has been tested with KQ5 and LSL5 (not extensively, just to see whether anything got broken and whether my voice mapping fixes work).
2019-07-17 17:38:26 +02:00
athrxx 80f163b0fc ALL: revert accidental commits 2019-06-21 14:19:42 +02:00
athrxx f35eae7287 SCI: (CMS sound driver) - add support for SCI0
I haven't found an elegant and non-intrusive way to squeeze SCI0 support into LordHoto's existing code. The drivers are too different. So I made some rearrangements. The basic mechanisms of LordHoto's SCI1 code should remain the same as before, though. I only introduced some more classes, moved some code into these classes and renamed some things (mainly for myself, so as not to get confused).

I fixed two voice mapping bugs in the existing driver code. The first bug in bindVocies() effectively hindered the driver from playing anything at all when the CMS_DISABLE_VOICE_MAPPING #define wasn't set (_voice[i].channel == 0xFF instead of _voice[i].channel != 0xFF). The second bug in unbindVoices() was not a complete show stopper, but the function simply did not "unbind the voice". The line which does the actual removal of the channel assignment was missing.

The SCI0 driver portions have been tested with: PQ2, KQ4, LSL3, QFG1, ICE and COC.

SCI_0_EARLY versions apparently don't support the CMS. At least I haven't seen a driver file so far. And there seems to be no no instrument patch resource. Although the latter issue needn't necessarily be one, since the patch data array in the driver is actually preset with data (which gets overwritten as soon as a patch file is loaded). Maybe this would work for SCI_0_EARLY. However, I haven't tested this, since I really would have have a look at a driver file first if one actually exists. For now, I have limited the driver to SCI_0_LATE.

SCI1 has been tested with KQ5 and LSL5 (not extensively, just to see whether anything got broken and whether my voice mapping fixes work).
2019-06-21 13:35:35 +02:00
sluicebox 7862140939 SCI: Change sendMidiCommand non-midi error to warn
FPFP calls kDoSound SendMidi on non-midi sounds. Fixes bug #10952
2019-05-02 22:43:10 +03:00
athrxx acfc0c90ce SCI: add PC-9801 sound driver
(supports SCI1 for now)
2019-04-02 20:45:35 +03:00
sluicebox 3209bfb730 SCI: Remove MidiDriver_AmigaMac platform inference
Tell MidiDriver_AmigaMac the game's platform instead of it
attempting to infer this by which patch resources exist.

Fixes bug #10925 where SQ3 German Amiga is treated as Mac because
it happens to contain a patch 7 resource.
2019-03-29 21:37:15 +02: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
Ruud Klaver cedd9d3c40 SCI: Play MIDI version of SCI0 sound resource if user prefers it
If the user has "Prefer digital sound effects" disabled for a SCI0
game, do not play the digital sample version of a sound resource, if
such data is present. When the resource has only digital sample data
and no MIDI information, play the sample instead.

Closes gh-1022.
2017-10-04 23:29:38 -05:00
Colin Snover 07d6ffd989 SCI32: Force General MIDI for games that support nothing else
* MGDX has only GM music;
* KQ7 1.x's AdLib data is incomplete, so is not usable even though
  it is partially there

Fixes Trac#9789.
2017-07-07 13:28:54 -05:00
Colin Snover 90cd56e4b6 SCI32: Fix missing music in MGDX
GM patch data is the same across all SCI32 games.
2017-07-07 13:25:02 -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 40566820a7 SCI: Return the original master sound volume when mute is on 2017-06-09 23:30:10 -05:00
Colin Snover eb9965274d SCI32: Fix race conditions in Audio32 2017-04-23 13:07:25 -05:00
Colin Snover 3de6f290e7 SCI: Change default master MIDI volume to 15
GK1 handles MIDI volume by changing the volumes of individual
sound objects, rather than by using the MIDI master volume. As a
result, the master volume needs to default to the maximum output
level in order for GK1 to play music at the correct volume.

This change does not affect earlier games, since SCI16 managed
MIDI volume via the master volume, and for these games the master
volume from ScummVM is synced at startup.
2017-03-30 19:46:27 -05:00