Skip to content

Commit

Permalink
_Actually_ remove items from container
Browse files Browse the repository at this point in the history
  • Loading branch information
frabert committed Sep 19, 2018
1 parent c4b4588 commit e0f423a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/audio/OpenALAudioEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,16 @@ ALuint OpenALAudioEngine::getFreeSource()
auto lambda = [](const auto& sound) { return sound.use_count() == 1; };

// Remove all expired sounds
std::remove_if(std::begin(m_bufferedSounds), std::end(m_bufferedSounds), lambda);
std::remove_if(std::begin(m_streamingSounds), std::end(m_streamingSounds), lambda);
m_bufferedSounds.erase(
std::remove_if(
std::begin(m_bufferedSounds),
std::end(m_bufferedSounds), lambda),
std::end(m_bufferedSounds));
m_streamingSounds.erase(
std::remove_if(
std::begin(m_streamingSounds),
std::end(m_streamingSounds), lambda),
std::end(m_streamingSounds));

if (m_freeSources.empty())
{
Expand Down

0 comments on commit e0f423a

Please sign in to comment.