diff options
author | Chris Robinson <[email protected]> | 2010-11-29 17:35:22 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-11-29 17:35:22 -0800 |
commit | 547f35613122b5583e24fd182c38d47b3a154354 (patch) | |
tree | fd6aef6680e9ede7e4204966c3aaceae55b01930 /OpenAL32 | |
parent | 017ab1b3fd6d5c95dc2793af0cb2bb394e6fbe12 (diff) |
Keep a handle on the buffer with the format when queueing new buffers
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/alSource.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index db975eb5..34830766 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1543,8 +1543,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A ALsizei i; ALbufferlistitem *BufferListStart; ALbufferlistitem *BufferList; - ALint Frequency; - ALint Format; + ALbuffer *BufferFmt; if(n == 0) return; @@ -1577,8 +1576,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A device = Context->Device; - Frequency = -1; - Format = -1; + BufferFmt = NULL; // Check existing Queue (if any) for a valid Buffers and get its frequency and format BufferList = Source->queue; @@ -1586,8 +1584,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A { if(BufferList->buffer) { - Frequency = BufferList->buffer->Frequency; - Format = BufferList->buffer->OriginalFormat; + BufferFmt = BufferList->buffer; break; } BufferList = BufferList->next; @@ -1604,10 +1601,9 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A goto done; } - if(Frequency == -1 && Format == -1) + if(BufferFmt == NULL) { - Frequency = buffer->Frequency; - Format = buffer->OriginalFormat; + BufferFmt = buffer; if(buffer->FmtChannels == FmtMono) Source->Update = CalcSourceParams; @@ -1616,7 +1612,8 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A Source->NeedsUpdate = AL_TRUE; } - else if(Frequency != buffer->Frequency || Format != buffer->OriginalFormat) + else if(BufferFmt->Frequency != buffer->Frequency || + BufferFmt->OriginalFormat != buffer->OriginalFormat) { alSetError(Context, AL_INVALID_OPERATION); goto done; |