3 #include "al/eax_eax_call.h"
5 #include "al/eax_exception.h"
10 constexpr auto deferred_flag
= 0x80000000U
;
12 class EaxEaxCallException
:
16 explicit EaxEaxCallException(
19 EaxException
{"EAX_EAX_CALL", message
}
22 }; // EaxEaxCallException
27 EaxEaxCall::EaxEaxCall(
29 const GUID
& property_set_guid
,
31 ALuint property_source_id
,
32 ALvoid
* property_buffer
,
34 : is_get_
{is_get
}, version_
{0}, property_set_id_
{EaxEaxCallPropertySetId::none
}
35 , property_id_
{property_id
& ~deferred_flag
}, property_source_id_
{property_source_id
}
36 , property_buffer_
{property_buffer
}, property_size_
{property_size
}
41 else if (property_set_guid
== EAXPROPERTYID_EAX40_Context
)
44 property_set_id_
= EaxEaxCallPropertySetId::context
;
46 else if (property_set_guid
== EAXPROPERTYID_EAX50_Context
)
49 property_set_id_
= EaxEaxCallPropertySetId::context
;
51 else if (property_set_guid
== DSPROPSETID_EAX20_ListenerProperties
)
55 property_set_id_
= EaxEaxCallPropertySetId::fx_slot_effect
;
56 property_id_
= convert_eax_v2_0_listener_property_id(property_id_
);
58 else if (property_set_guid
== DSPROPSETID_EAX30_ListenerProperties
)
62 property_set_id_
= EaxEaxCallPropertySetId::fx_slot_effect
;
64 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot0
)
68 property_set_id_
= EaxEaxCallPropertySetId::fx_slot
;
70 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot0
)
74 property_set_id_
= EaxEaxCallPropertySetId::fx_slot
;
76 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot1
)
80 property_set_id_
= EaxEaxCallPropertySetId::fx_slot
;
82 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot1
)
86 property_set_id_
= EaxEaxCallPropertySetId::fx_slot
;
88 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot2
)
92 property_set_id_
= EaxEaxCallPropertySetId::fx_slot
;
94 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot2
)
98 property_set_id_
= EaxEaxCallPropertySetId::fx_slot
;
100 else if (property_set_guid
== EAXPROPERTYID_EAX40_FXSlot3
)
104 property_set_id_
= EaxEaxCallPropertySetId::fx_slot
;
106 else if (property_set_guid
== EAXPROPERTYID_EAX50_FXSlot3
)
110 property_set_id_
= EaxEaxCallPropertySetId::fx_slot
;
112 else if (property_set_guid
== DSPROPSETID_EAX20_BufferProperties
)
115 property_set_id_
= EaxEaxCallPropertySetId::source
;
116 property_id_
= convert_eax_v2_0_buffer_property_id(property_id_
);
118 else if (property_set_guid
== DSPROPSETID_EAX30_BufferProperties
)
121 property_set_id_
= EaxEaxCallPropertySetId::source
;
123 else if (property_set_guid
== EAXPROPERTYID_EAX40_Source
)
126 property_set_id_
= EaxEaxCallPropertySetId::source
;
128 else if (property_set_guid
== EAXPROPERTYID_EAX50_Source
)
131 property_set_id_
= EaxEaxCallPropertySetId::source
;
133 else if (property_set_guid
== DSPROPSETID_EAX_ReverbProperties
)
137 property_set_id_
= EaxEaxCallPropertySetId::fx_slot_effect
;
139 else if (property_set_guid
== DSPROPSETID_EAXBUFFER_ReverbProperties
)
142 property_set_id_
= EaxEaxCallPropertySetId::source
;
146 fail("Unsupported property set id.");
149 if (version_
< 1 || version_
> 5)
151 fail("EAX version out of range.");
154 if(!(property_id
&deferred_flag
))
156 if(property_set_id_
!= EaxEaxCallPropertySetId::fx_slot
&& property_id_
!= 0)
158 if (!property_buffer
)
160 fail("Null property buffer.");
163 if (property_size
== 0)
165 fail("Empty property.");
170 if(property_set_id_
== EaxEaxCallPropertySetId::source
&& property_source_id_
== 0)
172 fail("Null AL source id.");
175 if (property_set_id_
== EaxEaxCallPropertySetId::fx_slot
)
177 if (property_id_
< EAXFXSLOT_NONE
)
179 property_set_id_
= EaxEaxCallPropertySetId::fx_slot_effect
;
185 void EaxEaxCall::fail(
188 throw EaxEaxCallException
{message
};
191 ALuint
EaxEaxCall::convert_eax_v2_0_listener_property_id(
196 case DSPROPERTY_EAX20LISTENER_NONE
:
197 return EAXREVERB_NONE
;
199 case DSPROPERTY_EAX20LISTENER_ALLPARAMETERS
:
200 return EAXREVERB_ALLPARAMETERS
;
202 case DSPROPERTY_EAX20LISTENER_ROOM
:
203 return EAXREVERB_ROOM
;
205 case DSPROPERTY_EAX20LISTENER_ROOMHF
:
206 return EAXREVERB_ROOMHF
;
208 case DSPROPERTY_EAX20LISTENER_ROOMROLLOFFFACTOR
:
209 return EAXREVERB_ROOMROLLOFFFACTOR
;
211 case DSPROPERTY_EAX20LISTENER_DECAYTIME
:
212 return EAXREVERB_DECAYTIME
;
214 case DSPROPERTY_EAX20LISTENER_DECAYHFRATIO
:
215 return EAXREVERB_DECAYHFRATIO
;
217 case DSPROPERTY_EAX20LISTENER_REFLECTIONS
:
218 return EAXREVERB_REFLECTIONS
;
220 case DSPROPERTY_EAX20LISTENER_REFLECTIONSDELAY
:
221 return EAXREVERB_REFLECTIONSDELAY
;
223 case DSPROPERTY_EAX20LISTENER_REVERB
:
224 return EAXREVERB_REVERB
;
226 case DSPROPERTY_EAX20LISTENER_REVERBDELAY
:
227 return EAXREVERB_REVERBDELAY
;
229 case DSPROPERTY_EAX20LISTENER_ENVIRONMENT
:
230 return EAXREVERB_ENVIRONMENT
;
232 case DSPROPERTY_EAX20LISTENER_ENVIRONMENTSIZE
:
233 return EAXREVERB_ENVIRONMENTSIZE
;
235 case DSPROPERTY_EAX20LISTENER_ENVIRONMENTDIFFUSION
:
236 return EAXREVERB_ENVIRONMENTDIFFUSION
;
238 case DSPROPERTY_EAX20LISTENER_AIRABSORPTIONHF
:
239 return EAXREVERB_AIRABSORPTIONHF
;
241 case DSPROPERTY_EAX20LISTENER_FLAGS
:
242 return EAXREVERB_FLAGS
;
245 fail("Unsupported EAX 2.0 listener property id.");
249 ALuint
EaxEaxCall::convert_eax_v2_0_buffer_property_id(
254 case DSPROPERTY_EAX20BUFFER_NONE
:
255 return EAXSOURCE_NONE
;
257 case DSPROPERTY_EAX20BUFFER_ALLPARAMETERS
:
258 return EAXSOURCE_ALLPARAMETERS
;
260 case DSPROPERTY_EAX20BUFFER_DIRECT
:
261 return EAXSOURCE_DIRECT
;
263 case DSPROPERTY_EAX20BUFFER_DIRECTHF
:
264 return EAXSOURCE_DIRECTHF
;
266 case DSPROPERTY_EAX20BUFFER_ROOM
:
267 return EAXSOURCE_ROOM
;
269 case DSPROPERTY_EAX20BUFFER_ROOMHF
:
270 return EAXSOURCE_ROOMHF
;
272 case DSPROPERTY_EAX20BUFFER_ROOMROLLOFFFACTOR
:
273 return EAXSOURCE_ROOMROLLOFFFACTOR
;
275 case DSPROPERTY_EAX20BUFFER_OBSTRUCTION
:
276 return EAXSOURCE_OBSTRUCTION
;
278 case DSPROPERTY_EAX20BUFFER_OBSTRUCTIONLFRATIO
:
279 return EAXSOURCE_OBSTRUCTIONLFRATIO
;
281 case DSPROPERTY_EAX20BUFFER_OCCLUSION
:
282 return EAXSOURCE_OCCLUSION
;
284 case DSPROPERTY_EAX20BUFFER_OCCLUSIONLFRATIO
:
285 return EAXSOURCE_OCCLUSIONLFRATIO
;
287 case DSPROPERTY_EAX20BUFFER_OCCLUSIONROOMRATIO
:
288 return EAXSOURCE_OCCLUSIONROOMRATIO
;
290 case DSPROPERTY_EAX20BUFFER_OUTSIDEVOLUMEHF
:
291 return EAXSOURCE_OUTSIDEVOLUMEHF
;
293 case DSPROPERTY_EAX20BUFFER_AIRABSORPTIONFACTOR
:
294 return EAXSOURCE_AIRABSORPTIONFACTOR
;
296 case DSPROPERTY_EAX20BUFFER_FLAGS
:
297 return EAXSOURCE_FLAGS
;
300 fail("Unsupported EAX 2.0 buffer property id.");
305 EaxEaxCall
create_eax_call(
307 const GUID
* property_set_id
,
309 ALuint property_source_id
,
310 ALvoid
* property_buffer
,
311 ALuint property_size
)
314 throw EaxEaxCallException
{"Null property set ID."};