MovieSceneAkAudioEventTrack.cpp 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 "MovieSceneAkAudioEventTrack.h"
  16. #include "AkAudioDevice.h"
  17. #include "IMovieScenePlayer.h"
  18. #include "MovieScene.h"
  19. #include "MovieSceneAkAudioEventSection.h"
  20. #include "MovieSceneAkAudioEventTemplate.h"
  21. FMovieSceneEvalTemplatePtr UMovieSceneAkAudioEventTrack::CreateTemplateForSection(const UMovieSceneSection& InSection) const
  22. {
  23. #if UE_4_26_OR_LATER
  24. return FMovieSceneAkAudioEventTemplate(CastChecked<UMovieSceneAkAudioEventSection>(&InSection));
  25. #else
  26. return InSection.GenerateTemplate();
  27. #endif
  28. }
  29. UMovieSceneSection* UMovieSceneAkAudioEventTrack::CreateNewSection()
  30. {
  31. return NewObject<UMovieSceneSection>(this, UMovieSceneAkAudioEventSection::StaticClass(), NAME_None, RF_Transactional);
  32. }
  33. #if WITH_EDITOR
  34. bool UMovieSceneAkAudioEventTrack::AddNewEvent(FFrameNumber Time, UAkAudioEvent* Event, const FString& EventName)
  35. {
  36. UMovieSceneAkAudioEventSection* NewSection = NewObject<UMovieSceneAkAudioEventSection>(this);
  37. ensure(NewSection);
  38. bool eventSet = NewSection->SetEvent(Event, EventName);
  39. if (eventSet)
  40. {
  41. const auto Duration = NewSection->GetMaxEventDuration();
  42. NewSection->InitialPlacement(GetAllSections(), Time, Duration, SupportsMultipleRows());
  43. AddSection(*NewSection);
  44. }
  45. return true;
  46. }
  47. void UMovieSceneAkAudioEventTrack::WorkUnitChangesDetectedFromSection(UMovieSceneAkAudioEventSection* in_pSection)
  48. {
  49. for (auto Section : Sections)
  50. {
  51. if (UMovieSceneAkAudioEventSection* AkSection = Cast<UMovieSceneAkAudioEventSection>(Section))
  52. {
  53. if (AkSection != in_pSection)
  54. {
  55. AkSection->CheckForWorkunitChanges();
  56. }
  57. }
  58. }
  59. }
  60. #endif
  61. #if WITH_EDITORONLY_DATA
  62. FText UMovieSceneAkAudioEventTrack::GetDisplayName() const
  63. {
  64. return NSLOCTEXT("MovieSceneAkAudioEventTrack", "TrackName", "AkAudioEvents");
  65. }
  66. #endif
  67. FName UMovieSceneAkAudioEventTrack::GetTrackName() const
  68. {
  69. static FName TrackName("AkAudioEvents");
  70. return TrackName;
  71. }
  72. bool UMovieSceneAkAudioEventTrack::SupportsType(TSubclassOf<UMovieSceneSection> SectionClass) const
  73. {
  74. return SectionClass == UMovieSceneAkAudioEventSection::StaticClass();
  75. }