Commit Graph
297 Commits
Author SHA1 Message Date
AndywinXp d4a0ac0e78 SCUMM: DIMUSE: Fix uninit memory read for low latency mode 2023-01-15 12:12:06 +01:00
BLooperZ 4f5a71aae1 SCUMM: FT: Fix unitialized stream in low latency mode 2023-01-14 21:27:29 +01:00
AndywinXp 845c739801 SCUMM: DIMUSE: Avoid using a nullptr stream 2023-01-12 22:11:12 +01:00
AndywinXp 8d6737e16f SCUMM: DIMUSE: Increase buffer size for low latency mode 2023-01-10 21:17:23 +01:00
AndywinXp 8d0e97af70 SCUMM: DIMUSE: Implement low latency mode
This fixes bug #13462
2023-01-10 21:17:23 +01:00
AndywinXp 833703b0b1 JANITORIAL: SCUMM: Remove magic numbers and document VOC format blocks 2023-01-04 19:59:42 +01:00
AndywinXp 4d556f0db6 JANITORIAL: SCUMM: Change order of class members declarations
The _output* vars are semantically separate from the _internal* ones
2023-01-03 09:51:15 +01:00
AndywinXp 5b18d1aa6b SCUMM: DIMUSE: Implement support for higher internal sample rates
This lays the ground for:
* Supporting fan dubbings and self-made high quality music replacement;
* Reintroduction of support for compressed audio.
2023-01-02 23:30:57 +01:00
AndywinXp 92efa503fb SCUMM: DIMUSE: Fix theoretical possibility of division by zero 2023-01-02 23:05:50 +01:00
AndywinXp c3256a614a SCUMM: DIMUSE: Make engine sample rate and feed size parametric 2023-01-02 22:55:26 +01:00
AndywinXp b4c52cac22 SCUMM: DIMUSE: Implement adaptive buffer underrun correction
Thanks to lephilousophe for the help on this one :-)
2023-01-02 17:50:00 +01:00
AndywinXp 3c81f19840 SCUMM: DiMUSE: Prevent negative buffer count in roundRobinSetBufferCount() 2022-12-04 23:01:06 +01:00
AndywinXp 5190796a3d JANITORIAL: SCUMM: Rename _budleDirCache to _bundleDirCache
Typo :-)
2022-12-04 22:21:18 +01:00
AndywinXp 344349dbd9 SCUMM: DiMUSE: Allow original mono mixing routines to work
These changes make use of _mixer->getOutputStereo() to select the proper number of audio channels.
This makes it possible to have mono audio produced using the proper DiMUSE internal mixer mono
routines, instead of having the ScummVM mixer folding down a stereo mix.
2022-11-27 12:25:14 +01:00
Le Philousophe 137b51d7ac SCUMM: Don't use unsafe sprintf and vsprintf 2022-10-23 22:46:19 +02:00
AndywinXp 938212c6f1 SCUMM: DiMUSE: Fix endianness issues with speech lipsync 2022-10-10 21:26:26 +02:00
AndywinXp 474ccf041a SCUMM: DiMUSE: Clarify and document IMuseDigital::tracksLipSync() 2022-10-10 00:46:05 +02:00
AndywinXp 7077d8d124 SCUMM: Fix AmigaOS and NDS builds 2022-10-04 13:50:49 +02:00
AndywinXp a7a4d9f120 SCUMM: DiMUSE: Implement antiskip system for devices with slow load times
This code is present in all the original interpreters using Digital iMUSE, and it was implemented
in order to allow slower CD drives to fetch new data without having music skipping during load times.
This works by basically flooding the music buffer with data whenever a big resource, a voice file, or
a SMUSH movie is loaded.
Arguably this is not needed for devices using SSD drives, but since this change had its benefits on a
quite old laptop of mine, and since the memory overhead is very minimal, I have decided to implement it.
2022-10-04 11:34:14 +02:00
Andrea Boscarino 6ad5ed0b92 SCUMM: DiMUSE: Solve very rare deadlocks caused by two different mutex objects 2022-10-04 11:33:26 +02:00
AndywinXp 57a4f165d5 SCUMM: DIMUSE: Add defines for magic numbers and command IDs 2022-10-01 17:47:17 +02:00
AndywinXp c1502271b4 SCUMM: DiMUSE: Don't crash the app if we try to deallocate a non-existent soundfile
Previously we had asserts instructions in place for this; they work under the assumption that the user
always has the sound files available. Unfortunately this assumption breaks in at least two cases:
- The user plays the COMI demo (small version, without sound files);
- The user copies the whole COMI game from the CDs/Steam to the device of choice (e.g. tablet),
  and doesn't copy the BUN files over (e.g. for storage issues).

We simply remove the assertions and put a check in its place, and if that check fails we just exit
the function and resume normal execution. This fixes #13845.
2022-09-26 15:25:18 +02:00
AndywinXp 457bcb67db SCUMM: GUI: Implement the majority of the v7 Main Menu 2022-09-08 19:10:42 +02:00
athrxx 3d39d206ee SCUMM: replace strcpy calls with Common::strlcpy
This replaces every single strcpy call in the engine with
Common::strlcpy.

Some of these might cases seem a bit pointless, but it is
supposed to discourage future use of strcpy. If people don't
see a single occasion of it they might think twice before they
use it...
2022-08-27 13:08:38 +03:00
Dominik Kreutzer f9f864c959 SCUMM: DiMUSE: Fix unaligned map access
The map in IMuseDigiDispatch can contain unaligned blocks if it
contains a TEXT block with a length not divisible by four. This causes
unaligned memory accesses in a few places.

