123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- #pragma once
- #include "AkReverbDescriptor.h"
- #include "GameFramework/Volume.h"
- #include "AkGameObject.h"
- #include "AkRoomComponent.generated.h"
- class UAkLateReverbComponent;
- UCLASS(ClassGroup = Audiokinetic, BlueprintType, hidecategories = (Transform, Rendering, Mobility, LOD, Component, Activation, Tags), meta = (BlueprintSpawnableComponent))
- class AKAUDIO_API UAkRoomComponent : public UAkGameObject
- {
- GENERATED_BODY()
- public:
- UAkRoomComponent(const class FObjectInitializer& ObjectInitializer);
-
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Toggle, meta = (DisplayName = "Enable Room"))
- bool bEnable = false;
-
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Toggle, meta = (DisplayName = "Room Is Dynamic"))
- bool bDynamic = false;
-
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Room")
- float Priority = .0f;
-
- UPROPERTY(EditAnywhere, BlueprintReadWrite, DisplayName = "Transmission Loss", Category = "Room", meta = (ClampMin=0.0f, ClampMax=1.0f, UIMin=0.0f, UIMax=1.0f))
- float WallOcclusion = .0f;
-
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AkEvent", meta = (ClampMin = "0.0", ClampMax = "1.0"))
- float AuxSendLevel = .0f;
-
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AkEvent", SimpleDisplay)
- bool AutoPost = false;
-
- virtual int32 PostAssociatedAkEvent(
- UPARAM(meta = (Bitmask, BitmaskEnum = "/Script/AkAudio.EAkCallbackType")) int32 CallbackMask,
- const FOnAkPostEventCallback& PostEventCallback
- );
- UFUNCTION(BlueprintCallable, Category = "Audiokinetic|AkRoomComponent")
- UPrimitiveComponent* GetPrimitiveParent() const;
-
- void AddSpatialAudioRoom();
-
- void UpdateSpatialAudioRoom();
-
- void RemoveSpatialAudioRoom();
- bool HasEffectOnLocation(const FVector& Location) const;
- bool RoomIsActive() const;
- AkRoomID GetRoomID() const { return AkRoomID(this); }
- virtual void OnRegister() override;
- virtual void OnUnregister() override;
- #if WITH_EDITOR
- virtual void BeginDestroy() override;
- virtual void OnComponentCreated() override;
- virtual void InitializeComponent() override;
- virtual void PostLoad() override;
- virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
- #endif
- virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) override;
- virtual void OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport) override;
- virtual bool MoveComponentImpl(
- const FVector & Delta,
- const FQuat & NewRotation,
- bool bSweep,
- FHitResult * Hit,
- EMoveComponentFlags MoveFlags,
- ETeleportType Teleport) override;
- FName GetName() const;
- virtual AkPlayingID PostAkEventByNameWithDelegate(
- UAkAudioEvent* AkEvent,
- const FString& in_EventName,
- int32 CallbackMask, const FOnAkPostEventCallback& PostEventCallback);
-
- virtual void BeginPlay() override;
- virtual void EndPlay(EEndPlayReason::Type EndPlayReason) override;
- #if WITH_EDITOR
- virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
- #endif
-
- UFUNCTION(BlueprintCallable, Category = "Audiokinetic|AkRoomComponent")
- void SetGeometryComponent(UAkAcousticTextureSetComponent* textureSetComponent);
- FString GetRoomName();
- UAkLateReverbComponent* GetReverbComponent();
- private:
- class UPrimitiveComponent* Parent;
- UPROPERTY(Transient)
- class UAkAcousticTextureSetComponent* GeometryComponent = nullptr;
- void InitializeParent();
- void GetRoomParams(AkRoomParams& outParams);
- bool EncompassesPoint(FVector Point, float SphereRadius = 0.f, float* OutDistanceToPoint = nullptr) const;
- void BeginPlayInternal();
- void SendGeometry();
- void RemoveGeometry();
- float SecondsSinceMovement = 0.0f;
- bool Moving = false;
- #if WITH_EDITOR
- void HandleObjectsReplaced(const TMap<UObject*, UObject*>& ReplacementMap);
- bool bRequiresDeferredBeginPlay = false;
- class UDrawRoomComponent* DrawRoomComponent = nullptr;
- void RegisterVisEnabledCallback();
- void InitializeDrawComponent();
- void DestroyDrawComponent();
- FDelegateHandle ShowRoomsChangedHandle;
- #endif
- };
|