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 bool is_get() const noexcept { return mCallType == EaxCallType::get; }
35 bool is_deferred() const noexcept { return mIsDeferred; }
36 int get_version() const noexcept { return mVersion; }
37 EaxCallPropertySetId get_property_set_id() const noexcept { return mPropertySetId; }
38 ALuint get_property_id() const noexcept { return mPropertyId; }
39 ALuint get_property_al_name() const noexcept { return mPropertySourceId; }
40 EaxFxSlotIndex get_fx_slot_index() const noexcept { return mFxSlotIndex; }
42 template<typename TException, typename TValue>
43 TValue& get_value() const
45 if(mPropertyBufferSize < sizeof(TValue))
48 return *static_cast<TValue*>(mPropertyBuffer);
51 template<typename TValue>
52 al::span<TValue> get_values(size_t max_count) const
54 if(max_count == 0 || mPropertyBufferSize < sizeof(TValue))
57 const auto count = minz(mPropertyBufferSize / sizeof(TValue), max_count);
58 return al::as_span(static_cast<TValue*>(mPropertyBuffer), count);
61 template<typename TValue>
62 al::span<TValue> get_values() const
64 return get_values<TValue>(~size_t{});
67 template<typename TException, typename TValue>
68 void set_value(const TValue& value) const
70 get_value<TException, TValue>() = value;
74 const EaxCallType mCallType;
76 EaxFxSlotIndex mFxSlotIndex;
77 EaxCallPropertySetId mPropertySetId;
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