AkAmbientSound.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. /*=============================================================================
  16. AkAmbientSound.h:
  17. =============================================================================*/
  18. #pragma once
  19. #include "GameFramework/Actor.h"
  20. #include "AkAmbientSound.generated.h"
  21. DECLARE_LOG_CATEGORY_EXTERN(LogAkAmbientSound, Log, All);
  22. /*------------------------------------------------------------------------------------
  23. AAkAmbientSound
  24. ------------------------------------------------------------------------------------*/
  25. UCLASS(config=Engine, hidecategories=Audio, AutoExpandCategories=AkAmbientSound, BlueprintType)
  26. class AKAUDIO_API AAkAmbientSound : public AActor
  27. {
  28. GENERATED_BODY()
  29. public:
  30. AAkAmbientSound(const class FObjectInitializer& ObjectInitializer);
  31. /** AkAudioEvent to play. Deprecated as UE4.7 integration: Use AkComponent->AkAudioEvent instead */
  32. UPROPERTY()
  33. class UAkAudioEvent * AkAudioEvent_DEPRECATED = nullptr;
  34. /** AkComponent to handle playback */
  35. UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=AkAmbientSound, meta=(ShowOnlyInnerProperties) )
  36. class UAkComponent* AkComponent = nullptr;
  37. /** Stop playback if the owner is destroyed */
  38. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AkAmbientSound, SimpleDisplay)
  39. bool StopWhenOwnerIsDestroyed = false;
  40. /** Automatically post the associated AkAudioEvent on BeginPlay */
  41. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AkAmbientSound, SimpleDisplay)
  42. bool AutoPost = false;
  43. /*
  44. * Start an Ak ambient sound.
  45. */
  46. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|AkAmbientSound")
  47. void StartAmbientSound();
  48. /*
  49. * Stop an Ak ambient sound.
  50. */
  51. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|AkAmbientSound")
  52. void StopAmbientSound();
  53. #if CPP
  54. public:
  55. /**
  56. * Start the ambience playback
  57. */
  58. void StartPlaying();
  59. /**
  60. * Stop the ambience playback
  61. */
  62. void StopPlaying();
  63. /**
  64. * Is whether this ambient sound currently playing
  65. *
  66. * @return True if ambient sound is currently playing, false if not.
  67. */
  68. bool IsCurrentlyPlaying();
  69. protected:
  70. /*------------------------------------------------------------------------------------
  71. AActor interface.
  72. ------------------------------------------------------------------------------------*/
  73. virtual void BeginPlay() override;
  74. #if WITH_EDITOR
  75. /**
  76. * Check for errors
  77. */
  78. virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
  79. #endif
  80. virtual void PostInitializeComponents() override;
  81. virtual void PostLoad() override;
  82. #endif
  83. private:
  84. /** used to update status of toggleable level placed ambient sounds on clients */
  85. bool CurrentlyPlaying;
  86. FCriticalSection PlayingCriticalSection;
  87. };