3#include <AudioSystemPlugin/AudioSystemPluginDLL.h>
5#include <AudioSystemPlugin/Core/AudioSystemData.h>
7#include <Foundation/Types/Status.h>
8#include <Foundation/Types/VariantType.h>
12#define PL_DECLARE_AUDIOSYSTEM_REQUEST_CALLBACK(name) \
13 using CallbackType = plDelegate<void(const name&)>; \
14 CallbackType m_Callback
18#define PL_DECLARE_AUDIOSYSTEM_REQUEST_TYPE_SIMPLE(name) \
19 bool operator==(const name& rhs) const \
21 return static_cast<plAudioSystemRequest>(*this) == static_cast<plAudioSystemRequest>(rhs); \
23 bool operator!=(const name& rhs) const \
25 return !(*this == rhs); \
27 PL_DECLARE_AUDIOSYSTEM_REQUEST_CALLBACK(name)
31#define PL_DECLARE_AUDIOSYSTEM_REQUEST_TYPE(name, eq_ex) \
32 bool operator==(const name& rhs) const \
34 return static_cast<plAudioSystemRequest>(*this) == static_cast<plAudioSystemRequest>(rhs) && (eq_ex); \
36 bool operator!=(const name& rhs) const \
38 return !(*this == rhs); \
40 PL_DECLARE_AUDIOSYSTEM_REQUEST_CALLBACK(name)
44#define PL_DECLARE_AUDIOSYSTEM_REQUEST_HASH_SIMPLE(name) \
46 struct plHashHelper<name> \
48 PL_ALWAYS_INLINE static plUInt32 Hash(const name& value) \
50 return plHashHelper<plAudioSystemRequest>::Hash(value); \
52 PL_ALWAYS_INLINE static bool \
53 Equal(const name& a, const name& b) \
61#define PL_DECLARE_AUDIOSYSTEM_REQUEST_HASH(name, hash_ex) \
63 struct plHashHelper<name> \
65 PL_ALWAYS_INLINE static plUInt32 Hash(const name& value) \
67 return plHashingUtils::CombineHashValues32(plHashHelper<plAudioSystemRequest>::Hash(value), (hash_ex)); \
69 PL_ALWAYS_INLINE static bool \
70 Equal(const name& a, const name& b) \
78#define PL_DECLARE_AUDIOSYSTEM_REQUEST_STREAM_OPERATORS(name) \
79 PL_AUDIOSYSTEMPLUGIN_DLL void operator<<(plStreamWriter& Stream, const name& Value); \
80 PL_AUDIOSYSTEMPLUGIN_DLL void operator>>(plStreamReader& Stream, name& Value)
84#define PL_DECLARE_AUDIOSYSTEM_REQUEST_SIMPLE(name) \
85 PL_DECLARE_AUDIOSYSTEM_REQUEST_HASH_SIMPLE(name); \
86 PL_DECLARE_AUDIOSYSTEM_REQUEST_STREAM_OPERATORS(name); \
87 PL_DECLARE_REFLECTABLE_TYPE(PL_AUDIOSYSTEMPLUGIN_DLL, name); \
88 PL_DECLARE_CUSTOM_VARIANT_TYPE(name)
92#define PL_DECLARE_AUDIOSYSTEM_REQUEST(name, hash_ex) \
93 PL_DECLARE_AUDIOSYSTEM_REQUEST_HASH(name, hash_ex); \
94 PL_DECLARE_AUDIOSYSTEM_REQUEST_STREAM_OPERATORS(name); \
95 PL_DECLARE_REFLECTABLE_TYPE(PL_AUDIOSYSTEMPLUGIN_DLL, name); \
96 PL_DECLARE_CUSTOM_VARIANT_TYPE(name)
101#define PL_DEFINE_AUDIOSYSTEM_STREAM_OPERATORS_SIMPLE(name) \
102 void operator<<(plStreamWriter& Stream, const name& Value) \
104 Stream << static_cast<const plAudioSystemRequest&>(Value); \
106 void operator>>(plStreamReader& Stream, name& Value) \
108 Stream >> static_cast<plAudioSystemRequest&>(Value); \
129 plAudioSystemDataID m_uiEntityId{0};
132 plAudioSystemDataID m_uiListenerId{0};
135 plAudioSystemDataID m_uiObjectId{0};
147 return !(*
this == rhs);
219 plAudioSystemDataID m_uiEventId{0};
228 plAudioSystemDataID m_uiEventId{0};
237 plAudioSystemDataID m_uiTriggerId{0};
252 float m_fValue{0.0f};
267 float m_fAmount{0.0f};
276 float m_fObstruction{0.0f};
279 float m_fOcclusion{0.0f};
330 template <
typename T>
331 PL_ALWAYS_INLINE
void Call()
const
333 plResult conversionStatus = PL_SUCCESS;
334 const auto& request = m_Value.
ConvertTo<T>(&conversionStatus);
336 if (conversionStatus.Succeeded())
338 request.m_Callback(request);
342 template <
typename T>
343 void operator()()
const
350 Call<plAudioSystemRequestRegisterEntity>();
354 Call<plAudioSystemRequestSetEntityTransform>();
358 Call<plAudioSystemRequestUnregisterEntity>();
362 Call<plAudioSystemRequestRegisterListener>();
366 Call<plAudioSystemRequestSetListenerTransform>();
370 Call<plAudioSystemRequestUnregisterListener>();
374 Call<plAudioSystemRequestLoadTrigger>();
378 Call<plAudioSystemRequestActivateTrigger>();
382 Call<plAudioSystemRequestStopEvent>();
386 Call<plAudioSystemRequestSetRtpcValue>();
390 Call<plAudioSystemRequestSetSwitchState>();
394 Call<plAudioSystemRequestSetEnvironmentAmount>();
398 Call<plAudioSystemRequestSetObstructionOcclusion>();
402 Call<plAudioSystemRequestLoadBank>();
406 Call<plAudioSystemRequestUnloadBank>();
410 Call<plAudioSystemRequestShutdown>();
414 plLog::Error(
"[AudioSystem] Received an Audio Request with an invalid type");
static void Error(plLogInterface *pInterface, const plFormatString &string)
An error that needs to be fixed as soon as possible.
Definition Log.cpp:375
plVariant is a class that can store different types of variables, which is useful in situations where...
Definition Variant.h:44
bool IsValid() const
Returns whether this variant stores any other type than 'Invalid'.
Definition Variant_inl.h:274
T ConvertTo(plResult *out_pConversionStatus=nullptr) const
Tries to convert the stored value to the given type. The optional status parameter can be used to che...
Definition Variant_inl.h:421
bool IsA() const
Returns whether the stored type is exactly the given type.
constexpr plInt32 FloatToInt(float value)
Casts the float to an integer, removes the fractional part.
Definition Math_inl.h:462
A functor used by plVariant to call an audio request callback.
Definition AudioSystemRequests.h:324
Audio request to activate a trigger.
Definition AudioSystemRequests.h:224
Base class for all audio system requests.
Definition AudioSystemRequests.h:127
plStatus m_eStatus
The status of the audio request.
Definition AudioSystemRequests.h:138
plAudioSystemDataID m_uiListenerId
The audio listener which is being manipulated, if any.
Definition AudioSystemRequests.h:132
plAudioSystemDataID m_uiObjectId
The audio object (trigger, rtpc, environment, etc.) which is being manipulated, if any.
Definition AudioSystemRequests.h:135
plAudioSystemDataID m_uiEntityId
The audio entity which is being manipulated, if any.
Definition AudioSystemRequests.h:129
Audio request to load a sound bank.
Definition AudioSystemRequests.h:284
Audio request to load data needed to activate a trigger.
Definition AudioSystemRequests.h:215
Audio request to register a new entity in the audio system.
Definition AudioSystemRequests.h:167
plString m_sName
A friendly name for the entity. Not very used by most of the audio engines for other purposes than de...
Definition AudioSystemRequests.h:172
Audio request to register a new listener in the audio system.
Definition AudioSystemRequests.h:191
plString m_sName
A friendly name for the listener. Not very used by most of the audio engines for other purposes than ...
Definition AudioSystemRequests.h:196
Audio request to set the current amount of an environment on the specified entity.
Definition AudioSystemRequests.h:263
Audio request to set the current amount of an environment on the specified entity.
Definition AudioSystemRequests.h:272
Audio request to set the value of a real-time parameter.
Definition AudioSystemRequests.h:248
Audio request to set the active state of a switch.
Definition AudioSystemRequests.h:257
Audio request to shutdown the audio system. Used internally only. Sending this request at runtime wil...
Definition AudioSystemRequests.h:297
Audio request to stop an event.
Definition AudioSystemRequests.h:233
Audio request to unload a sound bank.
Definition AudioSystemRequests.h:290
Audio request to unload data loaded by a trigger.
Definition AudioSystemRequests.h:242
Audio request to unregister an entity from the audio system.
Definition AudioSystemRequests.h:185
Audio request to unregister a listener from the audio system.
Definition AudioSystemRequests.h:209
Helper struct to calculate the Hash of different types.
Definition HashingUtils.h:75
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
An plResult with an additional message for the reason of failure.
Definition Status.h:12