1 #ifndef EAX_EAX_CALL_INCLUDED
2 #define EAX_EAX_CALL_INCLUDED
8 #include "fx_slot_index.h"
10 enum class EaxCallType
{
16 enum class EaxCallPropertySetId
{
22 }; // EaxCallPropertySetId
28 const GUID
& property_set_guid
,
30 ALuint property_source_id
,
31 ALvoid
* property_buffer
,
32 ALuint property_size
);
34 [[nodiscard
]] auto is_get() const noexcept
-> bool { return mCallType
== EaxCallType::get
; }
35 [[nodiscard
]] auto is_deferred() const noexcept
-> bool { return mIsDeferred
; }
36 [[nodiscard
]] auto get_version() const noexcept
-> int { return mVersion
; }
37 [[nodiscard
]] auto get_property_set_id() const noexcept
-> EaxCallPropertySetId
{ return mPropertySetId
; }
38 [[nodiscard
]] auto get_property_id() const noexcept
-> ALuint
{ return mPropertyId
; }
39 [[nodiscard
]] auto get_property_al_name() const noexcept
-> ALuint
{ return mPropertySourceId
; }
40 [[nodiscard
]] auto get_fx_slot_index() const noexcept
-> EaxFxSlotIndex
{ return mFxSlotIndex
; }
42 template<typename TException
, typename TValue
>
43 [[nodiscard
]] auto get_value() const -> TValue
&
45 if(mPropertyBufferSize
< sizeof(TValue
))
48 return *static_cast<TValue
*>(mPropertyBuffer
);
51 template<typename TValue
>
52 [[nodiscard
]] auto get_values(size_t max_count
) const -> al::span
<TValue
>
54 if(max_count
== 0 || mPropertyBufferSize
< sizeof(TValue
))
57 const auto count
= std::min(mPropertyBufferSize
/sizeof(TValue
), max_count
);
58 return {static_cast<TValue
*>(mPropertyBuffer
), count
};
61 template<typename TValue
>
62 [[nodiscard
]] auto get_values() const -> al::span
<TValue
>
64 return get_values
<TValue
>(~0_uz
);
67 template<typename TException
, typename TValue
>
68 auto set_value(const TValue
& value
) const -> void
70 get_value
<TException
, TValue
>() = value
;
74 const EaxCallType mCallType
;
76 EaxFxSlotIndex mFxSlotIndex
{};
77 EaxCallPropertySetId mPropertySetId
{EaxCallPropertySetId::none
};
80 const ALuint mPropertyId
;
81 const ALuint mPropertySourceId
;
82 ALvoid
*const mPropertyBuffer
;
83 const ALuint mPropertyBufferSize
;
85 [[noreturn
]] static void fail(const char* message
);
86 [[noreturn
]] static void fail_too_small();
89 EaxCall
create_eax_call(
91 const GUID
* property_set_id
,
93 ALuint property_source_id
,
94 ALvoid
* property_buffer
,
95 ALuint property_size
);
97 #endif // !EAX_EAX_CALL_INCLUDED