diff --git a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp index 64f49864332..fcd09d4f57b 100644 --- a/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp +++ b/engines/hpl1/engine/impl/LowLevelSoundOpenAL.cpp @@ -200,8 +200,13 @@ static cOpenALSoundChannel **findBestSlot(Common::Array & bool cLowLevelSoundOpenAL::playChannel(cOpenALSoundChannel *channel) { auto slot = findBestSlot(_activeChannels, channel->GetPriority()); if (slot != _activeChannels.end()) { - if (*slot != nullptr) + if (*slot != nullptr) { + if ((*slot)->IsPlaying()) { + Hpl1::logInfo(Hpl1::kDebugAudio, "evicting sound from data %s from mixer slot\n", + (*slot)->mpData->GetName().c_str()); + } (*slot)->Stop(); + } *slot = channel; _mixer->stopHandle(channel->_handle); channel->_audioStream->rewind(); @@ -214,7 +219,7 @@ bool cLowLevelSoundOpenAL::playChannel(cOpenALSoundChannel *channel) { void cLowLevelSoundOpenAL::closeChannel(cOpenALSoundChannel *channel) { auto slot = Common::find(_activeChannels.begin(), _activeChannels.end(), channel); if (slot != _activeChannels.end()) { - _mixer->stopHandle((*slot)->_handle); + (*slot)->Stop(); *slot = nullptr; } }