From 88de4e15b33dd0c84e5120cee039b2596536767d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 25 Dec 2009 05:09:29 -0800 Subject: [PATCH] Mark the source for updating when setting a buffer on it Changing the buffer can change the playback format, which can require different source parameter calculations. Queueing a buffer on a source that has no buffers (or only buffers without a format, eg. buffer 0) has the same effect --- OpenAL32/alSource.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index f26d30ad..5ffc503c 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -607,6 +607,7 @@ ALAPI ALvoid ALAPIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) // Update AL_BUFFER parameter pSource->Buffer = buffer; + pSource->NeedsUpdate = AL_TRUE; } else alSetError(AL_INVALID_VALUE); @@ -1581,6 +1582,7 @@ ALAPI ALvoid ALAPIENTRY alSourceQueueBuffers( ALuint source, ALsizei n, const AL ALint iFrequency; ALint iFormat; ALboolean bBuffersValid = AL_TRUE; + ALboolean hadFormat = AL_FALSE; if (n == 0) return; @@ -1609,6 +1611,7 @@ ALAPI ALvoid ALAPIENTRY alSourceQueueBuffers( ALuint source, ALsizei n, const AL { iFrequency = ALBufferList->buffer->frequency; iFormat = ALBufferList->buffer->format; + hadFormat = AL_TRUE; break; } ALBufferList = ALBufferList->next; @@ -1693,6 +1696,10 @@ ALAPI ALvoid ALAPIENTRY alSourceQueueBuffers( ALuint source, ALsizei n, const AL // Update number of buffers in queue ALSource->BuffersInQueue += n; + // If no previous format, mark the source dirty now that it may + // have one + if(!hadFormat) + ALSource->NeedsUpdate = AL_TRUE; } } else -- 2.11.4.GIT