diff options
author | Chris Robinson <[email protected]> | 2013-05-23 18:50:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2013-05-23 18:50:07 -0700 |
commit | f667c028e627d6fcc0dc7c661c20d104243da067 (patch) | |
tree | 172c090e8b1fb5cd093d30c05853930d6d2372d2 | |
parent | dbb6da8c479173c7fd72c781f071935d3ef4ec6a (diff) |
Move the AL_EFFECT_NULL state into a separate file
-rw-r--r-- | Alc/effects/null.c | 104 | ||||
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 1 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 97 |
4 files changed, 107 insertions, 96 deletions
diff --git a/Alc/effects/null.c b/Alc/effects/null.c new file mode 100644 index 00000000..8636d573 --- /dev/null +++ b/Alc/effects/null.c @@ -0,0 +1,104 @@ +#include "config.h" + +#include <stdlib.h> + +#include "AL/al.h" +#include "AL/alc.h" +#include "alMain.h" +#include "alAuxEffectSlot.h" +#include "alError.h" + + +typedef struct ALnullStateFactory { + DERIVE_FROM_TYPE(ALeffectStateFactory); +} ALnullStateFactory; + +static ALnullStateFactory NullFactory; + + +typedef struct ALnullState { + DERIVE_FROM_TYPE(ALeffectState); +} ALnullState; + +static ALvoid ALnullState_Destruct(ALnullState *state) +{ + (void)state; +} +static ALboolean ALnullState_DeviceUpdate(ALnullState *state, ALCdevice *device) +{ + return AL_TRUE; + (void)state; + (void)device; +} +static ALvoid ALnullState_Update(ALnullState *state, ALCdevice *device, const ALeffectslot *slot) +{ + (void)state; + (void)device; + (void)slot; +} +static ALvoid ALnullState_Process(ALnullState *state, ALuint samplesToDo, const ALfloat *restrict samplesIn, ALfloat (*restrict samplesOut)[BUFFERSIZE]) +{ + (void)state; + (void)samplesToDo; + (void)samplesIn; + (void)samplesOut; +} +static ALeffectStateFactory *ALnullState_getCreator(void) +{ + return STATIC_CAST(ALeffectStateFactory, &NullFactory); +} + +DEFINE_ALEFFECTSTATE_VTABLE(ALnullState); + + +ALeffectState *ALnullStateFactory_create(void) +{ + ALnullState *state; + + state = calloc(1, sizeof(*state)); + if(!state) return NULL; + SET_VTABLE2(ALnullState, ALeffectState, state); + + return STATIC_CAST(ALeffectState, state); +} + +static ALvoid ALnullStateFactory_destroy(ALeffectState *effect) +{ + ALnullState *state = STATIC_UPCAST(ALnullState, ALeffectState, effect); + ALnullState_Destruct(state); + free(state); +} + +DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALnullStateFactory); + + +static void init_none_factory(void) +{ + SET_VTABLE2(ALnullStateFactory, ALeffectStateFactory, &NullFactory); +} + +ALeffectStateFactory *ALnullStateFactory_getFactory(void) +{ + static pthread_once_t once = PTHREAD_ONCE_INIT; + pthread_once(&once, init_none_factory); + return STATIC_CAST(ALeffectStateFactory, &NullFactory); +} + + +void null_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void null_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } +void null_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void null_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } + +void null_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void null_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } +void null_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } +void null_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } diff --git a/CMakeLists.txt b/CMakeLists.txt index ea7c359d..9581c329 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -439,6 +439,7 @@ SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c ) SET(ALC_OBJS Alc/ALc.c Alc/ALu.c + Alc/effects/null.c Alc/alcChorus.c Alc/alcConfig.c Alc/alcDedicated.c diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index a81c1326..ff88fe7b 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -102,6 +102,7 @@ ALenum InitEffectSlot(ALeffectslot *slot); ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context); +ALeffectStateFactory *ALnullStateFactory_getFactory(void); ALeffectStateFactory *ALreverbStateFactory_getFactory(void); ALeffectStateFactory *ALchorusStateFactory_getFactory(void); ALeffectStateFactory *ALdistortionStateFactory_getFactory(void); diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index ed82b00b..0b2cce21 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -398,101 +398,6 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p } -typedef struct ALnoneStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALnoneStateFactory; - -static ALnoneStateFactory NoneFactory; - - -typedef struct ALnoneState { - DERIVE_FROM_TYPE(ALeffectState); -} ALnoneState; - -static ALvoid ALnoneState_Destruct(ALnoneState *state) -{ - (void)state; -} -static ALboolean ALnoneState_DeviceUpdate(ALnoneState *state, ALCdevice *device) -{ - return AL_TRUE; - (void)state; - (void)device; -} -static ALvoid ALnoneState_Update(ALnoneState *state, ALCdevice *device, const ALeffectslot *slot) -{ - (void)state; - (void)device; - (void)slot; -} -static ALvoid ALnoneState_Process(ALnoneState *state, ALuint samplesToDo, const ALfloat *restrict samplesIn, ALfloat (*restrict samplesOut)[BUFFERSIZE]) -{ - (void)state; - (void)samplesToDo; - (void)samplesIn; - (void)samplesOut; -} -static ALeffectStateFactory *ALnoneState_getCreator(void) -{ - return STATIC_CAST(ALeffectStateFactory, &NoneFactory); -} - -DEFINE_ALEFFECTSTATE_VTABLE(ALnoneState); - - -ALeffectState *ALnoneStateFactory_create(void) -{ - ALnoneState *state; - - state = calloc(1, sizeof(*state)); - if(!state) return NULL; - SET_VTABLE2(ALnoneState, ALeffectState, state); - - return STATIC_CAST(ALeffectState, state); -} - -static ALvoid ALnoneStateFactory_destroy(ALeffectState *effect) -{ - ALnoneState *state = STATIC_UPCAST(ALnoneState, ALeffectState, effect); - ALnoneState_Destruct(state); - free(state); -} - -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALnoneStateFactory); - - -static void init_none_factory(void) -{ - SET_VTABLE2(ALnoneStateFactory, ALeffectStateFactory, &NoneFactory); -} - -ALeffectStateFactory *ALnoneStateFactory_getFactory(void) -{ - static pthread_once_t once = PTHREAD_ONCE_INIT; - pthread_once(&once, init_none_factory); - return STATIC_CAST(ALeffectStateFactory, &NoneFactory); -} - - -void null_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -void null_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } -void null_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -void null_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } - -void null_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -void null_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } -void null_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) -{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); } -void null_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } - - static ALvoid RemoveEffectSlotArray(ALCcontext *Context, ALeffectslot *slot) { ALeffectslot **slotlist, **slotlistend; @@ -550,7 +455,7 @@ void InitEffectFactoryMap(void) { InitUIntMap(&EffectStateFactoryMap, ~0); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_NULL, ALnoneStateFactory_getFactory()); + InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_NULL, ALnullStateFactory_getFactory()); InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_EAXREVERB, ALreverbStateFactory_getFactory()); InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_REVERB, ALreverbStateFactory_getFactory()); InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_CHORUS, ALchorusStateFactory_getFactory()); |