Make some local constexpr variables static
[openal-soft.git] / al / eax_eax_call.h
blobdd89795a7303e9004ac8c31bc35675e632ef9960
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 bool is_deferred() const noexcept { return is_deferred_; }
37 int get_version() const noexcept { return version_; }
38 EaxEaxCallPropertySetId get_property_set_id() const noexcept { return property_set_id_; }
39 ALuint get_property_id() const noexcept { return property_id_; }
40 ALuint get_property_al_name() const noexcept { return property_source_id_; }
41 EaxFxSlotIndex get_fx_slot_index() const noexcept { return fx_slot_index_; }
43 template<
44 typename TException,
45 typename TValue
47 TValue& get_value() const
49 if (property_size_ < static_cast<ALuint>(sizeof(TValue)))
51 throw TException{"Property buffer too small."};
54 return *static_cast<TValue*>(property_buffer_);
57 template<
58 typename TException,
59 typename TValue
61 al::span<TValue> get_values() const
63 if (property_size_ < static_cast<ALuint>(sizeof(TValue)))
65 throw TException{"Property buffer too small."};
68 const auto count = property_size_ / sizeof(TValue);
70 return al::span<TValue>{static_cast<TValue*>(property_buffer_), count};
73 template<
74 typename TException,
75 typename TValue
77 void set_value(
78 const TValue& value) const
80 get_value<TException, TValue>() = value;
84 private:
85 const bool is_get_;
86 const bool is_deferred_;
87 int version_;
88 EaxFxSlotIndex fx_slot_index_;
89 EaxEaxCallPropertySetId property_set_id_;
91 ALuint property_id_;
92 const ALuint property_source_id_;
93 ALvoid*const property_buffer_;
94 const ALuint property_size_;
97 [[noreturn]]
98 static void fail(
99 const char* message);
102 static ALuint convert_eax_v2_0_listener_property_id(
103 ALuint property_id);
105 static ALuint convert_eax_v2_0_buffer_property_id(
106 ALuint property_id);
107 }; // EaxEaxCall
110 EaxEaxCall create_eax_call(
111 bool is_get,
112 const GUID* property_set_id,
113 ALuint property_id,
114 ALuint property_source_id,
115 ALvoid* property_buffer,
116 ALuint property_size);
119 #endif // !EAX_EAX_CALL_INCLUDED