Commit graph

14 commits

Author SHA1 Message Date
sluicebox
1e84bbae4d BLADERUNNER: Fix memory leak in AudioMixer
Coverity CID 1419822
2023-11-29 06:54:30 -08:00
antoniou79
c9016cb2f2 BLADERUNNER: Notes and minor fixes for sound
Also added a dedicated debugSound channel for debugging

Fixes include closer conformance to original code (for entering/exiting ESPER and VK), and a change in assigning a track slot to a new track with priority equal to the lowest existing (it will now take the place of the old stored track). Also Music::adjustVolume() now takes the target volume as argument and stores it in the track volume field similar to how Music::adjustPan works.
2023-04-24 09:43:51 +03:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
antoniou79
1a25c2b69a BLADERUNNER: Remove timerprocs for next track and fadeout
The timers are replaced with "application" timers, which are checked in AudioMixer::tick()

The timerprocs for next and fadeout could potentially cause a game freeze.
This is because they could, under certain race conditions, come to a deadend
while trying to lock the mutexes for access to AudioMixer and Music methods.
The particular use case (non-deterministic) for this was loading a save game
while playing a game that had a music track playing (eg. at MA05, McCoy's balcony).
Here's a rough explanation of a possible lock situation (others could also be possible)
The "Main Thread" and "SDLTimer" threads (as reported from MSVC debug) could become hardlocked.
::Main Thread::
	A. LoadGame() calls _music->stop(0u);
		A1. Locks a Music::_mutex
		A2. Calls vm->_audioMixer->stop()
		A3. AudioMixer::stop() locks AudioMixer::_mutex [THIS DONE]
		A4. calls the endCallback for the music which is Music::ended()
			at Music::ended,
			A41. lock a Music::_mutex (presumably this is ok, even though it's a second lock, because it's the same thread(?))
			A42. call installTimerProc()
				A421. which tries to lock DefaultTimerManager::_mutex from default-timer [THIS FREEZES] - conflict with B11
::SDLTimer::
	B. calls timer_handler,
		B1. calls DefaultTimerManager::handler()
			B11. locks the DefaultTimerManager::_mutex from default-timer [THIS IS DONE]
			B12. we try to service the callbacks from TimerProcs that are currently entered in the TimerSlots queue
				B121. Such a slot is the AudioMixer BladeRunnerAudioMixerTimer, which has the AudioMixer::timerCallback()
				B1211. which calls the at AudioMixer::tick().
						tick() tries to lock the AudioMixer::_mutex [THIS FREEZES] conflict with A3
2021-06-12 14:58:07 +03:00
Thanasis Antoniou
cd076b26ae BLADERUNNER: Using preincrement and pre-decrease where possible
In case the compiler won't optimize such cases
2020-02-24 21:24:06 +02:00
Thanasis Antoniou
c19336e469 BLADERUNNER: Prevent cause assertion fault and no subtitles for #11294
Bug #11294 is a case where output audio hardware is disabled

If the output sound device is disabled or no hardware output device is connected (eg. Windows 10 may disable output audio hardware when no output device is attached/available), then the game should still be playable. We now use the duration of the tracks (in ms) to detect a track's ending.
Also isReady is checked for mixer when playing VQA videos (it wasn't before).
2020-02-18 00:58:53 +02:00
Peter Kohaut
cd7e44f9f9 BLADERUNNER: Group shapes loading 2019-10-13 14:09:47 +02:00
Thanasis Antoniou
caa4578add BLADERUNNER: Use unsigned 32bit diff for time durations 2019-07-17 19:09:15 +03:00
Thanasis Antoniou
bb719ba87c BLADERUNNER: Fix missing sound effects in some occassions
LABBUZZ sound for the maze and Animoid sounds

Moved lab buzz in next scene's (PS10) init, and increased size of track buffer to compensate for frequently dropping sounds in places with mayne sound effects (eg Animoid Row, Izo's door and trapdoor)
2019-03-27 12:39:24 +02:00
Peter Kohaut
d4e7e957b0 BLADERUNNER: Fixed panning of speech
Cleanup of other sound pannings
2019-03-06 20:41:02 +01:00
Peter Kohaut
a4229c9398 BLADERUNNER: Completed KIA interface
Added Diagnostic section - small button above main buttons
Added Pogo section - easter egg - write "pogo" while KIA is open
Code formatting again
2018-01-29 20:42:35 +01:00
Peter Kohaut
1e5f9d3078 BLADERUNNER: Added basic KIA interface
Settings works
Help works
Clue database works
Fixed code for inserting objects into scene
Reorganization of few files
Unification & code formatting of few older files
2018-01-28 10:57:16 +01:00
Peter Kohaut
f79d8cc1fe BLADERUNNER: Added music support & added Maggie
added async walking
named some of the game flags & variables
renamed aesc to screen effects
2017-09-10 20:55:30 +02:00
Peter Kohaut
0da18320af BLADERUNNER: Added audio mixer & various fixes
Audio mixer is supporting fading and pan animation
Added support for skipping speech by pressing Return
Added proper support for ambient sounds
Added more code to the dialogue menu
Added tooltips to the Spinner
Fixed calculation of volume and pan of walk steps
Code cleanup & formatting
2017-08-24 23:43:47 +02:00