diff --git a/assets b/assets index 6cbf2365..a3c92ac8 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 6cbf2365d49e6280750ea3bcd0f9c271779e6f15 +Subproject commit a3c92ac876dd061776c36d1594bd82264372f028 diff --git a/include/Engine/Sound/EPlaySoundOnEntity.h b/include/Engine/Sound/EPlaySoundOnEntity.h index fb4b7a15..39dea432 100644 --- a/include/Engine/Sound/EPlaySoundOnEntity.h +++ b/include/Engine/Sound/EPlaySoundOnEntity.h @@ -10,7 +10,6 @@ namespace Events // Plays a sound on an entity with a SoundEmitter component attached. // Sound behavior is thereby specified in the SoundEmitter component. -// ?(???)?? struct PlaySoundOnEntity : public Event { EntityID EmitterID = 0; diff --git a/src/Engine/Sound/SoundSystem.cpp b/src/Engine/Sound/SoundSystem.cpp index 8fe1c2bb..ed65351f 100644 --- a/src/Engine/Sound/SoundSystem.cpp +++ b/src/Engine/Sound/SoundSystem.cpp @@ -41,8 +41,8 @@ void SoundSystem::stopEmitters() { std::unordered_map::iterator it; for (it = m_Sources.begin(); it != m_Sources.end(); it++) { - if (getSourceState((*it).second->ALsource) == AL_PLAYING) { - stopSound((*it).second); + if (getSourceState(it->second->ALsource) == AL_PLAYING) { + stopSound(it->second); } } } @@ -71,6 +71,7 @@ void SoundSystem::deleteInactiveEmitters() alDeleteBuffers(1, &it->second->ALsource); alDeleteSources(1, &it->second->ALsource); m_World->DeleteEntity(it->first); + delete it->second; it = m_Sources.erase(it); } } else { @@ -78,6 +79,7 @@ void SoundSystem::deleteInactiveEmitters() stopSound((*it).second); alDeleteBuffers(1, &it->second->ALsource); alDeleteSources(1, &it->second->ALsource); + delete it->second; it = m_Sources.erase(it); } } @@ -200,19 +202,19 @@ bool SoundSystem::OnPlaySoundOnPosition(const Events::PlaySoundOnPosition & e) source->Type = SoundType::SFX; m_Sources[emitterID] = source; playSound(source); - return false; + return true; } bool SoundSystem::OnPauseSound(const Events::PauseSound & e) { alSourcePause(m_Sources[e.EmitterID]->ALsource); - return false; + return true; } bool SoundSystem::OnStopSound(const Events::StopSound & e) { alSourceStop(m_Sources[e.EmitterID]->ALsource); - return false; + return true; } bool SoundSystem::OnContinueSound(const Events::ContinueSound & e) @@ -235,7 +237,7 @@ bool SoundSystem::OnPlayBackgroundMusic(const Events::PlayBackgroundMusic & e) m_Sources[emitterChild] = source; playSound(source); } - return false; + return true; } bool SoundSystem::OnSetBGMGain(const Events::SetBGMGain & e)