From d807c4bf8778a1db47015c7b0ff32a8d02a84a8d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 25 Jan 2012 18:48:26 -0800 Subject: Don't process a default device slot if it doesn't exist --- Alc/ALu.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index 96a46aeb..62cc36c4 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -989,22 +989,25 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) } slot = &device->DefaultSlot; - for(c = 0;c < SamplesToDo;c++) + if(*slot != NULL) { - (*slot)->WetBuffer[c] += (*slot)->ClickRemoval[0]; - (*slot)->ClickRemoval[0] -= (*slot)->ClickRemoval[0] * (1.0f/256.0f); - } - (*slot)->ClickRemoval[0] += (*slot)->PendingClicks[0]; - (*slot)->PendingClicks[0] = 0.0f; + for(c = 0;c < SamplesToDo;c++) + { + (*slot)->WetBuffer[c] += (*slot)->ClickRemoval[0]; + (*slot)->ClickRemoval[0] -= (*slot)->ClickRemoval[0] * (1.0f/256.0f); + } + (*slot)->ClickRemoval[0] += (*slot)->PendingClicks[0]; + (*slot)->PendingClicks[0] = 0.0f; - if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) - ALeffectState_Update((*slot)->EffectState, ctx, *slot); + if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) + ALeffectState_Update((*slot)->EffectState, ctx, *slot); - ALeffectState_Process((*slot)->EffectState, SamplesToDo, - (*slot)->WetBuffer, device->DryBuffer); + ALeffectState_Process((*slot)->EffectState, SamplesToDo, + (*slot)->WetBuffer, device->DryBuffer); - for(i = 0;i < SamplesToDo;i++) - (*slot)->WetBuffer[i] = 0.0f; + for(i = 0;i < SamplesToDo;i++) + (*slot)->WetBuffer[i] = 0.0f; + } UnlockDevice(device); //Post processing loop -- cgit v1.2.3