summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alcEcho.c5
-rw-r--r--Alc/alcReverb.c5
-rw-r--r--OpenAL32/alAuxEffectSlot.c25
3 files changed, 24 insertions, 11 deletions
diff --git a/Alc/alcEcho.c b/Alc/alcEcho.c
index 7185e125..deaae622 100644
--- a/Alc/alcEcho.c
+++ b/Alc/alcEcho.c
@@ -26,6 +26,7 @@
#include "alMain.h"
#include "alFilter.h"
#include "alAuxEffectSlot.h"
+#include "alError.h"
#include "alu.h"
typedef struct ALechoState {
@@ -160,7 +161,10 @@ ALeffectState *EchoCreate(ALCcontext *Context)
state = malloc(sizeof(*state));
if(!state)
+ {
+ alSetError(AL_OUT_OF_MEMORY);
return NULL;
+ }
state->state.Destroy = EchoDestroy;
state->state.Update = EchoUpdate;
@@ -176,6 +180,7 @@ ALeffectState *EchoCreate(ALCcontext *Context)
if(!state->SampleBuffer)
{
free(state);
+ alSetError(AL_OUT_OF_MEMORY);
return NULL;
}
diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c
index 846d3802..42c823ce 100644
--- a/Alc/alcReverb.c
+++ b/Alc/alcReverb.c
@@ -28,6 +28,7 @@
#include "alMain.h"
#include "alAuxEffectSlot.h"
#include "alEffect.h"
+#include "alError.h"
#include "alu.h"
typedef struct DelayLine
@@ -665,7 +666,10 @@ ALeffectState *VerbCreate(ALCcontext *Context)
State = malloc(sizeof(ALverbState));
if(!State)
+ {
+ alSetError(AL_OUT_OF_MEMORY);
return NULL;
+ }
State->state.Destroy = VerbDestroy;
State->state.Update = VerbUpdate;
@@ -710,6 +714,7 @@ ALeffectState *VerbCreate(ALCcontext *Context)
if(!State->SampleBuffer)
{
free(State);
+ alSetError(AL_OUT_OF_MEMORY);
return NULL;
}
for(index = 0; index < totalLength;index++)
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 62d153c1..f606a099 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -471,9 +471,22 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot,
{
if((!effect) || (effect->type != ALEffectSlot->effect.type))
{
+ ALeffectState *NewState = NULL;
+ if(effect)
+ {
+ if(effect->type == AL_EFFECT_EAXREVERB)
+ NewState = EAXVerbCreate(Context);
+ else if(effect->type == AL_EFFECT_REVERB)
+ NewState = VerbCreate(Context);
+ else if(effect->type == AL_EFFECT_ECHO)
+ NewState = EchoCreate(Context);
+ /* No new state? An error occured.. */
+ if(!NewState)
+ return;
+ }
if(ALEffectSlot->EffectState)
ALEffect_Destroy(ALEffectSlot->EffectState);
- ALEffectSlot->EffectState = NULL;
+ ALEffectSlot->EffectState = NewState;
}
if(!effect)
{
@@ -481,16 +494,6 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot,
return;
}
memcpy(&ALEffectSlot->effect, effect, sizeof(*effect));
-
- if(!ALEffectSlot->EffectState)
- {
- if(effect->type == AL_EFFECT_EAXREVERB)
- ALEffectSlot->EffectState = EAXVerbCreate(Context);
- else if(effect->type == AL_EFFECT_REVERB)
- ALEffectSlot->EffectState = VerbCreate(Context);
- else if(effect->type == AL_EFFECT_ECHO)
- ALEffectSlot->EffectState = EchoCreate(Context);
- }
ALEffect_Update(ALEffectSlot->EffectState, Context, effect);
}