update OpenAL-Soft to 1.24.3.

This commit is contained in:
Sasha Szpakowski
2025-05-03 12:51:37 -03:00
parent 375c6f88cd
commit 5e4f3241ac
322 changed files with 54386 additions and 12885 deletions
+72 -66
View File
@@ -1,8 +1,11 @@
#ifndef AL_AUXEFFECTSLOT_H
#define AL_AUXEFFECTSLOT_H
#include "config.h"
#include <array>
#include <atomic>
#include <bitset>
#include <cstdint>
#include <string_view>
#include <utility>
@@ -16,7 +19,7 @@
#include "core/effectslot.h"
#include "intrusive_ptr.h"
#ifdef ALSOFT_EAX
#if ALSOFT_EAX
#include <memory>
#include "eax/api.h"
#include "eax/call.h"
@@ -28,7 +31,7 @@
struct ALbuffer;
#ifdef ALSOFT_EAX
#if ALSOFT_EAX
class EaxFxSlotException : public EaxException {
public:
explicit EaxFxSlotException(const char* message)
@@ -37,10 +40,8 @@ public:
};
#endif // ALSOFT_EAX
enum class SlotState : ALenum {
Initial = AL_INITIAL,
Playing = AL_PLAYING,
Stopped = AL_STOPPED,
enum class SlotState : bool {
Initial, Playing,
};
struct ALeffectslot {
@@ -52,7 +53,7 @@ struct ALeffectslot {
struct EffectData {
EffectSlotType Type{EffectSlotType::None};
EffectProps Props{};
EffectProps Props;
al::intrusive_ptr<EffectState> State;
};
@@ -69,7 +70,7 @@ struct ALeffectslot {
/* Self ID */
ALuint id{};
ALeffectslot(ALCcontext *context);
explicit ALeffectslot(ALCcontext *context);
ALeffectslot(const ALeffectslot&) = delete;
ALeffectslot& operator=(const ALeffectslot&) = delete;
~ALeffectslot();
@@ -81,13 +82,14 @@ struct ALeffectslot {
static void SetName(ALCcontext *context, ALuint id, std::string_view name);
#ifdef ALSOFT_EAX
#if ALSOFT_EAX
public:
void eax_initialize(ALCcontext& al_context, EaxFxSlotIndexValue index);
[[nodiscard]] auto eax_get_index() const noexcept -> EaxFxSlotIndexValue { return eax_fx_slot_index_; }
[[nodiscard]] auto eax_get_eax_fx_slot() const noexcept -> const EAX50FXSLOTPROPERTIES&
{ return eax_; }
[[nodiscard]]
auto eax_get_index() const noexcept -> EaxFxSlotIndexValue { return mEaxFXSlotIndex; }
[[nodiscard]]
auto eax_get_eax_fx_slot() const noexcept -> const EAX50FXSLOTPROPERTIES& { return mEax; }
// Returns `true` if all sources should be updated, or `false` otherwise.
[[nodiscard]] auto eax_dispatch(const EaxCall& call) -> bool
@@ -96,25 +98,24 @@ public:
void eax_commit();
private:
static constexpr auto eax_load_effect_dirty_bit = EaxDirtyFlags{1} << 0;
static constexpr auto eax_volume_dirty_bit = EaxDirtyFlags{1} << 1;
static constexpr auto eax_lock_dirty_bit = EaxDirtyFlags{1} << 2;
static constexpr auto eax_flags_dirty_bit = EaxDirtyFlags{1} << 3;
static constexpr auto eax_occlusion_dirty_bit = EaxDirtyFlags{1} << 4;
static constexpr auto eax_occlusion_lf_ratio_dirty_bit = EaxDirtyFlags{1} << 5;
enum {
eax_load_effect_dirty_bit,
eax_volume_dirty_bit,
eax_lock_dirty_bit,
eax_flags_dirty_bit,
eax_occlusion_dirty_bit,
eax_occlusion_lf_ratio_dirty_bit,
eax_dirty_bit_count
};
using Exception = EaxFxSlotException;
using Eax4Props = EAX40FXSLOTPROPERTIES;
struct Eax4State {
Eax4Props i; // Immediate.
EAX40FXSLOTPROPERTIES i; // Immediate.
};
using Eax5Props = EAX50FXSLOTPROPERTIES;
struct Eax5State {
Eax5Props i; // Immediate.
EAX50FXSLOTPROPERTIES i; // Immediate.
};
struct EaxRangeValidator {
@@ -194,6 +195,17 @@ private:
}
};
struct Eax5FlagsValidator {
void operator()(unsigned long ulFlags) const
{
EaxRangeValidator{}(
"Flags",
ulFlags,
0UL,
~EAX50FXSLOTFLAGS_RESERVED);
}
};
struct Eax5OcclusionValidator {
void operator()(long lOcclusion) const
{
@@ -216,35 +228,27 @@ private:
}
};
struct Eax5FlagsValidator {
void operator()(unsigned long ulFlags) const
{
EaxRangeValidator{}(
"Flags",
ulFlags,
0UL,
~EAX50FXSLOTFLAGS_RESERVED);
}
};
struct Eax5AllValidator {
void operator()(const EAX50FXSLOTPROPERTIES& all) const
{
Eax4AllValidator{}(static_cast<const EAX40FXSLOTPROPERTIES&>(all));
Eax4GuidLoadEffectValidator{}(all.guidLoadEffect);
Eax4VolumeValidator{}(all.lVolume);
Eax4LockValidator{}(all.lLock);
Eax5FlagsValidator{}(all.ulFlags);
Eax5OcclusionValidator{}(all.lOcclusion);
Eax5OcclusionLfRatioValidator{}(all.flOcclusionLFRatio);
}
};
ALCcontext* eax_al_context_{};
EaxFxSlotIndexValue eax_fx_slot_index_{};
int eax_version_{}; // Current EAX version.
EaxDirtyFlags eax_df_{}; // Dirty flags for the current EAX version.
EaxEffectUPtr eax_effect_{};
Eax5State eax123_{}; // EAX1/EAX2/EAX3 state.
Eax4State eax4_{}; // EAX4 state.
Eax5State eax5_{}; // EAX5 state.
Eax5Props eax_{}; // Current EAX state.
ALCcontext* mEaxALContext{};
EaxFxSlotIndexValue mEaxFXSlotIndex{};
int mEaxVersion{}; // Current EAX version.
std::bitset<eax_dirty_bit_count> mEaxDf; // Dirty flags for the current EAX version.
EaxEffectUPtr mEaxEffect;
Eax5State mEax123{}; // EAX1/EAX2/EAX3 state.
Eax4State mEax4{}; // EAX4 state.
Eax5State mEax5{}; // EAX5 state.
EAX50FXSLOTPROPERTIES mEax{}; // Current EAX state.
[[noreturn]] static void eax_fail(const char* message);
[[noreturn]] static void eax_fail_unknown_effect_id();
@@ -255,12 +259,14 @@ private:
// validates it,
// sets a dirty flag only if the new value differs form the old one,
// and assigns the new value.
template<typename TValidator, EaxDirtyFlags TDirtyBit, typename TProperties>
static void eax_fx_slot_set(const EaxCall& call, TProperties& dst, EaxDirtyFlags& dirty_flags)
template<typename TValidator, size_t DirtyBit, typename TProperties>
static void eax_fx_slot_set(const EaxCall& call, TProperties& dst,
std::bitset<eax_dirty_bit_count>& dirty_flags)
{
const auto& src = call.get_value<Exception, const TProperties>();
TValidator{}(src);
dirty_flags |= (dst != src ? TDirtyBit : EaxDirtyFlags{});
if(dst != src)
dirty_flags.set(DirtyBit);
dst = src;
}
@@ -268,18 +274,18 @@ private:
// validates it,
// sets a dirty flag without comparing the values,
// and assigns the new value.
template<typename TValidator, EaxDirtyFlags TDirtyBit, typename TProperties>
template<typename TValidator, size_t DirtyBit, typename TProperties>
static void eax_fx_slot_set_dirty(const EaxCall& call, TProperties& dst,
EaxDirtyFlags& dirty_flags)
std::bitset<eax_dirty_bit_count>& dirty_flags)
{
const auto& src = call.get_value<Exception, const TProperties>();
TValidator{}(src);
dirty_flags |= TDirtyBit;
dirty_flags.set(DirtyBit);
dst = src;
}
[[nodiscard]] constexpr auto eax4_fx_slot_is_legacy() const noexcept -> bool
{ return eax_fx_slot_index_ < 2; }
{ return mEaxFXSlotIndex < 2; }
void eax4_fx_slot_ensure_unlocked() const;
@@ -287,15 +293,15 @@ private:
[[nodiscard]] auto eax_get_eax_default_effect_guid() const noexcept -> const GUID&;
[[nodiscard]] auto eax_get_eax_default_lock() const noexcept -> long;
void eax4_fx_slot_set_defaults(Eax4Props& props) noexcept;
void eax5_fx_slot_set_defaults(Eax5Props& props) noexcept;
void eax4_fx_slot_set_current_defaults(const Eax4Props& props) noexcept;
void eax5_fx_slot_set_current_defaults(const Eax5Props& props) noexcept;
void eax4_fx_slot_set_defaults(EAX40FXSLOTPROPERTIES& props) noexcept;
void eax5_fx_slot_set_defaults(EAX50FXSLOTPROPERTIES& props) noexcept;
void eax4_fx_slot_set_current_defaults(const EAX40FXSLOTPROPERTIES& props) noexcept;
void eax5_fx_slot_set_current_defaults(const EAX50FXSLOTPROPERTIES& props) noexcept;
void eax_fx_slot_set_current_defaults();
void eax_fx_slot_set_defaults();
static void eax4_fx_slot_get(const EaxCall& call, const Eax4Props& props);
static void eax5_fx_slot_get(const EaxCall& call, const Eax5Props& props);
static void eax4_fx_slot_get(const EaxCall& call, const EAX40FXSLOTPROPERTIES& props);
static void eax5_fx_slot_get(const EaxCall& call, const EAX50FXSLOTPROPERTIES& props);
void eax_fx_slot_get(const EaxCall& call) const;
// Returns `true` if all sources should be updated, or `false` otherwise.
bool eax_get(const EaxCall& call);
@@ -320,25 +326,25 @@ private:
bool eax_set(const EaxCall& call);
template<
EaxDirtyFlags TDirtyBit,
size_t DirtyBit,
typename TMemberResult,
typename TProps,
typename TState>
void eax_fx_slot_commit_property(TState& state, EaxDirtyFlags& dst_df,
void eax_fx_slot_commit_property(TState& state, std::bitset<eax_dirty_bit_count>& dst_df,
TMemberResult TProps::*member) noexcept
{
auto& src_i = state.i;
auto& dst_i = eax_;
auto& dst_i = mEax;
if((eax_df_ & TDirtyBit) != EaxDirtyFlags{})
if(mEaxDf.test(DirtyBit))
{
dst_df |= TDirtyBit;
dst_df.set(DirtyBit);
dst_i.*member = src_i.*member;
}
}
void eax4_fx_slot_commit(EaxDirtyFlags& dst_df);
void eax5_fx_slot_commit(Eax5State& state, EaxDirtyFlags& dst_df);
void eax4_fx_slot_commit(std::bitset<eax_dirty_bit_count>& dst_df);
void eax5_fx_slot_commit(Eax5State& state, std::bitset<eax_dirty_bit_count>& dst_df);
// `alAuxiliaryEffectSloti(effect_slot, AL_EFFECTSLOT_EFFECT, effect)`
void eax_set_efx_slot_effect(EaxEffect &effect);
@@ -359,7 +365,7 @@ public:
void UpdateAllEffectSlotProps(ALCcontext *context);
#ifdef ALSOFT_EAX
#if ALSOFT_EAX
using EaxAlEffectSlotUPtr = std::unique_ptr<ALeffectslot, ALeffectslot::EaxDeleter>;
EaxAlEffectSlotUPtr eax_create_al_effect_slot(ALCcontext& context);