WwiseRefExternalSource.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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/WwiseRefExternalSource.h"
  16. #include "Wwise/WwiseProjectDatabaseModule.h"
  17. #include "Wwise/Stats/ProjectDatabase.h"
  18. #include "Wwise/Metadata/WwiseMetadataExternalSource.h"
  19. #include "Wwise/Metadata/WwiseMetadataSoundBank.h"
  20. const TCHAR* const FWwiseRefExternalSource::NAME = TEXT("ExternalSource");
  21. const FWwiseMetadataExternalSource* FWwiseRefExternalSource::GetExternalSource() const
  22. {
  23. const auto* SoundBank = GetSoundBank();
  24. if (UNLIKELY(!SoundBank))
  25. {
  26. return nullptr;
  27. }
  28. const auto& ExternalSources = SoundBank->ExternalSources;
  29. if (ExternalSources.IsValidIndex(ExternalSourceIndex))
  30. {
  31. return &ExternalSources[ExternalSourceIndex];
  32. }
  33. else
  34. {
  35. UE_LOG(LogWwiseProjectDatabase, Error, TEXT("Could not get External Source index #%zu"), ExternalSourceIndex);
  36. return nullptr;
  37. }
  38. }
  39. uint32 FWwiseRefExternalSource::ExternalSourceCookie() const
  40. {
  41. const auto* ExternalSource = GetExternalSource();
  42. if (UNLIKELY(!ExternalSource))
  43. {
  44. return {};
  45. }
  46. return ExternalSource->Cookie;
  47. }
  48. FGuid FWwiseRefExternalSource::ExternalSourceGuid() const
  49. {
  50. const auto* ExternalSource = GetExternalSource();
  51. if (UNLIKELY(!ExternalSource))
  52. {
  53. return {};
  54. }
  55. return ExternalSource->GUID;
  56. }
  57. FName FWwiseRefExternalSource::ExternalSourceName() const
  58. {
  59. const auto* ExternalSource = GetExternalSource();
  60. if (UNLIKELY(!ExternalSource))
  61. {
  62. return {};
  63. }
  64. return ExternalSource->Name;
  65. }
  66. FName FWwiseRefExternalSource::ExternalSourceObjectPath() const
  67. {
  68. const auto* ExternalSource = GetExternalSource();
  69. if (UNLIKELY(!ExternalSource))
  70. {
  71. return {};
  72. }
  73. return ExternalSource->ObjectPath;
  74. }
  75. uint32 FWwiseRefExternalSource::Hash() const
  76. {
  77. auto Result = FWwiseRefSoundBank::Hash();
  78. Result = HashCombine(Result, GetTypeHash(ExternalSourceIndex));
  79. return Result;
  80. }