diff options
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 6c4a31f2..fdabaeb2 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -50,7 +50,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo else { ALenum err; - ALsizei i, j; + ALsizei i; err = ResizeEffectSlotArray(Context, n); if(err != AL_NO_ERROR) @@ -62,7 +62,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo for(i = 0;i < n;i++) { ALeffectslot *slot = calloc(1, sizeof(ALeffectslot)); - if(!slot || !(slot->EffectState=NoneCreate())) + if(!slot || InitEffectSlot(slot) != AL_NO_ERROR) { free(slot); // We must have run out or memory @@ -71,18 +71,6 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo break; } - slot->Gain = 1.0; - slot->AuxSendAuto = AL_TRUE; - slot->NeedsUpdate = AL_FALSE; - for(j = 0;j < BUFFERSIZE;j++) - slot->WetBuffer[j] = 0.0f; - for(j = 0;j < 1;j++) - { - slot->ClickRemoval[j] = 0.0f; - slot->PendingClicks[j] = 0.0f; - } - slot->ref = 0; - LockContext(Context); err = ResizeEffectSlotArray(Context, 1); if(err == AL_NO_ERROR) @@ -599,6 +587,28 @@ ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect } +ALenum InitEffectSlot(ALeffectslot *slot) +{ + ALint i; + + if(!(slot->EffectState=NoneCreate())) + return AL_OUT_OF_MEMORY; + + slot->Gain = 1.0; + slot->AuxSendAuto = AL_TRUE; + slot->NeedsUpdate = AL_FALSE; + for(i = 0;i < BUFFERSIZE;i++) + slot->WetBuffer[i] = 0.0f; + for(i = 0;i < 1;i++) + { + slot->ClickRemoval[i] = 0.0f; + slot->PendingClicks[i] = 0.0f; + } + slot->ref = 0; + + return AL_NO_ERROR; +} + ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context) { ALsizei pos; |