Reject older versions of PipeWire than built against
[openal-soft.git] / al / eax_eax_call.h
blob7b990d8724db6d085dce53bbc206dbef9e948779
1 #ifndef EAX_EAX_CALL_INCLUDED
2 #define EAX_EAX_CALL_INCLUDED
5 #include "AL/al.h"
7 #include "alspan.h"
9 #include "eax_api.h"
10 #include "eax_fx_slot_index.h"
13 enum class EaxEaxCallPropertySetId
15 none,
17 context,
18 fx_slot,
19 source,
20 fx_slot_effect,
21 }; // EaxEaxCallPropertySetId
24 class EaxEaxCall
26 public:
27 EaxEaxCall(
28 bool is_get,
29 const GUID& property_set_guid,
30 ALuint property_id,
31 ALuint property_source_id,
32 ALvoid* property_buffer,
33 ALuint property_size);
35 bool is_get() const noexcept { return is_get_; }
36 int get_version() const noexcept { return version_; }
37 EaxEaxCallPropertySetId get_property_set_id() const noexcept { return property_set_id_; }
38 ALuint get_property_id() const noexcept { return property_id_; }
39 ALuint get_property_al_name() const noexcept { return property_source_id_; }
40 EaxFxSlotIndex get_fx_slot_index() const noexcept { return fx_slot_index_; }
42 template<
43 typename TException,
44 typename TValue
46 TValue& get_value() const
48 if (property_size_ < static_cast<ALuint>(sizeof(TValue)))
50 throw TException{"Property buffer too small."};
53 return *static_cast<TValue*>(property_buffer_);
56 template<
57 typename TException,
58 typename TValue
60 al::span<TValue> get_values() const
62 if (property_size_ < static_cast<ALuint>(sizeof(TValue)))
64 throw TException{"Property buffer too small."};
67 const auto count = property_size_ / sizeof(TValue);
69 return al::span<TValue>{static_cast<TValue*>(property_buffer_), count};
72 template<
73 typename TException,
74 typename TValue
76 void set_value(
77 const TValue& value) const
79 get_value<TException, TValue>() = value;
83 private:
84 const bool is_get_;
85 int version_;
86 EaxFxSlotIndex fx_slot_index_;
87 EaxEaxCallPropertySetId property_set_id_;
89 ALuint property_id_;
90 const ALuint property_source_id_;
91 ALvoid*const property_buffer_;
92 const ALuint property_size_;
95 [[noreturn]]
96 static void fail(
97 const char* message);
100 static ALuint convert_eax_v2_0_listener_property_id(
101 ALuint property_id);
103 static ALuint convert_eax_v2_0_buffer_property_id(
104 ALuint property_id);
105 }; // EaxEaxCall
108 EaxEaxCall create_eax_call(
109 bool is_get,
110 const GUID* property_set_id,
111 ALuint property_id,
112 ALuint property_source_id,
113 ALvoid* property_buffer,
114 ALuint property_size);
117 #endif // !EAX_EAX_CALL_INCLUDED