1 #ifndef _AL_AUXEFFECTSLOT_H_ 2 #define _AL_AUXEFFECTSLOT_H_ 14 struct ALeffectStateVtable;
17 typedef struct ALeffectState {
19 const struct ALeffectStateVtable *vtbl;
21 ALfloat (*OutBuffer)[BUFFERSIZE];
25 void ALeffectState_Construct(ALeffectState *state);
26 void ALeffectState_Destruct(ALeffectState *state);
28 struct ALeffectStateVtable {
29 void (*
const Destruct)(ALeffectState *state);
31 ALboolean (*
const deviceUpdate)(ALeffectState *state, ALCdevice *device);
32 void (*
const update)(ALeffectState *state,
const ALCcontext *context,
const struct ALeffectslot *slot,
const union ALeffectProps *props);
33 void (*
const process)(ALeffectState *state, ALsizei samplesToDo,
const ALfloat (*restrict samplesIn)[BUFFERSIZE], ALfloat (*restrict samplesOut)[BUFFERSIZE], ALsizei numChannels);
35 void (*
const Delete)(
void *ptr);
41 typedef ALfloat ALfloatBUFFERSIZE[BUFFERSIZE];
43 #define DEFINE_ALEFFECTSTATE_VTABLE(T) \ 44 DECLARE_THUNK(T, ALeffectState, void, Destruct) \ 45 DECLARE_THUNK1(T, ALeffectState, ALboolean, deviceUpdate, ALCdevice*) \ 46 DECLARE_THUNK3(T, ALeffectState, void, update, const ALCcontext*, const ALeffectslot*, const ALeffectProps*) \ 47 DECLARE_THUNK4(T, ALeffectState, void, process, ALsizei, const ALfloatBUFFERSIZE*restrict, ALfloatBUFFERSIZE*restrict, ALsizei) \ 48 static void T##_ALeffectState_Delete(void *ptr) \ 49 { return T##_Delete(STATIC_UPCAST(T, ALeffectState, (ALeffectState*)ptr)); } \ 51 static const struct ALeffectStateVtable T##_ALeffectState_vtable = { \ 52 T##_ALeffectState_Destruct, \ 54 T##_ALeffectState_deviceUpdate, \ 55 T##_ALeffectState_update, \ 56 T##_ALeffectState_process, \ 58 T##_ALeffectState_Delete, \ 62 struct EffectStateFactoryVtable;
64 typedef struct EffectStateFactory {
65 const struct EffectStateFactoryVtable *vtab;
68 struct EffectStateFactoryVtable {
69 ALeffectState *(*
const create)(EffectStateFactory *factory);
71 #define EffectStateFactory_create(x) ((x)->vtab->create((x))) 73 #define DEFINE_EFFECTSTATEFACTORY_VTABLE(T) \ 74 DECLARE_THUNK(T, EffectStateFactory, ALeffectState*, create) \ 76 static const struct EffectStateFactoryVtable T##_EffectStateFactory_vtable = { \ 77 T##_EffectStateFactory_create, \ 81 #define MAX_EFFECT_CHANNELS (4) 84 struct ALeffectslotArray {
86 struct ALeffectslot *slot[];
90 struct ALeffectslotProps {
92 ALboolean AuxSendAuto;
99 ATOMIC(
struct ALeffectslotProps*) next;
103 typedef struct ALeffectslot {
105 ALboolean AuxSendAuto;
111 ALeffectState *State;
114 ATOMIC_FLAG PropsClean;
118 ATOMIC(
struct ALeffectslotProps*) Update;
122 ALboolean AuxSendAuto;
125 ALeffectProps EffectProps;
126 ALeffectState *EffectState;
130 ALfloat DecayLFRatio;
131 ALfloat DecayHFRatio;
132 ALboolean DecayHFLimit;
133 ALfloat AirAbsorptionGainHF;
140 BFChannelConfig ChanMap[MAX_EFFECT_CHANNELS];
151 alignas(16) ALfloat WetBuffer[MAX_EFFECT_CHANNELS][BUFFERSIZE];
154 ALenum InitEffectSlot(ALeffectslot *slot);
155 void DeinitEffectSlot(ALeffectslot *slot);
156 void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context);
157 void UpdateAllEffectSlotProps(ALCcontext *context);
158 ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context);
161 EffectStateFactory *NullStateFactory_getFactory(
void);
162 EffectStateFactory *ReverbStateFactory_getFactory(
void);
163 EffectStateFactory *AutowahStateFactory_getFactory(
void);
164 EffectStateFactory *ChorusStateFactory_getFactory(
void);
165 EffectStateFactory *CompressorStateFactory_getFactory(
void);
166 EffectStateFactory *DistortionStateFactory_getFactory(
void);
167 EffectStateFactory *EchoStateFactory_getFactory(
void);
168 EffectStateFactory *EqualizerStateFactory_getFactory(
void);
169 EffectStateFactory *FlangerStateFactory_getFactory(
void);
170 EffectStateFactory *FshifterStateFactory_getFactory(
void);
171 EffectStateFactory *ModulatorStateFactory_getFactory(
void);
172 EffectStateFactory *PshifterStateFactory_getFactory(
void);
174 EffectStateFactory *DedicatedStateFactory_getFactory(
void);
177 ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect);
179 void ALeffectState_DecRef(ALeffectState *state);