WwiseUnrealHelper.h 2.8 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. #pragma once
  16. #include "Containers/Map.h"
  17. #include "HAL/UnrealMemory.h"
  18. #include "Serialization/MemoryLayout.h"
  19. namespace WwiseUnrealHelper
  20. {
  21. WWISEUTILS_API void SetHelperFunctions(
  22. FString(*GetWwisePluginDirectoryImpl)(),
  23. FString(*GetWwiseProjectPathImpl)(),
  24. FString(*GetSoundBankDirectoryImpl)(),
  25. FString(*GetStagePathImpl)()
  26. );
  27. WWISEUTILS_API FString GetWwisePluginDirectory();
  28. WWISEUTILS_API FString GetWwiseProjectPath();
  29. WWISEUTILS_API FString GetSoundBankDirectory();
  30. WWISEUTILS_API void TrimPath(FString& Path);
  31. WWISEUTILS_API FString GetProjectDirectory();
  32. WWISEUTILS_API FString GetThirdPartyDirectory();
  33. WWISEUTILS_API FString GetContentDirectory();
  34. WWISEUTILS_API FString GetExternalSourceDirectory();
  35. WWISEUTILS_API FString GetWwiseProjectDirectoryPath();
  36. WWISEUTILS_API FString GetWwiseSoundBankInfoCachePath();
  37. WWISEUTILS_API FString FormatFolderPath(FString folderPath);
  38. WWISEUTILS_API bool MakePathRelativeToWwiseProject(FString& AbsolutePath);
  39. extern WWISEUTILS_API const TCHAR* MediaFolderName;
  40. extern WWISEUTILS_API const FGuid InitBankID;
  41. #if WITH_EDITOR
  42. WWISEUTILS_API FString GuidToBankName(const FGuid& Guid);
  43. WWISEUTILS_API FGuid BankNameToGuid(const FString& BankName);
  44. #endif
  45. template <typename T>
  46. struct TMallocDelete
  47. {
  48. DECLARE_INLINE_TYPE_LAYOUT(TMallocDelete, NonVirtual);
  49. TMallocDelete() = default;
  50. TMallocDelete(const TMallocDelete&) = default;
  51. TMallocDelete& operator=(const TMallocDelete&) = default;
  52. ~TMallocDelete() = default;
  53. template <
  54. typename U,
  55. typename = decltype(ImplicitConv<T*>((U*)nullptr))
  56. >
  57. TMallocDelete(const TMallocDelete<U>&)
  58. {
  59. }
  60. template <
  61. typename U,
  62. typename = decltype(ImplicitConv<T*>((U*)nullptr))
  63. >
  64. TMallocDelete& operator=(const TMallocDelete<U>&)
  65. {
  66. return *this;
  67. }
  68. void operator()(T* Ptr) const
  69. {
  70. FMemory::Free(Ptr);
  71. }
  72. };
  73. }