WwiseRefTrigger.cpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 "Wwise/Ref/WwiseRefTrigger.h"
  16. #include "Wwise/Metadata/WwiseMetadataSoundBank.h"
  17. #include "Wwise/WwiseProjectDatabaseModule.h"
  18. #include "Wwise/Stats/FileHandler.h"
  19. #include "Wwise/Metadata/WwiseMetadataTrigger.h"
  20. #include "Wwise/Stats/ProjectDatabase.h"
  21. const TCHAR* const FWwiseRefTrigger::NAME = TEXT("Trigger");
  22. const FWwiseMetadataTrigger* FWwiseRefTrigger::GetTrigger() const
  23. {
  24. const auto* SoundBank = GetSoundBank();
  25. if (UNLIKELY(!SoundBank))
  26. {
  27. return nullptr;
  28. }
  29. const auto& Triggers = SoundBank->Triggers;
  30. if (Triggers.IsValidIndex(TriggerIndex))
  31. {
  32. return &Triggers[TriggerIndex];
  33. }
  34. else
  35. {
  36. UE_LOG(LogWwiseProjectDatabase, Error, TEXT("Could not get Trigger index #%zu"), TriggerIndex);
  37. return nullptr;
  38. }
  39. }
  40. uint32 FWwiseRefTrigger::TriggerId() const
  41. {
  42. const auto* Trigger = GetTrigger();
  43. if (UNLIKELY(!Trigger))
  44. {
  45. return 0;
  46. }
  47. return Trigger->Id;
  48. }
  49. FGuid FWwiseRefTrigger::TriggerGuid() const
  50. {
  51. const auto* Trigger = GetTrigger();
  52. if (UNLIKELY(!Trigger))
  53. {
  54. return {};
  55. }
  56. return Trigger->GUID;
  57. }
  58. FName FWwiseRefTrigger::TriggerName() const
  59. {
  60. const auto* Trigger = GetTrigger();
  61. if (UNLIKELY(!Trigger))
  62. {
  63. return {};
  64. }
  65. return Trigger->Name;
  66. }
  67. FName FWwiseRefTrigger::TriggerObjectPath() const
  68. {
  69. const auto* Trigger = GetTrigger();
  70. if (UNLIKELY(!Trigger))
  71. {
  72. return {};
  73. }
  74. return Trigger->ObjectPath;
  75. }
  76. uint32 FWwiseRefTrigger::Hash() const
  77. {
  78. auto Result = FWwiseRefSoundBank::Hash();
  79. Result = HashCombine(Result, GetTypeHash(TriggerIndex));
  80. return Result;
  81. }