AkAmbientSound.h 3.6 KB

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