WwiseAudioLinkComponent.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #pragma once
  16. #include "Wwise/AudioLink/WwiseAudioLinkSettings.h"
  17. #include "AkComponent.h"
  18. #include "IAudioLink.h"
  19. #include "IAudioLinkBlueprintInterface.h"
  20. class UAudioComponent;
  21. #include "WwiseAudioLinkComponent.generated.h"
  22. UCLASS(ClassGroup = (Audio, Common), HideCategories = (Object, ActorComponent, Physics, Rendering, Mobility, LOD), ShowCategories = Trigger, meta = (BlueprintSpawnableComponent))
  23. class UWwiseAudioLinkComponent : public UAkComponent, public IAudioLinkBlueprintInterface
  24. {
  25. GENERATED_BODY()
  26. public:
  27. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AudioLink")
  28. TObjectPtr<UWwiseAudioLinkSettings> Settings;
  29. /** The sound to be played */
  30. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Sound)
  31. TObjectPtr<class USoundBase> Sound;
  32. /** Whether or not to play the Link on start*/
  33. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AudioLink")
  34. bool bAutoPlay = false;
  35. protected:
  36. //~ Begin IAudioLinkInterface
  37. virtual void SetLinkSound(USoundBase* NewSound) override;
  38. virtual void PlayLink(float StartTime = 0.0f) override;
  39. virtual void StopLink() override;
  40. virtual bool IsLinkPlaying() const override;
  41. //~ End IAudioLinkInterface
  42. //~ Begin ActorComponent Interface.
  43. virtual void OnRegister() override;
  44. virtual void OnUnregister() override;
  45. //~ End ActorComponent Interface.
  46. /** Stop sound when owner is destroyed */
  47. void CreateAudioComponent();
  48. UPROPERTY(Transient)
  49. TObjectPtr<UAudioComponent> AudioComponent;
  50. void CreateLink();
  51. TUniquePtr<IAudioLink> LinkInstance;
  52. };