1 #ifndef _AL_AUXEFFECTSLOT_H_
2 #define _AL_AUXEFFECTSLOT_H_
13 struct ALeffectStateVtable
;
16 typedef struct ALeffectState
{
17 const struct ALeffectStateVtable
*vtbl
;
20 struct ALeffectStateVtable
{
21 void (*const Destruct
)(ALeffectState
*state
);
23 ALboolean (*const deviceUpdate
)(ALeffectState
*state
, ALCdevice
*device
);
24 void (*const update
)(ALeffectState
*state
, ALCdevice
*device
, const struct ALeffectslot
*slot
);
25 void (*const process
)(ALeffectState
*state
, ALuint samplesToDo
, const ALfloat
*restrict samplesIn
, ALfloat (*restrict samplesOut
)[BUFFERSIZE
], ALuint numChannels
);
27 void (*const Delete
)(void *ptr
);
30 #define DEFINE_ALEFFECTSTATE_VTABLE(T) \
31 DECLARE_THUNK(T, ALeffectState, void, Destruct) \
32 DECLARE_THUNK1(T, ALeffectState, ALboolean, deviceUpdate, ALCdevice*) \
33 DECLARE_THUNK2(T, ALeffectState, void, update, ALCdevice*, const ALeffectslot*) \
34 DECLARE_THUNK4(T, ALeffectState, void, process, ALuint, const ALfloat*restrict, ALfloatBUFFERSIZE*restrict, ALuint) \
35 static void T##_ALeffectState_Delete(void *ptr) \
36 { return T##_Delete(STATIC_UPCAST(T, ALeffectState, (ALeffectState*)ptr)); } \
38 static const struct ALeffectStateVtable T##_ALeffectState_vtable = { \
39 T##_ALeffectState_Destruct, \
41 T##_ALeffectState_deviceUpdate, \
42 T##_ALeffectState_update, \
43 T##_ALeffectState_process, \
45 T##_ALeffectState_Delete, \
49 struct ALeffectStateFactoryVtable
;
51 typedef struct ALeffectStateFactory
{
52 const struct ALeffectStateFactoryVtable
*vtbl
;
53 } ALeffectStateFactory
;
55 struct ALeffectStateFactoryVtable
{
56 ALeffectState
*(*const create
)(ALeffectStateFactory
*factory
);
59 #define DEFINE_ALEFFECTSTATEFACTORY_VTABLE(T) \
60 DECLARE_THUNK(T, ALeffectStateFactory, ALeffectState*, create) \
62 static const struct ALeffectStateFactoryVtable T##_ALeffectStateFactory_vtable = { \
63 T##_ALeffectStateFactory_create, \
67 typedef struct ALeffectslot
{
69 ALeffectProps EffectProps
;
71 volatile ALfloat Gain
;
72 volatile ALboolean AuxSendAuto
;
74 ATOMIC(ALenum
) NeedsUpdate
;
75 ALeffectState
*EffectState
;
77 alignas(16) ALfloat WetBuffer
[1][BUFFERSIZE
];
85 inline struct ALeffectslot
*LookupEffectSlot(ALCcontext
*context
, ALuint id
)
86 { return (struct ALeffectslot
*)LookupUIntMapKey(&context
->EffectSlotMap
, id
); }
87 inline struct ALeffectslot
*RemoveEffectSlot(ALCcontext
*context
, ALuint id
)
88 { return (struct ALeffectslot
*)RemoveUIntMapKey(&context
->EffectSlotMap
, id
); }
90 ALenum
InitEffectSlot(ALeffectslot
*slot
);
91 ALvoid
ReleaseALAuxiliaryEffectSlots(ALCcontext
*Context
);
94 ALeffectStateFactory
*ALnullStateFactory_getFactory(void);
95 ALeffectStateFactory
*ALreverbStateFactory_getFactory(void);
96 ALeffectStateFactory
*ALautowahStateFactory_getFactory(void);
97 ALeffectStateFactory
*ALchorusStateFactory_getFactory(void);
98 ALeffectStateFactory
*ALcompressorStateFactory_getFactory(void);
99 ALeffectStateFactory
*ALdistortionStateFactory_getFactory(void);
100 ALeffectStateFactory
*ALechoStateFactory_getFactory(void);
101 ALeffectStateFactory
*ALequalizerStateFactory_getFactory(void);
102 ALeffectStateFactory
*ALflangerStateFactory_getFactory(void);
103 ALeffectStateFactory
*ALmodulatorStateFactory_getFactory(void);
105 ALeffectStateFactory
*ALdedicatedStateFactory_getFactory(void);
108 ALenum
InitializeEffect(ALCdevice
*Device
, ALeffectslot
*EffectSlot
, ALeffect
*effect
);
110 void InitEffectFactoryMap(void);
111 void DeinitEffectFactoryMap(void);