diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 23 | ||||
-rw-r--r-- | OpenAL32/Include/alEcho.h | 24 | ||||
-rw-r--r-- | OpenAL32/Include/alReverb.h | 28 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 41 |
4 files changed, 35 insertions, 81 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 8dfa9418..e4c46d70 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -4,8 +4,6 @@ #include "AL/al.h" #include "alEffect.h" #include "alFilter.h" -#include "alReverb.h" -#include "alEcho.h" #ifdef __cplusplus extern "C" { @@ -17,6 +15,8 @@ extern "C" { #define AL_EFFECTSLOT_NULL 0x0000 +typedef struct ALeffectState ALeffectState; + typedef struct ALeffectslot { ALeffect effect; @@ -24,8 +24,7 @@ typedef struct ALeffectslot ALfloat Gain; ALboolean AuxSendAuto; - ALverbState *ReverbState; - ALechoState *EchoState; + ALeffectState *EffectState; ALfloat WetBuffer[BUFFERSIZE]; @@ -53,6 +52,22 @@ ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, A ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context); + +struct ALeffectState { + ALvoid (*Destroy)(ALeffectState *State); + ALvoid (*Update)(ALeffectState *State, ALCcontext *Context, ALeffectslot *Slot, ALeffect *Effect); + ALvoid (*Process)(ALeffectState *State, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS]); +}; + +ALeffectState *EAXVerbCreate(ALCcontext *Context); +ALeffectState *VerbCreate(ALCcontext *Context); +ALeffectState *EchoCreate(ALCcontext *Context); + +#define ALEffect_Destroy(a) ((a)->Destroy((a))) +#define ALEffect_Update(a,b,c,d) ((a)->Update((a),(b),(c),(d))) +#define ALEffect_Process(a,b,c,d) ((a)->Process((a),(b),(c),(d))) + + #ifdef __cplusplus } #endif diff --git a/OpenAL32/Include/alEcho.h b/OpenAL32/Include/alEcho.h deleted file mode 100644 index 34896ea7..00000000 --- a/OpenAL32/Include/alEcho.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef AL_ECHO_H -#define AL_ECHO_H - -#include "AL/al.h" -#include "AL/alc.h" -#include "alMain.h" -#include "alEffect.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct ALechoState ALechoState; - -ALechoState *EchoCreate(ALCcontext *Context); -ALvoid EchoDestroy(ALechoState *State); -ALvoid EchoUpdate(ALCcontext *Context, struct ALeffectslot *Slot, ALeffect *Effect); -ALvoid EchoProcess(ALechoState *State, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS]); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/OpenAL32/Include/alReverb.h b/OpenAL32/Include/alReverb.h deleted file mode 100644 index 95b5adb0..00000000 --- a/OpenAL32/Include/alReverb.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _AL_REVERB_H_ -#define _AL_REVERB_H_ - -#include "AL/al.h" -#include "AL/alc.h" -#include "alMain.h" -#include "alAuxEffectSlot.h" -#include "alEffect.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct ALverbState ALverbState; - -ALverbState *VerbCreate(ALCcontext *Context); -ALverbState *EAXVerbCreate(ALCcontext *Context); -ALvoid VerbDestroy(ALverbState *State); -ALvoid VerbUpdate(ALCcontext *Context, struct ALeffectslot *Slot, ALeffect *Effect); -ALvoid VerbProcess(ALverbState *State, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS]); -ALvoid EAXVerbProcess(ALverbState *State, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS]); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index c9b8ac62..d2e43183 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -29,7 +29,6 @@ #include "alAuxEffectSlot.h" #include "alThunk.h" #include "alError.h" -#include "alReverb.h" static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, ALeffect *effect); @@ -150,8 +149,8 @@ ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) *list = (*list)->next; ALTHUNK_REMOVEENTRY(ALAuxiliaryEffectSlot->effectslot); - VerbDestroy(ALAuxiliaryEffectSlot->ReverbState); - EchoDestroy(ALAuxiliaryEffectSlot->EchoState); + if(ALAuxiliaryEffectSlot->EffectState) + ALEffect_Destroy(ALAuxiliaryEffectSlot->EffectState); memset(ALAuxiliaryEffectSlot, 0, sizeof(ALeffectslot)); free(ALAuxiliaryEffectSlot); @@ -472,10 +471,9 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, { if((!effect) || (effect->type != ALEffectSlot->effect.type)) { - VerbDestroy(ALEffectSlot->ReverbState); - ALEffectSlot->ReverbState = NULL; - EchoDestroy(ALEffectSlot->EchoState); - ALEffectSlot->EchoState = NULL; + if(ALEffectSlot->EffectState) + ALEffect_Destroy(ALEffectSlot->EffectState); + ALEffectSlot->EffectState = NULL; } if(!effect) { @@ -483,24 +481,17 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, return; } memcpy(&ALEffectSlot->effect, effect, sizeof(*effect)); - if(effect->type == AL_EFFECT_EAXREVERB) - { - if(!ALEffectSlot->ReverbState) - ALEffectSlot->ReverbState = EAXVerbCreate(Context); - VerbUpdate(Context, ALEffectSlot, effect); - } - else if(effect->type == AL_EFFECT_REVERB) - { - if(!ALEffectSlot->ReverbState) - ALEffectSlot->ReverbState = VerbCreate(Context); - VerbUpdate(Context, ALEffectSlot, effect); - } - else if(effect->type == AL_EFFECT_ECHO) + + if(!ALEffectSlot->EffectState) { - if(!ALEffectSlot->EchoState) - ALEffectSlot->EchoState = EchoCreate(Context); - EchoUpdate(Context, ALEffectSlot, effect); + 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, ALEffectSlot, effect); } @@ -517,8 +508,8 @@ ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context) Context->AuxiliaryEffectSlot = Context->AuxiliaryEffectSlot->next; // Release effectslot structure - VerbDestroy(temp->ReverbState); - EchoDestroy(temp->EchoState); + if(temp->EffectState) + ALEffect_Destroy(temp->EffectState); ALTHUNK_REMOVEENTRY(temp->effectslot); memset(temp, 0, sizeof(ALeffectslot)); |