aboutsummaryrefslogtreecommitdiffstats
path: root/al/source.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'al/source.cpp')
-rw-r--r--al/source.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/al/source.cpp b/al/source.cpp
index 047551bf..07a9d9e0 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -309,29 +309,21 @@ ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context)
const ALbufferlistitem *BufferList{Source->queue};
const ALbuffer *BufferFmt{nullptr};
- ALuint totalBufferLen{0u};
- bool readFin{false};
-
while(BufferList)
{
if(!BufferFmt) BufferFmt = BufferList->mBuffer;
+ if(BufferList == Current) break;
- readFin |= (BufferList == Current);
- totalBufferLen += BufferList->mSampleLen;
- if(!readFin) readPos += BufferList->mSampleLen;
+ readPos += BufferList->mSampleLen;
BufferList = BufferList->mNext.load(std::memory_order_relaxed);
}
- assert(BufferFmt != nullptr);
-
- if(Source->Looping)
- readPos %= totalBufferLen;
- else
+ while(BufferList && !BufferFmt)
{
- /* Wrap back to 0 */
- if(readPos >= totalBufferLen)
- readPos = readPosFrac = 0;
+ BufferFmt = BufferList->mBuffer;
+ BufferList = BufferList->mNext.load(std::memory_order_relaxed);
}
+ assert(BufferFmt != nullptr);
switch(name)
{