Store loop points as uncompressed frame offsets in the source when a buffer is attached

This commit is contained in:
Chris Robinson 2010-05-13 02:10:33 -07:00
parent 0ce138341c
commit 5d579dd1a8
2 changed files with 14 additions and 0 deletions

View File

@ -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;

View File

@ -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++;
}