8 #include "alAuxEffectSlot.h"
12 typedef struct ALnullState
{
13 DERIVE_FROM_TYPE(ALeffectState
);
16 /* Forward-declare "virtual" functions to define the vtable with. */
17 static ALvoid
ALnullState_Destruct(ALnullState
*state
);
18 static ALboolean
ALnullState_deviceUpdate(ALnullState
*state
, ALCdevice
*device
);
19 static ALvoid
ALnullState_update(ALnullState
*state
, const ALCdevice
*device
, const ALeffectslot
*slot
, const ALeffectProps
*props
);
20 static ALvoid
ALnullState_process(ALnullState
*state
, ALuint samplesToDo
, const ALfloatBUFFERSIZE
*restrict samplesIn
, ALfloatBUFFERSIZE
*restrict samplesOut
, ALuint NumChannels
);
21 static void *ALnullState_New(size_t size
);
22 static void ALnullState_Delete(void *ptr
);
24 /* Define the ALeffectState vtable for this type. */
25 DEFINE_ALEFFECTSTATE_VTABLE(ALnullState
);
28 /* This constructs the effect state. It's called when the object is first
29 * created. Make sure to call the parent Construct function first, and set the
32 static void ALnullState_Construct(ALnullState
*state
)
34 ALeffectState_Construct(STATIC_CAST(ALeffectState
, state
));
35 SET_VTABLE2(ALnullState
, ALeffectState
, state
);
38 /* This destructs (not free!) the effect state. It's called only when the
39 * effect slot is no longer used. Make sure to call the parent Destruct
40 * function before returning!
42 static ALvoid
ALnullState_Destruct(ALnullState
*state
)
44 ALeffectState_Destruct(STATIC_CAST(ALeffectState
,state
));
47 /* This updates the device-dependant effect state. This is called on
48 * initialization and any time the device parameters (eg. playback frequency,
49 * format) have been changed.
51 static ALboolean
ALnullState_deviceUpdate(ALnullState
* UNUSED(state
), ALCdevice
* UNUSED(device
))
56 /* This updates the effect state. This is called any time the effect is
57 * (re)loaded into a slot.
59 static ALvoid
ALnullState_update(ALnullState
* UNUSED(state
), const ALCdevice
* UNUSED(device
), const ALeffectslot
* UNUSED(slot
), const ALeffectProps
* UNUSED(props
))
63 /* This processes the effect state, for the given number of samples from the
64 * input to the output buffer. The result should be added to the output buffer,
67 static ALvoid
ALnullState_process(ALnullState
* UNUSED(state
), ALuint
UNUSED(samplesToDo
), const ALfloatBUFFERSIZE
*restrict
UNUSED(samplesIn
), ALfloatBUFFERSIZE
*restrict
UNUSED(samplesOut
), ALuint
UNUSED(NumChannels
))
71 /* This allocates memory to store the object, before it gets constructed.
72 * DECLARE_DEFAULT_ALLOCATORS can be used to declare a default method.
74 static void *ALnullState_New(size_t size
)
76 return al_malloc(16, size
);
79 /* This frees the memory used by the object, after it has been destructed.
80 * DECLARE_DEFAULT_ALLOCATORS can be used to declare a default method.
82 static void ALnullState_Delete(void *ptr
)
88 typedef struct ALnullStateFactory
{
89 DERIVE_FROM_TYPE(ALeffectStateFactory
);
92 /* Creates ALeffectState objects of the appropriate type. */
93 ALeffectState
*ALnullStateFactory_create(ALnullStateFactory
*UNUSED(factory
))
97 NEW_OBJ0(state
, ALnullState
)();
98 if(!state
) return NULL
;
100 return STATIC_CAST(ALeffectState
, state
);
103 /* Define the ALeffectStateFactory vtable for this type. */
104 DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALnullStateFactory
);
106 ALeffectStateFactory
*ALnullStateFactory_getFactory(void)
108 static ALnullStateFactory NullFactory
= { { GET_VTABLE2(ALnullStateFactory
, ALeffectStateFactory
) } };
109 return STATIC_CAST(ALeffectStateFactory
, &NullFactory
);
113 void ALnull_setParami(ALeffect
* UNUSED(effect
), ALCcontext
*context
, ALenum param
, ALint
UNUSED(val
))
118 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
121 void ALnull_setParamiv(ALeffect
* UNUSED(effect
), ALCcontext
*context
, ALenum param
, const ALint
* UNUSED(vals
))
126 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
129 void ALnull_setParamf(ALeffect
* UNUSED(effect
), ALCcontext
*context
, ALenum param
, ALfloat
UNUSED(val
))
134 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
137 void ALnull_setParamfv(ALeffect
* UNUSED(effect
), ALCcontext
*context
, ALenum param
, const ALfloat
* UNUSED(vals
))
142 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
146 void ALnull_getParami(const ALeffect
* UNUSED(effect
), ALCcontext
*context
, ALenum param
, ALint
* UNUSED(val
))
151 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
154 void ALnull_getParamiv(const ALeffect
* UNUSED(effect
), ALCcontext
*context
, ALenum param
, ALint
* UNUSED(vals
))
159 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
162 void ALnull_getParamf(const ALeffect
* UNUSED(effect
), ALCcontext
*context
, ALenum param
, ALfloat
* UNUSED(val
))
167 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
170 void ALnull_getParamfv(const ALeffect
* UNUSED(effect
), ALCcontext
*context
, ALenum param
, ALfloat
* UNUSED(vals
))
175 SET_ERROR_AND_RETURN(context
, AL_INVALID_ENUM
);
179 DEFINE_ALEFFECT_VTABLE(ALnull
);