ALimenFMODAudioVolume
Overview
ALimenFMODAudioVolume is an actor that controls audio volume based on the presence of actors within its bounds. It uses a box component to define the spatial area and manages FMOD events to play or stop audio based on overlap with other ALimenFMODAudioVolume instances.
Properties
Type | Name | Access | Description |
|---|---|---|---|
TObjectPtr | VolumeBounds | EditAnywhere, BlueprintReadOnly | The box component defining the spatial bounds for volume control. |
TArray<TSubclassOf > | ActorsAllowedToTrigger | EditAnywhere, BlueprintReadOnly | A list of actor classes that are allowed to trigger this audio volume. |
TObjectPtr | AudioEvent | EditAnywhere, BlueprintReadOnly | The FMOD event to play when the bounds overlap with an allowed actor. |
int32 | Priority | EditAnywhere, BlueprintReadOnly, ClampMin="0" | The priority of this audio volume instance. Higher priority volumes will stop lower priority ones from playing. |
Functions
Return Type | Signature | Description |
|---|---|---|
void | BeginPlay() | Initializes the component and sets up overlap events. |
void | EndPlay(const EEndPlayReason::Type EndPlayReason) | Cleans up overlap events and stops any playing FMOD event. |
void | BoundsBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) | Handles the start of overlap with another actor. Starts playing the FMOD event if conditions are met and stops overlapping volumes. |
void | BoundsEndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex) | Handles the end of overlap with another actor. Stops playing the FMOD event if conditions are met and starts the highest priority overlapping volume. |
bool | CanActorTriggerThis(const AActor* Test) const | Determines if a given actor can trigger this audio volume based on allowed actors list. |
void | StartPlayingEvent() | Starts playing the configured FMOD event. |
void | StopPlayingEvent() | Stops playing the currently playing FMOD event. |
Usage & Implementation Notes
Threading Constraints: This class does not involve any multi-threading.
Replication Requirements: None.
Memory Lifetime Management: The
VolumeBoundsandAudioEventproperties are managed by Unreal Engine's garbage collection system. TheIntersectingVolumesarray uses weak pointers to avoid memory leaks.Initialization Dependencies: This class depends on the presence of a valid FMOD event in the editor and a box component for spatial bounds.