1 #ifndef AL_AUXEFFECTSLOT_H
2 #define AL_AUXEFFECTSLOT_H
11 #include "alc/device.h"
12 #include "alc/effects/base.h"
15 #include "core/effectslot.h"
16 #include "intrusive_ptr.h"
22 #include "eax_eax_call.h"
23 #include "eax_effect.h"
24 #include "eax_fx_slot_index.h"
32 enum class SlotState
: ALenum
{
40 bool AuxSendAuto
{true};
41 ALeffectslot
*Target
{nullptr};
42 ALbuffer
*Buffer
{nullptr};
45 EffectSlotType Type
{EffectSlotType::None
};
48 al::intrusive_ptr
<EffectState
> State
;
51 bool mPropsDirty
{true};
53 SlotState mState
{SlotState::Initial
};
63 ALeffectslot(const ALeffectslot
&) = delete;
64 ALeffectslot
& operator=(const ALeffectslot
&) = delete;
67 ALenum
initEffect(ALenum effectType
, const EffectProps
&effectProps
, ALCcontext
*context
);
68 void updateProps(ALCcontext
*context
);
70 /* This can be new'd for the context's default effect slot. */
71 DEF_NEWDEL(ALeffectslot
)
77 ALCcontext
& al_context
,
78 EaxFxSlotIndexValue index
);
81 const EAX50FXSLOTPROPERTIES
& eax_get_eax_fx_slot() const noexcept
;
86 const EaxEaxCall
& eax_call
);
88 void eax_unlock_legacy() noexcept
;
92 ALCcontext
* eax_al_context_
{};
94 EaxFxSlotIndexValue eax_fx_slot_index_
{};
96 EAX50FXSLOTPROPERTIES eax_eax_fx_slot_
{};
98 EaxEffectUPtr eax_effect_
{};
99 bool eax_is_locked_
{};
103 static void eax_fail(
104 const char* message
);
107 GUID
eax_get_eax_default_effect_guid() const noexcept
;
108 long eax_get_eax_default_lock() const noexcept
;
110 void eax_set_eax_fx_slot_defaults();
112 void eax_initialize_eax();
114 void eax_initialize_lock();
117 void eax_initialize_effects();
120 void eax_get_fx_slot_all(
121 const EaxEaxCall
& eax_call
) const;
123 void eax_get_fx_slot(
124 const EaxEaxCall
& eax_call
) const;
128 const EaxEaxCall
& eax_call
);
131 void eax_set_fx_slot_effect(
134 void eax_set_fx_slot_effect();
137 void eax_set_efx_effect_slot_gain();
139 void eax_set_fx_slot_volume();
142 void eax_set_effect_slot_send_auto();
144 void eax_set_fx_slot_flags();
147 void eax_ensure_is_unlocked() const;
150 void eax_validate_fx_slot_effect(
151 const GUID
& eax_effect_id
);
153 void eax_validate_fx_slot_volume(
156 void eax_validate_fx_slot_lock(
159 void eax_validate_fx_slot_flags(
160 unsigned long eax_flags
,
163 void eax_validate_fx_slot_occlusion(
166 void eax_validate_fx_slot_occlusion_lf_ratio(
167 float eax_occlusion_lf_ratio
);
169 void eax_validate_fx_slot_all(
170 const EAX40FXSLOTPROPERTIES
& fx_slot
,
173 void eax_validate_fx_slot_all(
174 const EAX50FXSLOTPROPERTIES
& fx_slot
,
178 void eax_set_fx_slot_effect(
179 const GUID
& eax_effect_id
);
181 void eax_set_fx_slot_volume(
184 void eax_set_fx_slot_lock(
187 void eax_set_fx_slot_flags(
188 unsigned long eax_flags
);
191 bool eax_set_fx_slot_occlusion(
195 bool eax_set_fx_slot_occlusion_lf_ratio(
196 float eax_occlusion_lf_ratio
);
198 void eax_set_fx_slot_all(
199 const EAX40FXSLOTPROPERTIES
& eax_fx_slot
);
202 bool eax_set_fx_slot_all(
203 const EAX50FXSLOTPROPERTIES
& eax_fx_slot
);
206 void eax_set_fx_slot_effect(
207 const EaxEaxCall
& eax_call
);
209 void eax_set_fx_slot_volume(
210 const EaxEaxCall
& eax_call
);
212 void eax_set_fx_slot_lock(
213 const EaxEaxCall
& eax_call
);
215 void eax_set_fx_slot_flags(
216 const EaxEaxCall
& eax_call
);
219 bool eax_set_fx_slot_occlusion(
220 const EaxEaxCall
& eax_call
);
223 bool eax_set_fx_slot_occlusion_lf_ratio(
224 const EaxEaxCall
& eax_call
);
227 bool eax_set_fx_slot_all(
228 const EaxEaxCall
& eax_call
);
230 bool eax_set_fx_slot(
231 const EaxEaxCall
& eax_call
);
235 const EaxEaxCall
& eax_call
);
238 void eax_dispatch_effect(
239 const EaxEaxCall
& eax_call
);
242 // `alAuxiliaryEffectSloti(effect_slot, AL_EFFECTSLOT_EFFECT, effect)`
243 void eax_set_effect_slot_effect(EaxEffect
&effect
);
245 // `alAuxiliaryEffectSloti(effect_slot, AL_EFFECTSLOT_AUXILIARY_SEND_AUTO, value)`
246 void eax_set_effect_slot_send_auto(bool is_send_auto
);
248 // `alAuxiliaryEffectSlotf(effect_slot, AL_EFFECTSLOT_GAIN, gain)`
249 void eax_set_effect_slot_gain(ALfloat gain
);
253 void UpdateAllEffectSlotProps(ALCcontext
*context
);
256 class EaxAlEffectSlotDeleter
259 EaxAlEffectSlotDeleter() noexcept
= default;
261 EaxAlEffectSlotDeleter(
262 ALCcontext
& context
) noexcept
;
265 ALeffectslot
* effect_slot
);
269 ALCcontext
* context_
{};
270 }; // EaxAlEffectSlotDeleter
272 using EaxAlEffectSlotUPtr
= std::unique_ptr
<ALeffectslot
, EaxAlEffectSlotDeleter
>;
275 EaxAlEffectSlotUPtr
eax_create_al_effect_slot(
276 ALCcontext
& context
);
278 void eax_delete_al_effect_slot(
280 ALeffectslot
& effect_slot
);