summaryrefslogtreecommitdiff
path: root/src/audio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio.cpp')
-rw-r--r--src/audio.cpp11
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());