From 5f8756ce8b8f3106bde7d815966404a4bb97171f Mon Sep 17 00:00:00 2001 From: Stiffly Date: Mon, 19 Oct 2015 15:11:53 +0200 Subject: [PATCH] Improved EStopSound --- src/game/Sound/SoundSystem.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/game/Sound/SoundSystem.cpp b/src/game/Sound/SoundSystem.cpp index 18643a6..fa1283b 100644 --- a/src/game/Sound/SoundSystem.cpp +++ b/src/game/Sound/SoundSystem.cpp @@ -121,12 +121,13 @@ bool dd::Systems::SoundSystem::OnStopSound(const dd::Events::StopSound &event) { if (item.second->Path() == event.FilePath) { itemToDeleted = item.first; - break; + alSourceStop(itemToDeleted); + alDeleteSources(1, &itemToDeleted); + m_BGMSourcesToBuffers.erase(itemToDeleted); + return true; } } - alSourceStop(itemToDeleted); - alDeleteSources(1, &itemToDeleted); - m_BGMSourcesToBuffers.erase(itemToDeleted); + //Should not happen because SFX's should be very short. for (auto item : m_SFXSourcesToBuffers)