Browse Source

Fix love.audio.play{sources...} so it can resume paused sources

--HG--
branch : minor
Bart van Strien 8 years ago
parent
commit
67d3146229
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/modules/audio/openal/Source.cpp

+ 7 - 2
src/modules/audio/openal/Source.cpp

@@ -901,12 +901,17 @@ bool Source::playAtomic(const std::vector<love::audio::Source*> &sources, const
 	toPlay.reserve(sources.size());
 	for (size_t i = 0; i < sources.size(); i++)
 	{
+		Source *source = (Source*) sources[i];
+		// Paused sources have wasPlaying set to true, so do this first
+		if (!source->isPlaying())
+			toPlay.push_back(ids[i]);
+
+		// If it wasn't playing (nor paused), we have just allocated a new
+		// source
 		if (wasPlaying[i])
 			continue;
-		Source *source = (Source*) sources[i];
 		source->source = ids[i];
 		source->prepareAtomic();
-		toPlay.push_back(ids[i]);
 	}
 
 	alGetError();