mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-18 23:57:32 +00:00
MORTEVIELLE: Fix crash in sound mixer when closing the engine
This was due to the _speakerHandle being reused between its initialisation in the SoundManager constructor and the destructor causing it to have a wrong value when trying (and failing) to stop the PCSpeaker channel in the mixer before deleting the stream.
This commit is contained in:
parent
fbb1137f94
commit
deef0b955c
@ -187,10 +187,13 @@ void SoundManager::playNote(int frequency, int32 length) {
|
||||
|
||||
void SoundManager::playSong(const byte* buf, int size) {
|
||||
Audio::AudioStream *stream = Audio::makeRawStream(buf, size, 11025 / 2, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS);
|
||||
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
|
||||
Audio::SoundHandle songHandle;
|
||||
_mixer->playStream(Audio::Mixer::kSFXSoundType, &songHandle, stream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
|
||||
|
||||
while (_mixer->isSoundHandleActive(_speakerHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit())
|
||||
while (_mixer->isSoundHandleActive(songHandle) && !_vm->keyPressed() && !_vm->_mouseClick && !_vm->shouldQuit())
|
||||
;
|
||||
// In case the handle is still active, stop it.
|
||||
_mixer->stopHandle(songHandle);
|
||||
}
|
||||
|
||||
void SoundManager::setParent(MortevielleEngine *vm) {
|
||||
|
Loading…
Reference in New Issue
Block a user