From 19ed994dc30ed84ea7cbbb5152577669fc25caf6 Mon Sep 17 00:00:00 2001 From: "Boris I. Bendovsky" Date: Sun, 30 Jan 2022 14:47:32 +0200 Subject: Add EAX extensions (EAX 2.0-5.0, X-RAM) (#632) * Add EAX extensions (EAX 2.0-5.0, X-RAM) * Comment out C++17 leftovers * Remove everything related to patching * Update alsoftrc.sample * Rewrite integration * Fix GCC compilation under Linux * Always reset EAX effect properties when loading it into FX slot --- al/auxeffectslot.h | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) (limited to 'al/auxeffectslot.h') diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h index 4de1df7a..54f1987d 100644 --- a/al/auxeffectslot.h +++ b/al/auxeffectslot.h @@ -16,6 +16,15 @@ #include "intrusive_ptr.h" #include "vector.h" +#if ALSOFT_EAX +#include + +#include "al/effect.h" + +#include "eax_eax_call.h" +#include "eax_fx_slot_index.h" +#endif // ALSOFT_EAX + struct ALbuffer; struct ALeffect; struct WetBuffer; @@ -61,8 +70,220 @@ struct ALeffectslot { /* This can be new'd for the context's default effect slot. */ DEF_NEWDEL(ALeffectslot) + + +#if ALSOFT_EAX +public: + void eax_initialize( + ALCcontext& al_context, + EaxFxSlotIndexValue index); + + void eax_uninitialize() noexcept; + + + const EAX50FXSLOTPROPERTIES& eax_get_eax_fx_slot() const noexcept; + + + // [[nodiscard]] + bool eax_dispatch( + const EaxEaxCall& eax_call); + + +private: + ALCcontext* eax_al_context_{}; + + EaxFxSlotIndexValue eax_fx_slot_index_{}; + + EAX50FXSLOTPROPERTIES eax_eax_fx_slot_{}; + + EaxAlEffectUPtr eax_al_effect_{}; + + + [[noreturn]] + static void eax_fail( + const char* message); + + + void eax_set_eax_fx_slot_defaults(); + + void eax_initialize_eax(); + + + void eax_initialize_effects(); + + + void eax_set_default_slot_0_defaults(); + + void eax_set_default_slot_1_defaults(); + + void eax_set_default_slots_defaults(); + + + void eax_get_fx_slot_all( + const EaxEaxCall& eax_call) const; + + void eax_get_fx_slot( + const EaxEaxCall& eax_call) const; + + // [[nodiscard]] + bool eax_get( + const EaxEaxCall& eax_call); + + + void eax_set_fx_slot_effect( + ALenum effect_type); + + void eax_set_fx_slot_effect(); + + + void eax_set_efx_effect_slot_gain(); + + void eax_set_fx_slot_volume(); + + + void eax_set_effect_slot_send_auto(); + + void eax_set_fx_slot_flags(); + + + void eax_validate_fx_slot_effect( + const GUID& eax_effect_id); + + void eax_validate_fx_slot_volume( + long eax_volume); + + void eax_validate_fx_slot_lock( + long eax_lock); + + void eax_validate_fx_slot_lock_state( + long eax_lock, + const GUID& eax_effect_id); + + void eax_validate_fx_slot_flags( + unsigned long eax_flags, + int eax_version); + + void eax_validate_fx_slot_occlusion( + long eax_occlusion); + + void eax_validate_fx_slot_occlusion_lf_ratio( + float eax_occlusion_lf_ratio); + + void eax_validate_fx_slot_all( + const EAX40FXSLOTPROPERTIES& fx_slot, + int eax_version); + + void eax_validate_fx_slot_all( + const EAX50FXSLOTPROPERTIES& fx_slot, + int eax_version); + + + void eax_set_fx_slot_effect( + const GUID& eax_effect_id); + + void eax_set_fx_slot_volume( + long eax_volume); + + void eax_set_fx_slot_lock( + long eax_lock); + + void eax_set_fx_slot_flags( + unsigned long eax_flags); + + // [[nodiscard]] + bool eax_set_fx_slot_occlusion( + long eax_occlusion); + + // [[nodiscard]] + bool eax_set_fx_slot_occlusion_lf_ratio( + float eax_occlusion_lf_ratio); + + void eax_set_fx_slot_all( + const EAX40FXSLOTPROPERTIES& eax_fx_slot); + + // [[nodiscard]] + bool eax_set_fx_slot_all( + const EAX50FXSLOTPROPERTIES& eax_fx_slot); + + + void eax_set_fx_slot_effect( + const EaxEaxCall& eax_call); + + void eax_set_fx_slot_volume( + const EaxEaxCall& eax_call); + + void eax_set_fx_slot_lock( + const EaxEaxCall& eax_call); + + void eax_set_fx_slot_flags( + const EaxEaxCall& eax_call); + + // [[nodiscard]] + bool eax_set_fx_slot_occlusion( + const EaxEaxCall& eax_call); + + // [[nodiscard]] + bool eax_set_fx_slot_occlusion_lf_ratio( + const EaxEaxCall& eax_call); + + // [[nodiscard]] + bool eax_set_fx_slot_all( + const EaxEaxCall& eax_call); + + bool eax_set_fx_slot( + const EaxEaxCall& eax_call); + + // [[nodiscard]] + bool eax_set( + const EaxEaxCall& eax_call); + + + void eax_dispatch_effect( + const EaxEaxCall& eax_call); + + + // `alAuxiliaryEffectSloti(effect_slot, AL_EFFECTSLOT_EFFECT, effect)` + void eax_set_effect_slot_effect( + ALeffect& effect); + + // `alAuxiliaryEffectSloti(effect_slot, AL_EFFECTSLOT_AUXILIARY_SEND_AUTO, value)` + void eax_set_effect_slot_send_auto( + bool is_send_auto); + + // `alAuxiliaryEffectSlotf(effect_slot, AL_EFFECTSLOT_GAIN, gain)` + void eax_set_effect_slot_gain( + ALfloat gain); +#endif // ALSOFT_EAX }; void UpdateAllEffectSlotProps(ALCcontext *context); +#if ALSOFT_EAX +class EaxAlEffectSlotDeleter +{ +public: + EaxAlEffectSlotDeleter() noexcept = default; + + EaxAlEffectSlotDeleter( + ALCcontext& context) noexcept; + + void operator()( + ALeffectslot* effect_slot); + + +private: + ALCcontext* context_{}; +}; // EaxAlEffectSlotDeleter + +using EaxAlEffectSlotUPtr = std::unique_ptr; + + +EaxAlEffectSlotUPtr eax_create_al_effect_slot( + ALCcontext& context); + +void eax_delete_al_effect_slot( + ALCcontext& context, + ALeffectslot& effect_slot); +#endif // ALSOFT_EAX + #endif -- cgit v1.2.3