diff options
author | Chris Robinson <[email protected]> | 2010-08-03 23:10:00 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-08-03 23:10:00 -0700 |
commit | e74976e6451670c433ee09695125801c12e74e22 (patch) | |
tree | 227434c3dd5e975ada8f4318bd0d05f953f40de8 /OpenAL32/alSource.c | |
parent | 91278608c5d342a9c4322bd6296d0eba9eb3af4c (diff) |
Use a callback to specify the source update method
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 6e5ed1e6..0db6f76b 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -574,6 +574,11 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) Source->queue = BufferListItem; Source->BuffersInQueue = 1; + if(aluChannelsFromFormat(buffer->format) == 1) + Source->Update = CalcSourceParams; + else + Source->Update = CalcNonAttnSourceParams; + // Increment reference counter for buffer buffer->refcount++; } @@ -1560,7 +1565,6 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A ALsizei i; ALbufferlistitem *BufferListStart; ALbufferlistitem *BufferList; - ALboolean HadFormat; ALint Frequency; ALint Format; @@ -1591,7 +1595,6 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A Frequency = -1; Format = -1; - HadFormat = AL_FALSE; // Check existing Queue (if any) for a valid Buffers and get its frequency and format BufferList = Source->queue; @@ -1601,7 +1604,6 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A { Frequency = BufferList->buffer->frequency; Format = BufferList->buffer->eOriginalFormat; - HadFormat = AL_TRUE; break; } BufferList = BufferList->next; @@ -1622,6 +1624,11 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A { Frequency = buffer->frequency; Format = buffer->eOriginalFormat; + if(aluChannelsFromFormat(buffer->format) == 1) + Source->Update = CalcSourceParams; + else + Source->Update = CalcNonAttnSourceParams; + Source->NeedsUpdate = AL_TRUE; } else if(Frequency != buffer->frequency || Format != buffer->eOriginalFormat) { @@ -1677,9 +1684,6 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A // Update number of buffers in queue Source->BuffersInQueue += n; - // If no previous format, mark the source dirty now that it may have one - if(!HadFormat) - Source->NeedsUpdate = AL_TRUE; done: ProcessContext(Context); |