diff options
Diffstat (limited to 'src/audio.cpp')
-rw-r--r-- | src/audio.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/audio.cpp b/src/audio.cpp index 012c396..2f70fee 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -19,14 +19,21 @@ along with Minitrem. If not, see <http://www.gnu.org/licenses/>. namespace audio { +static std::list<sf::Sound> playing_sounds; + +void clean_sounds(void) +{ + playing_sounds.remove_if( [](sf::Sound &sound) { + return sound.getStatus() == sf::Sound::Stopped; + }); +} + void sound_t::load(const char *path) { printf("load %s\n", path); buffer.loadFromFile(path); } -static std::list<sf::Sound> playing_sounds; - void sound_t::play(void) { auto sound = playing_sounds.emplace(playing_sounds.end()); |