aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-05-13 02:10:33 -0700
committerChris Robinson <[email protected]>2010-05-13 02:10:33 -0700
commit5d579dd1a80e8bb4e408024f4706faa0d041f91e (patch)
treede3d581d06e71c3eff46cdbeb35aac581e3be88a /OpenAL32
parent0ce138341c73edc1d42158760bb2d402419361dd (diff)
Store loop points as uncompressed frame offsets in the source when a buffer is attached
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alSource.h4
-rw-r--r--OpenAL32/alSource.c10
2 files changed, 14 insertions, 0 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 0802cbaa..85a73059 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -78,6 +78,10 @@ typedef struct ALsource
ALint lOffset;
ALint lOffsetType;
+ // Only valid for static sources types
+ ALint LoopStart;
+ ALint LoopEnd;
+
// Source Type (Static, Streaming, or Undetermined)
ALint lSourceType;
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index ba79f03f..df7abbcc 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -554,6 +554,8 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
// Add the buffer to the queue (as long as it is NOT the NULL buffer)
if(lValue != 0)
{
+ ALuint channels;
+
// Source is now in STATIC mode
Source->lSourceType = AL_STATIC;
@@ -565,6 +567,14 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
Source->queue = BufferListItem;
Source->BuffersInQueue = 1;
+ channels = aluChannelsFromFormat(buffer->format);
+ Source->LoopStart = FramesFromBytes(buffer->LoopStart,
+ buffer->eOriginalFormat,
+ channels);
+ Source->LoopEnd = FramesFromBytes(buffer->LoopEnd,
+ buffer->eOriginalFormat,
+ channels);
+
// Increment reference counter for buffer
buffer->refcount++;
}