aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-06-16 18:22:01 -0700
committerChris Robinson <[email protected]>2016-06-16 18:29:18 -0700
commit80da138d7f78ddb5a91b5644001d2aa1da4f7a61 (patch)
treeb48f72867305cd596e2da82ea2e16369c0f99750 /OpenAL32/alSource.c
parent697ee19f71183d7da87e58ca89d67830b30f9eb5 (diff)
Ensure voices has been updated once before mixing them
Sometimes the mixer is temporarily prevented from applying updates, when multiple sources need to be updated simultaneously for example, but does not prevent mixing. If the mixer runs during that time and a voice was just started, it would've mixed the voice without any internal properties being set for it.
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 5cc6c34b..e79f0fc3 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -2986,10 +2986,17 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
voice->Source = Source;
}
- /* Clear previous samples if playback is discontinuous. */
if(discontinuity)
+ {
+ /* Clear previous samples if playback is discontinuous. */
memset(voice->PrevSamples, 0, sizeof(voice->PrevSamples));
+ /* Clear the stepping value so the mixer knows not to mix this
+ * until the update gets applied.
+ */
+ voice->Step = 0;
+ }
+
voice->Moving = AL_FALSE;
for(i = 0;i < MAX_INPUT_CHANNELS;i++)
{