aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-12-25 05:09:29 -0800
committerChris Robinson <[email protected]>2009-12-25 05:09:29 -0800
commit88de4e15b33dd0c84e5120cee039b2596536767d (patch)
treedf862530eb93efddadf037b5fb24a053087c2396 /OpenAL32
parent7f0c6629b9ec1ec1cf11dfbd4a6bba43d3cce9e2 (diff)
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
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alSource.c7
1 files changed, 7 insertions, 0 deletions
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