3#include <Core/Messages/EventMessage.h>
4#include <Core/ResourceManager/Resource.h>
5#include <FmodPlugin/Components/FmodComponent.h>
10 PL_ALWAYS_INLINE
void Invalidate() { m_uiValue = -1; }
11 PL_ALWAYS_INLINE
bool IsInvalidated()
const {
return m_uiValue == -1; }
14 plUInt64 m_uiValue = -1;
35 plUInt32 m_uiRaycastHits = 0;
36 plUInt8 m_uiNextRayIndex = 0;
37 plUInt8 m_uiNumUsedRays = 0;
38 float m_fRadius = 0.0f;
39 float m_fLastOcclusionValue = -1.0f;
41 float GetOcclusionValue(
float fThreshold)
const {
return plMath::Clamp((m_fLastOcclusionValue - fThreshold) /
plMath::Max(1.0f - fThreshold, 0.0001f), 0.0f, 1.0f); }
47 void RemoveOcclusionState(plUInt32 uiIndex);
48 const OcclusionState& GetOcclusionState(plUInt32 uiIndex)
const {
return m_OcclusionStates[uiIndex]; }
50 void ShootOcclusionRays(
84 virtual void SerializeComponent(
plWorldWriter& inout_stream)
const override;
85 virtual void DeserializeComponent(
plWorldReader& inout_stream)
override;
88 virtual void OnSimulationStarted()
override;
89 virtual void OnDeactivated()
override;
96 virtual void plFmodComponentIsAbstract()
override {}
107 void SetPaused(bool b);
108 bool GetPaused() const {
return m_bPaused; }
110 void SetUseOcclusion(
bool b);
111 bool GetUseOcclusion()
const {
return m_bUseOcclusion; }
113 void SetOcclusionCollisionLayer(plUInt8 uiCollisionLayer);
114 plUInt8 GetOcclusionCollisionLayer()
const {
return m_uiOcclusionCollisionLayer; }
116 void SetOcclusionThreshold(
float fThreshold);
117 float GetOcclusionThreshold()
const;
119 void SetPitch(
float f);
120 float GetPitch()
const {
return m_fPitch; }
122 void SetVolume(
float f);
123 float GetVolume()
const {
return m_fVolume; }
125 void SetSoundEventFile(
const char* szFile);
126 const char* GetSoundEventFile()
const;
133 void SetShowDebugInfo(
bool bShow);
134 bool GetShowDebugInfo()
const;
149 void StopSound(
bool bImmediate);
164 void SetEventParameter(
const char* szParamName,
float fValue);
175 void UpdateParameters(FMOD::Studio::EventInstance* pInstance);
176 void UpdateOcclusion();
179 void InvalidateResource(
bool bTryToRestore);
183 bool m_bUseOcclusion;
184 plUInt8 m_uiOcclusionThreshold;
185 plUInt8 m_uiOcclusionCollisionLayer;
188 plInt32 m_iTimelinePosition = -1;
189 plUInt32 m_uiOcclusionStateIndex = plInvalidIndex;
192 FMOD::Studio::EventDescription* m_pEventDesc;
193 FMOD::Studio::EventInstance* m_pEventInstance;
Definition ComponentManager.h:88
Simple component manager implementation that calls an update method on all components every frame.
Definition ComponentManager.h:142
Definition DynamicArray.h:81
A message sender that sends all messages to the next component derived from plEventMessageHandlerComp...
Definition EventMessage.h:39
Base class for all Fmod components, such that they all have a common ancestor.
Definition FmodComponent.h:9
Represents a sound (called an 'event') in the Fmod sound system.
Definition FmodEventComponent.h:77
Definition FmodEventComponent.h:21
virtual void Deinitialize() override
This method is called before the destructor. A derived type can override this method to do deinitiali...
Definition FmodEventComponent.cpp:95
virtual void Initialize() override
This method is called after the constructor. A derived type can override this method to do initializa...
Definition FmodEventComponent.cpp:72
Definition PhysicsWorldModule.h:109
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
constexpr PL_ALWAYS_INLINE T Clamp(T value, T min_val, T max_val)
Clamps "value" to the range [min; max]. Returns "value", if it is inside the range already.
Definition Math_inl.h:51
constexpr PL_ALWAYS_INLINE T Max(T f1, T f2)
Returns the greater value, f1 or f2.
Definition Math_inl.h:39
Definition ComponentManager.h:131
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Base class for all messages that are sent as 'events'.
Definition EventMessage.h:8
Definition FmodEventComponent.h:8
Definition DeleteObjectMessage.h:7
Sent when a plFmodEventComponent finishes playing a sound. Not sent for one-shot sound events.
Definition FmodEventComponent.h:66
Basic message to set some generic parameter to a float value.
Definition CommonMessages.h:17
These events may be sent by a specific plResource or by the plResourceManager.
Definition Declarations.h:22
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
Definition WorldModule.h:33