mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-11 13:45:25 +00:00
HOPKINS: Attempt to fix crash when skipping movie
Before starting an "Swav" sound, check that its sound handle isn't already used. If it is, stop it. When skipping a movie, it still (incorrectly?) goes through the motions of playing the remaining frames, including starting any movie sounds on the way. This would cause us to lose the handle to the sound that was currently playing in the "Swav" slot, and I *think* that's what ended up confusing things. I'm still not entirely sure exactly what was happening.
This commit is contained in:
parent
bce7139c8c
commit
49afc87b88
@ -824,6 +824,12 @@ void SoundManager::PLAY_SAMPLE_SDL(int voiceIndex, int wavIndex) {
|
||||
|
||||
int volume = (voiceIndex == 2) ? _voiceVolume * 255 / 16 : _soundVolume * 255 / 16;
|
||||
|
||||
// If the handle is still in use, stop it. Otherwise we'll lose the
|
||||
// handle to that sound. This can currently happen (but probably
|
||||
// shouldn't) when skipping a movie.
|
||||
if (_vm->_mixer->isSoundHandleActive(Swav[wavIndex]._soundHandle))
|
||||
_vm->_mixer->stopHandle(Swav[wavIndex]._soundHandle);
|
||||
|
||||
// Start the voice playing
|
||||
Swav[wavIndex]._audioStream->rewind();
|
||||
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &Swav[wavIndex]._soundHandle,
|
||||
|
Loading…
x
Reference in New Issue
Block a user