From 03f60e2bf394e4808a03f175ba9bf4c0174a8213 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Sun, 7 Aug 2011 13:54:36 +0200 Subject: [PATCH] Unbuffer when rewinding streaming sources (bug #250) --- src/modules/audio/openal/Source.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/modules/audio/openal/Source.cpp b/src/modules/audio/openal/Source.cpp index 65d9113f8..76dba16ca 100644 --- a/src/modules/audio/openal/Source.cpp +++ b/src/modules/audio/openal/Source.cpp @@ -265,11 +265,14 @@ namespace openal } if (type == TYPE_STREAM) { + bool waspaused = paused; // Because we still have old data // from before the seek in the buffers // let's empty them. stopAtomic(false); playAtomic(); + if (waspaused) + pauseAtomic(); } } } @@ -462,7 +465,15 @@ namespace openal } else if(valid && type == TYPE_STREAM) { + bool waspaused = paused; decoder->rewind(); + // Because we still have old data + // from before the seek in the buffers + // let's empty them. + stopAtomic(false); + playAtomic(); + if (waspaused) + pauseAtomic(); offsetSamples = 0; offsetSeconds = 0; }