aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c2
-rw-r--r--OpenAL32/Include/alAuxEffectSlot.h2
-rw-r--r--OpenAL32/alAuxEffectSlot.c32
3 files changed, 20 insertions, 16 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 32bcf917..21d1ac9a 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2297,7 +2297,7 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
UnlockLists();
if(device->DefaultSlot)
- InitializeEffect(ALContext, device->DefaultSlot, &DefaultEffect);
+ InitializeEffect(device, device->DefaultSlot, &DefaultEffect);
ALContext->LastError = AL_NO_ERROR;
ALCdevice_DecRef(device);
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h
index 2d5df671..9cc9accb 100644
--- a/OpenAL32/Include/alAuxEffectSlot.h
+++ b/OpenAL32/Include/alAuxEffectSlot.h
@@ -56,7 +56,7 @@ ALeffectState *DedicatedCreate(void);
#define ALeffectState_Update(a,b,c) ((a)->Update((a),(b),(c)))
#define ALeffectState_Process(a,b,c,d) ((a)->Process((a),(b),(c),(d)))
-ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect);
+ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *effect);
#ifdef __cplusplus
}
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 9668eafe..b3385a40 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -181,8 +181,12 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
if(iValue == 0 ||
(effect=LookupEffect(Device, iValue)) != NULL)
{
- InitializeEffect(Context, EffectSlot, effect);
- Context->UpdateSources = AL_TRUE;
+ ALenum err;
+ err = InitializeEffect(Device, EffectSlot, effect);
+ if(err != AL_NO_ERROR)
+ alSetError(Context, err);
+ else
+ Context->UpdateSources = AL_TRUE;
}
else
alSetError(Context, AL_INVALID_VALUE);
@@ -497,13 +501,13 @@ static ALenum ResizeEffectSlotArray(ALCcontext *Context, ALsizei count)
return AL_NO_ERROR;
}
-ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect)
+ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *effect)
{
ALenum newtype = (effect ? effect->type : AL_EFFECT_NULL);
ALeffectState *State = NULL;
ALenum err = AL_NO_ERROR;
- LockContext(Context);
+ LockDevice(Device);
if(newtype == AL_EFFECT_NULL && EffectSlot->effect.type != AL_EFFECT_NULL)
{
State = NoneCreate();
@@ -538,9 +542,8 @@ ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
if(err != AL_NO_ERROR)
{
- UnlockContext(Context);
- alSetError(Context, err);
- return;
+ UnlockDevice(Device);
+ return err;
}
if(State)
@@ -548,13 +551,12 @@ ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
int oldMode;
oldMode = SetMixerFPUMode();
- if(ALeffectState_DeviceUpdate(State, Context->Device) == AL_FALSE)
+ if(ALeffectState_DeviceUpdate(State, Device) == AL_FALSE)
{
RestoreFPUMode(oldMode);
- UnlockContext(Context);
+ UnlockDevice(Device);
ALeffectState_Destroy(State);
- alSetError(Context, AL_OUT_OF_MEMORY);
- return;
+ return AL_OUT_OF_MEMORY;
}
State = ExchangePtr((XchgPtr*)&EffectSlot->EffectState, State);
@@ -566,8 +568,8 @@ ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
* object was changed, it needs an update before its Process method can
* be called. */
EffectSlot->NeedsUpdate = AL_FALSE;
- ALeffectState_Update(EffectSlot->EffectState, Context->Device, EffectSlot);
- UnlockContext(Context);
+ ALeffectState_Update(EffectSlot->EffectState, Device, EffectSlot);
+ UnlockDevice(Device);
RestoreFPUMode(oldMode);
@@ -580,9 +582,11 @@ ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
memset(&EffectSlot->effect, 0, sizeof(EffectSlot->effect));
else
memcpy(&EffectSlot->effect, effect, sizeof(*effect));
- UnlockContext(Context);
+ UnlockDevice(Device);
EffectSlot->NeedsUpdate = AL_TRUE;
}
+
+ return AL_NO_ERROR;
}