Age | Commit message (Collapse) | Author |
|
This can occur when a save game from the past is loaded and the
audio system was paused prior to loading the save game. This was
fixed eventually in SSCI somewhere around GK2, since it pauses
all audio before restoring a game and then resumes it after the
save game is loaded (after all of the audio channels have been
added from the save game). Since this would seem to be a problem
for earlier games as well, this change is applied universally
instead of being conditionally applied only to the games with
interpreters containing this change.
This patch contains some additional sanity checks that emit
warnings if individual channels end up being started from the
future. There was never such checking in SSCI, and it does not
seem likely to ever happen, but it is unclear right now if this is
an actual problem or not.
|
|
Refs Trac#9976.
|
|
Since Resource::makeStream returns a MemoryReadStream which will
not attempt to free the resource memory, it is fine to always
dispose those streams and get rid of the separate resourceStream
property, which was a holdover from some past WIP resource design
which no longer exists.
|
|
makeSOLStream was leaking the SeekableSubReadStream object it
creates itself if it was not called with DisposeAfterUse::YES. That
substream is an implementation detail which should not rely on
the caller to be destroyed.
|
|
This fixes at least Lighthouse audio 808 in room 270, and audio
801 in room 810.
|
|
* 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.
|
|
GM patch data is the same across all SCI32 games.
|
|
Thanks @OmerMor for pointing out this improvement.
|
|
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.
|
|
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.
|
|
|
|
The previous code for attenuating audio channels was not accurate,
so samples were quieter than they were supposed to be when mixed
together. Robots were also being mixed without attenuation, which
was incorrect.
|
|
|
|
DPCM decompression algorithms in SSCI operate directly on 8- and
16-bit registers, so any sample that ends up being out-of-range
during decompression gets wrapped by the CPU, not clipped.
This does not fix any known problem with AUD files, but there are
some VMDs (e.g. GK2 5280.VMD) which are known to contain OOR
samples. Making this code more accurate should prevent trouble
with any other similar files.
|
|
|
|
1. Unlocking all resources of a type using a resource ID of -1 is
gone in SCI32;
2. Audio locks need to be serialized starting in GK2 for the game's
modified kDoAudio(1) call;
3. Audio locks in SCI3 must work more like SSCI, since at least
Lighthouse's `BackMusic::fade` method will attempt to unlock
audio that was never locked by a script. In SSCI (and now in
ScummVM too) this is a no-op; previously in ScummVM, it would
remove Audio32's own lock on the audio resource, resulting in a
use-after-free;
4. kDoAudio(1) starting in GK2 returns the number of active
*not-in-memory* channels being played, not the total number of
active channels.
Fixes Trac#9675.
|
|
This seems to have been added in SCI1.1 and continued through
SCI32; older games with digital SFX (like KQ5CD) did not convert
the resource type in kLock.
This is not known to fix any problem, but was a noted difference
in the implementation between ScummVM and SSCI.
|
|
|
|
|
|
|
|
|
|
SCI3 changes the way that monitored channel works. In SCI2/2.1,
when a channel is monitored, it is the only audible channel. In
SCI3, monitored channels mix normally.
This is very noticeable in LSL7, where music disappears totally
during speech if the monitored channel is the only channel played
back.
|
|
|
|
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.
|
|
1. KQ4 sound 104 has an extra 0xFC (MIDI Stop command/kEndOfTrack)
at the end of the resource, which causes an out-of-bounds read
because the filtering loop continues after the first 0xFC and
unconditionally attempts to read 2 bytes (expecting there to
always be a delta value + a command, whereas in this file there
is only another kEndOfTrack command). This is corrected by
exiting the filtering loop when a kEndOfTrack is encountered
and there is not enough data remaining in the resource to
continue reading.
2. KQ5 sound 699 is truncated, which causes the parser to attempt
to read past the end of the resource. This is addressed by
adding bounds checks that exit the mix loop early if there is
no more data available to read. This allows truncated sounds
to be played as far as possible (previously, trying to read
truncated resources would result in a fatal error).
3. midiMixChannels allocates an arbitrary amount of raw memory
for the mixed MIDI sequence, without performing any bounds
checking when writing to this memory, potentially leading to
a crash or silent corruption of adjacent memory. This is
mitigated by using SciSpan instead of a raw pointer for the
mixed data.
Fixes Trac#9727.
|
|
|
|
The eventual proper fix for this is to change the current MIDI
parser to work the same as in SSCI, but for now this workaround
allows the game to continue.
Fixes Trac#9696.
|
|
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.
|
|
The only SCI32 game that uses MIDI and does not support AdLib is
MGDX, and it its MIDI playback is currently broken regardless of
the synth setting.
|
|
Specifically, audio patches are used in at least PQ:SWAT
(40103.AUD), Lighthouse (9103.AUD), and the GK2 demo (300.AUD).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This also fixes the display of the startup LCD message, which had
been delayed until after the sysex transfer was finished.
|
|
|
|
|
|
CID 1361762, 1361763, 1361764, 1361765.
|
|
|
|
The VMD decoder sends audio directly to the system mixer.
|
|
|
|
|
|
|
|
Several functions in Audio32 would call into the mixer to pause
or resume the audio handle, which would cause a deadlock if the
mixer's mixCallback timer fired while one of these functions was
running on the main thread.
To address this, calls to mixer to pause/unpause the digital audio
handle have been removed. Since this was just an optimisation to
prevent unnecessary calls to fill the audio buffer, the only
problem now is that a tiny amount of CPU is wasted on unnecessary
callbacks to read from the empty SCI mixer.
|
|
|
|
This fixes digital samples in at least QfG1, SQ3, LSL5. Bug #7159.
|
|
Using the one from SCI2.1mid makes fades very slow because SDL has
a larger audio buffer than SSCI DOS. This new algorithm is based on
wall time so will always fade at the correct speed, although the
larger buffers will have a coarser granularity so the fades may
not be as smooth as in the original engine. If anyone cares, the
fade volume could be mixed into individual samples in `readBuffer`
instead of applying just once per complete buffer. SSCI did not
do this, however, so this implementation should be pretty accurate.
|