7 constexpr auto deferred_flag
= 0x80000000U
;
9 class EaxCallException
: public EaxException
{
11 explicit EaxCallException(const char* message
)
12 : EaxException
{"EAX_CALL", message
}
14 }; // EaxCallException
20 const GUID
& property_set_guid
,
22 ALuint property_source_id
,
23 ALvoid
* property_buffer
,
25 : mCallType
{type
}, mVersion
{0}, mPropertySetId
{EaxCallPropertySetId::none
}
26 , mIsDeferred
{(property_id
& deferred_flag
) != 0}
27 , mPropertyId
{property_id
& ~deferred_flag
}, mPropertySourceId
{property_source_id
}
28 , mPropertyBuffer
{property_buffer
}, mPropertyBufferSize
{property_size
}
32 case EaxCallType::get
:
33 case EaxCallType::set
:
37 fail("Invalid type.");
43 else if (property_set_guid
== EAXPROPERTYID_EAX40_Context
)
46 mPropertySetId
= EaxCallPropertySetId::context
;
48 else if (property_set_guid
== EAXPROPERTYID_EAX50_Context
)
51 mPropertySetId
= EaxCallPropertySetId::context
;
53 else if (property_set_guid
== DSPROPSETID_EAX20_ListenerProperties
)
57 mPropertySetId
= EaxCallPropertySetId::fx_slot_effect
;
59 else if (property_set_guid
== DSPROPSETID_EAX30_ListenerProperties
)
63 mPropertySetId
= EaxCallPropertySetId::fx_slot_effect
;
65 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot0
)
69 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
71 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot0
)
75 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
77 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot1
)
81 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
83 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot1
)
87 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
89 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot2
)
93 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
95 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot2
)
99 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
101 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot3
)
105 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
107 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot3
)
111 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
113 else if (property_set_guid
== DSPROPSETID_EAX20_BufferProperties
)
116 mPropertySetId
= EaxCallPropertySetId::source
;
118 else if (property_set_guid
== DSPROPSETID_EAX30_BufferProperties
)
121 mPropertySetId
= EaxCallPropertySetId::source
;
123 else if (property_set_guid
== EAXPROPERTYID_EAX40_Source
)
126 mPropertySetId
= EaxCallPropertySetId::source
;
128 else if (property_set_guid
== EAXPROPERTYID_EAX50_Source
)
131 mPropertySetId
= EaxCallPropertySetId::source
;
133 else if (property_set_guid
== DSPROPSETID_EAX_ReverbProperties
)
137 mPropertySetId
= EaxCallPropertySetId::fx_slot_effect
;
139 else if (property_set_guid
== DSPROPSETID_EAXBUFFER_ReverbProperties
)
142 mPropertySetId
= EaxCallPropertySetId::source
;
146 fail("Unsupported property set id.");
151 case EAXCONTEXT_LASTERROR
:
152 case EAXCONTEXT_SPEAKERCONFIG
:
153 case EAXCONTEXT_EAXSESSION
:
155 case EAXFXSLOT_ALLPARAMETERS
:
156 case EAXFXSLOT_LOADEFFECT
:
157 case EAXFXSLOT_VOLUME
:
159 case EAXFXSLOT_FLAGS
:
160 case EAXFXSLOT_OCCLUSION
:
161 case EAXFXSLOT_OCCLUSIONLFRATIO
:
162 // EAX allow to set "defer" flag on immediate-only properties.
163 // If we don't clear our flag then "applyAllUpdates" in EAX context won't be called.
170 if(mPropertySetId
!= EaxCallPropertySetId::fx_slot
&& mPropertyId
!= 0)
172 if(mPropertyBuffer
== nullptr)
173 fail("Null property buffer.");
175 if(mPropertyBufferSize
== 0)
176 fail("Empty property.");
180 if(mPropertySetId
== EaxCallPropertySetId::source
&& mPropertySourceId
== 0)
181 fail("Null AL source id.");
183 if(mPropertySetId
== EaxCallPropertySetId::fx_slot
)
185 if(mPropertyId
< EAXFXSLOT_NONE
)
186 mPropertySetId
= EaxCallPropertySetId::fx_slot_effect
;
190 [[noreturn
]] void EaxCall::fail(const char* message
)
192 throw EaxCallException
{message
};
195 [[noreturn
]] void EaxCall::fail_too_small()
197 fail("Property buffer too small.");
200 EaxCall
create_eax_call(
202 const GUID
* property_set_id
,
204 ALuint property_source_id
,
205 ALvoid
* property_buffer
,
206 ALuint property_size
)
209 throw EaxCallException
{"Null property set ID."};