From 1f52abf619a7379443af1696c428271eda234143 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Wed, 27 Dec 2017 12:27:12 -0400 Subject: [PATCH] Fix love.audio.play(staticsources) when the sources have been paused. Resolves issue #1363. --- src/modules/audio/openal/Source.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modules/audio/openal/Source.cpp b/src/modules/audio/openal/Source.cpp index c08d01dde..ddefb5302 100644 --- a/src/modules/audio/openal/Source.cpp +++ b/src/modules/audio/openal/Source.cpp @@ -1000,11 +1000,19 @@ bool Source::play(const std::vector &sources) toPlay.reserve(sources.size()); for (size_t i = 0; i < sources.size(); i++) { - if (wasPlaying[i]) + // If the source was paused, wasPlaying[i] will be true but we still + // want to resume it. We don't want to call alSourcePlay on sources + // that are actually playing though. + if (wasPlaying[i] && sources[i]->isPlaying()) continue; - Source *source = (Source*) sources[i]; - source->source = ids[i]; - source->prepareAtomic(); + + if (!wasPlaying[i]) + { + Source *source = (Source*) sources[i]; + source->source = ids[i]; + source->prepareAtomic(); + } + toPlay.push_back(ids[i]); }