AkSpatialAudioHelper.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*******************************************************************************
  2. The content of this file includes portions of the proprietary AUDIOKINETIC Wwise
  3. Technology released in source code form as part of the game integration package.
  4. The content of this file may not be used without valid licenses to the
  5. AUDIOKINETIC Wwise Technology.
  6. Note that the use of the game engine is subject to the Unreal(R) Engine End User
  7. License Agreement at https://www.unrealengine.com/en-US/eula/unreal
  8. License Usage
  9. Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use
  10. this file in accordance with the end user license agreement provided with the
  11. software or, alternatively, in accordance with the terms contained
  12. in a written agreement between you and Audiokinetic Inc.
  13. Copyright (c) 2023 Audiokinetic Inc.
  14. *******************************************************************************/
  15. #include "AkSpatialAudioHelper.h"
  16. #include "AkSpatialAudioVolume.h"
  17. #include "AkAcousticPortal.h"
  18. namespace AkSpatialAudioHelper
  19. {
  20. AActor* GetActorFromHitResult(const FHitResult& HitResult)
  21. {
  22. AActor* HitActor = nullptr;
  23. #if UE_5_0_OR_LATER
  24. HitActor = HitResult.HitObjectHandle.FetchActor();
  25. #else
  26. HitActor = HitResult.Actor.Get();
  27. #endif
  28. return HitActor;
  29. }
  30. bool IsAkSpatialAudioActorClass(const AActor* Actor)
  31. {
  32. if (Actor == nullptr)
  33. return false;
  34. return
  35. Actor->GetClass() == AAkSpatialAudioVolume::StaticClass() ||
  36. Actor->GetClass() == AAkAcousticPortal::StaticClass();
  37. }
  38. #if WITH_EDITOR
  39. UEditorEngine::FObjectsReplacedEvent* GetObjectReplacedEvent()
  40. {
  41. #if UE_5_0_OR_LATER
  42. return &FCoreUObjectDelegates::OnObjectsReplaced;
  43. #else
  44. if (GEditor)
  45. {
  46. return &GEditor->OnObjectsReplaced();
  47. }
  48. return nullptr;
  49. #endif
  50. }
  51. #endif
  52. }