7 constexpr auto deferred_flag
= 0x80000000U
;
9 class EaxCallException
: public EaxException
{
11 explicit EaxCallException(const char* message
)
12 : EaxException
{"EAX_CALL", message
}
14 }; // EaxCallException
18 EaxCall::EaxCall(EaxCallType type
, const GUID
&property_set_guid
, ALuint property_id
,
19 ALuint property_source_id
, ALvoid
*property_buffer
, ALuint property_size
)
20 : mCallType
{type
}, mIsDeferred
{(property_id
& deferred_flag
) != 0}
21 , mPropertyId
{property_id
& ~deferred_flag
}, mPropertySourceId
{property_source_id
}
22 , mPropertyBuffer
{property_buffer
}, mPropertyBufferSize
{property_size
}
26 case EaxCallType::get
:
27 case EaxCallType::set
:
31 fail("Invalid type.");
37 else if (property_set_guid
== EAXPROPERTYID_EAX40_Context
)
40 mPropertySetId
= EaxCallPropertySetId::context
;
42 else if (property_set_guid
== EAXPROPERTYID_EAX50_Context
)
45 mPropertySetId
= EaxCallPropertySetId::context
;
47 else if (property_set_guid
== DSPROPSETID_EAX20_ListenerProperties
)
51 mPropertySetId
= EaxCallPropertySetId::fx_slot_effect
;
53 else if (property_set_guid
== DSPROPSETID_EAX30_ListenerProperties
)
57 mPropertySetId
= EaxCallPropertySetId::fx_slot_effect
;
59 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot0
)
63 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
65 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot0
)
69 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
71 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot1
)
75 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
77 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot1
)
81 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
83 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot2
)
87 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
89 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot2
)
93 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
95 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot3
)
99 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
101 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot3
)
105 mPropertySetId
= EaxCallPropertySetId::fx_slot
;
107 else if (property_set_guid
== DSPROPSETID_EAX20_BufferProperties
)
110 mPropertySetId
= EaxCallPropertySetId::source
;
112 else if (property_set_guid
== DSPROPSETID_EAX30_BufferProperties
)
115 mPropertySetId
= EaxCallPropertySetId::source
;
117 else if (property_set_guid
== EAXPROPERTYID_EAX40_Source
)
120 mPropertySetId
= EaxCallPropertySetId::source
;
122 else if (property_set_guid
== EAXPROPERTYID_EAX50_Source
)
125 mPropertySetId
= EaxCallPropertySetId::source
;
127 else if (property_set_guid
== DSPROPSETID_EAX_ReverbProperties
)
131 mPropertySetId
= EaxCallPropertySetId::fx_slot_effect
;
133 else if (property_set_guid
== DSPROPSETID_EAXBUFFER_ReverbProperties
)
136 mPropertySetId
= EaxCallPropertySetId::source
;
140 fail("Unsupported property set id.");
143 if(mPropertySetId
== EaxCallPropertySetId::context
)
147 case EAXCONTEXT_LASTERROR
:
148 case EAXCONTEXT_SPEAKERCONFIG
:
149 case EAXCONTEXT_EAXSESSION
:
150 // EAX allow to set "defer" flag on immediate-only properties.
151 // If we don't clear our flag then "applyAllUpdates" in EAX context won't be called.
156 else if(mPropertySetId
== EaxCallPropertySetId::fx_slot
)
161 case EAXFXSLOT_ALLPARAMETERS
:
162 case EAXFXSLOT_LOADEFFECT
:
163 case EAXFXSLOT_VOLUME
:
165 case EAXFXSLOT_FLAGS
:
166 case EAXFXSLOT_OCCLUSION
:
167 case EAXFXSLOT_OCCLUSIONLFRATIO
:
175 if(mPropertySetId
!= EaxCallPropertySetId::fx_slot
&& mPropertyId
!= 0)
177 if(mPropertyBuffer
== nullptr)
178 fail("Null property buffer.");
180 if(mPropertyBufferSize
== 0)
181 fail("Empty property.");
185 if(mPropertySetId
== EaxCallPropertySetId::source
&& mPropertySourceId
== 0)
186 fail("Null AL source id.");
188 if(mPropertySetId
== EaxCallPropertySetId::fx_slot
)
190 if(mPropertyId
< EAXFXSLOT_NONE
)
191 mPropertySetId
= EaxCallPropertySetId::fx_slot_effect
;
195 [[noreturn
]] void EaxCall::fail(const char* message
)
197 throw EaxCallException
{message
};
200 [[noreturn
]] void EaxCall::fail_too_small()
202 fail("Property buffer too small.");
205 EaxCall
create_eax_call(
207 const GUID
* property_set_id
,
209 ALuint property_source_id
,
210 ALvoid
* property_buffer
,
211 ALuint property_size
)
214 throw EaxCallException
{"Null property set ID."};