Allocate enough reverb panning gains
[openal-soft.git] / Alc / effects / null.c
blob0600703d87b529ec9d712ceee90e3e94877764c2
1 #include "config.h"
3 #include <stdlib.h>
5 #include "AL/al.h"
6 #include "AL/alc.h"
7 #include "alMain.h"
8 #include "alAuxEffectSlot.h"
9 #include "alError.h"
12 typedef struct ALnullState {
13 DERIVE_FROM_TYPE(ALeffectState);
14 } ALnullState;
17 /* This destructs (not free!) the effect state. It's called only when the
18 * effect slot is no longer used.
20 static ALvoid ALnullState_Destruct(ALnullState* UNUSED(state))
24 /* This updates the device-dependant effect state. This is called on
25 * initialization and any time the device parameters (eg. playback frequency,
26 * format) have been changed.
28 static ALboolean ALnullState_deviceUpdate(ALnullState* UNUSED(state), ALCdevice* UNUSED(device))
30 return AL_TRUE;
33 /* This updates the effect state. This is called any time the effect is
34 * (re)loaded into a slot.
36 static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCdevice* UNUSED(device), const ALeffectslot* UNUSED(slot))
40 /* This processes the effect state, for the given number of samples from the
41 * input to the output buffer. The result should be added to the output buffer,
42 * not replace it.
44 static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALuint UNUSED(samplesToDo), const ALfloatBUFFERSIZE*restrict UNUSED(samplesIn), ALfloatBUFFERSIZE*restrict UNUSED(samplesOut), ALuint UNUSED(NumChannels))
48 /* This allocates memory to store the object, before it gets constructed.
49 * DECLARE_DEFAULT_ALLOCATORS can be used to declate a default method.
51 static void *ALnullState_New(size_t size)
53 return malloc(size);
56 /* This frees the memory used by the object, after it has been destructed.
57 * DECLARE_DEFAULT_ALLOCATORS can be used to declate a default method.
59 static void ALnullState_Delete(void *ptr)
61 free(ptr);
64 /* Define the forwards and the ALeffectState vtable for this type. */
65 DEFINE_ALEFFECTSTATE_VTABLE(ALnullState);
68 typedef struct ALnullStateFactory {
69 DERIVE_FROM_TYPE(ALeffectStateFactory);
70 } ALnullStateFactory;
72 /* Creates ALeffectState objects of the appropriate type. */
73 ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory))
75 ALnullState *state;
77 state = ALnullState_New(sizeof(*state));
78 if(!state) return NULL;
79 /* Set vtables for inherited types. */
80 SET_VTABLE2(ALnullState, ALeffectState, state);
82 return STATIC_CAST(ALeffectState, state);
85 /* Define the ALeffectStateFactory vtable for this type. */
86 DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALnullStateFactory);
88 ALeffectStateFactory *ALnullStateFactory_getFactory(void)
90 static ALnullStateFactory NullFactory = { { GET_VTABLE2(ALnullStateFactory, ALeffectStateFactory) } };
92 return STATIC_CAST(ALeffectStateFactory, &NullFactory);
96 void ALnull_setParami(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val))
98 switch(param)
100 default:
101 SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
104 void ALnull_setParamiv(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, const ALint* UNUSED(vals))
106 switch(param)
108 default:
109 SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
112 void ALnull_setParamf(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val))
114 switch(param)
116 default:
117 SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
120 void ALnull_setParamfv(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat* UNUSED(vals))
122 switch(param)
124 default:
125 SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
129 void ALnull_getParami(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(val))
131 switch(param)
133 default:
134 SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
137 void ALnull_getParamiv(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(vals))
139 switch(param)
141 default:
142 SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
145 void ALnull_getParamf(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(val))
147 switch(param)
149 default:
150 SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
153 void ALnull_getParamfv(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(vals))
155 switch(param)
157 default:
158 SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
162 DEFINE_ALEFFECT_VTABLE(ALnull);