This commit fixes the issue by ensuring only aligned pointers are typed
as `int32 *` while unaligned pointers are typed as `uint8 *` and are
only accessed through helper functions.
2022-08-19 16:59:23 +02:00
AndywinXp edf63e8672 SCUMM: DiMUSE: Prevent crashes if a .SOU/.BUN file can't be found 2022-08-13 11:57:55 +02:00
Donovan Watteau 4ec06a2bf6 SCUMM: Unify WORKAROUND usage and complete/tweak some of them 2022-08-07 17:24:27 +02:00
AndywinXp 61535ee8c9 SCUMM: DiMUSE: Increment upper and lower limit for roundRobinSetBufferCount() 2022-08-06 13:33:56 +02:00
AndywinXp 51d0b8ef06 SCUMM: COMI: Implement iMUSE buffer toggle GUI banner 2022-08-06 13:33:56 +02:00
AndywinXp 1e9d51c28a SCUMM: COMI: Implement the original main menu
Every functionality has been implemented (audio options, text options, saving and loading).
The only thing currently missing from the menu is the thumbnail handling.
2022-08-06 13:33:56 +02:00
Donovan Watteau 27f9a460b5 JANITORIAL: Fix "the the" and similar typos 2022-07-29 19:36:40 +03:00
AndywinXp 2a13273e5c SCUMM: DiMUSE: Remove unnecessary mutex call causing softlocks
The call was unnecessary since the one being fundamental is the call made
to the resource manager mutex in _vm->getResourceAddress(); this fixes
some very rare (but also very real) cases of v7-8 games softlocking.
2022-07-28 00:16:17 +02:00
AndywinXp 9518dc5341 SCUMM: DiMUSE: Fix if guard for quarter samplerate case
Also, amend a5d4e15 which removed the half samplerate case.
2022-07-13 07:50:04 +02:00
D G Turner a5d4e15f14 SCUMM: DiMUSE: Remove Older Code Path for 8-bit Stereo Audio Mixing
This would have been executed instead of the newer code added in the
previous commit on this module.
2022-07-13 00:51:33 +01:00
AndywinXp 19a7a40c41 SCUMM: DiMUSE: Properly mix audio which with quarter sample rate
This fixes instances in which audio chunks with a sample rate equal to a
quarter of the global one were not mixed correctly, causing wave aliasing
during the reconstruction of the analog signal from the digital one.
2022-07-12 17:49:26 +02:00
AndywinXp 2eb63a8931 SCUMM: DiMUSE: Fix possible heap buffer overflow when fetching sound header 2022-05-28 10:30:40 +02:00
rsn8887 e116a0abb0 SCUMM: Fix file handle leak during dialogs in FT 2022-05-03 11:23:50 -05:00
Andrea Boscarino 5c63294632 SCUMM: DiMUSE: Fix mixer behavior for 8-bit audio and mixBufStartIndex != 0
This fixes some ugly audio pops and glitches on The Dig (full and demo) and FT
Also, fix formatting
2022-04-16 23:25:31 +02:00
Andrea Boscarino 71816ec701 SCUMM: DiMUSE: Fix startup volume setup for SMUSH 2022-04-16 23:25:31 +02:00
Andrea Boscarino 024aa1f22b SCUMM: SMUSH: Implement audio sub-engine 2022-04-16 23:25:31 +02:00
Andrea Boscarino a4e2ac5eb3 SCUMM: DiMUSE: Fix tracksStopSound() behavior
Without this fix, if we had a list of tracks A->B->C->D and we stopped C, we couldn't have stopped D because we reached the end of the list prematurely.
2022-04-15 16:00:42 +02:00
Andrea Boscarino 2bc8dcc813 SCUMM: DiMUSE: Remove unused code 2022-04-06 21:31:05 +02:00
Andrea Boscarino fbc989d60f SCUMM: DIG/DiMUSE: Implement mouth sync times retrieval and handling 2022-04-06 21:31:05 +02:00
Andrea Boscarino 4e86347f93 SCUMM: DiMUSE: Improve readability of Trigger function calls 2022-04-06 21:31:05 +02:00
athrxx d94618f3d5 SCUMM: (DIMUSE) - fix loading of old savegames 2022-03-28 18:29:15 +02:00
Andrea Boscarino c3ad8a5a94 SCUMM: DiMUSE: Add missing check for already loaded sound
The missing check can cause an issue in The Dig where the sound slots are being filled with the same sound file (background music) after causing a sequence of these two engine actions:
IMuseDigital::setDigMusicState(): Set music state: stateNoChange
IMuseDigital::setDigMusicState(): Set music state: <any valid state which corresponds to a loadable file>

As usual, thanks athrxx!
2022-03-09 09:33:34 +01:00
Andrea Boscarino c03787f8bb SCUMM: DiMUSE: Fix possible buffer underruns
Big thanks to athrxx for reporting this issue; the previous calculation for obtaining an optimal number for _maxQueuedStreams did not account for the differences between the sample rate targeted by the audio backend and the one targeted by DiMUSE (which is 22050Hz). 

This new formula has been tested for optimal latency and absence of underruns for all supported games and all known combinations of sample rates and output buffer sizes:
[22050, 44100, 48000, 96000], [1024, 2048, 4096, 8192].
2022-03-06 21:58:40 +01:00
Andrea Boscarino a083cf5abc SCUMM: DiMUSE: Create separate InternalMixer flow for FT engine 2022-03-06 11:11:11 +01:00
Andrea Boscarino 8f79a2ecad SCUMM: DiMUSE/FT: Fix spelling error of sequence name 2022-02-27 23:31:34 +01:00
Andrea Boscarino 5cb8202d9b SCUMM: DiMUSE: Remove a hack in Dispatch which caused rare crashes
The code now matches the Full Throttle interpreter
2022-02-27 00:46:19 +01:00