AkSoundBankGenerationManager.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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/UnrealString.h"
  17. #include "Containers/Array.h"
  18. #include "Dom/JsonObject.h"
  19. #include "HAL/ThreadSafeBool.h"
  20. #include "Widgets/Notifications/SNotificationList.h"
  21. #include "AssetManagement/WwiseProjectInfo.h"
  22. #include "WwiseUnrealHelper.h"
  23. DECLARE_STATS_GROUP(TEXT("AkSoundBankGeneration"), STATGROUP_AkSoundBankGenerationSource, STATCAT_Wwise);
  24. class AkSoundBankGenerationManager : public TSharedFromThis<AkSoundBankGenerationManager, ESPMode::ThreadSafe>
  25. {
  26. public:
  27. enum ESoundBankGenerationMode
  28. {
  29. WwiseConsole = 0,
  30. Commandlet,
  31. WAAPI
  32. };
  33. struct FInitParameters
  34. {
  35. TArray<FString> Platforms;
  36. TArray<FString> Languages;
  37. bool SkipLanguages = false;
  38. ESoundBankGenerationMode GenerationMode = WwiseConsole;
  39. };
  40. AkSoundBankGenerationManager(const FInitParameters& InitParameters);
  41. ~AkSoundBankGenerationManager();
  42. void Init();
  43. void DoGeneration();
  44. void SetOverrideWwiseConsolePath(const FString& value) { OverrideWwiseConsolePath = value; }
  45. private:
  46. void CreateNotificationItem();
  47. void Notify(const FString& key, const FString& message, const FString& AudioCuePath, bool bSuccess);
  48. void NotifyGenerationFailed();
  49. void NotifyGenerationSucceeded();
  50. void NotifyProfilingInProgress();
  51. void NotifyAuthoringUnavailable();
  52. void WrapUpGeneration(const bool bSuccess, const FString& BuilderName);
  53. void SetIsBuilding(bool bIsBuilding);
  54. TSharedPtr<SNotificationItem> NotificationItem;
  55. uint64 StartTime;
  56. FInitParameters InitParameters;
  57. IPlatformFile* PlatformFile = nullptr;
  58. //WwiseConsole generation
  59. bool WwiseConsoleGenerate();
  60. bool RunWwiseConsole(const FString& WwiseConsoleCommand, const FString& WwiseConsoleArguments);
  61. FString OverrideWwiseConsolePath;
  62. //WAAPI generation
  63. #if AK_SUPPORT_WAAPI
  64. bool WAAPIGenerate();
  65. bool SubscribeToGenerationDone();
  66. void CleanupWaapiSubscriptions();
  67. void OnSoundBankGenerationDone(uint64_t Id, TSharedPtr<FJsonObject> ResponseJson);
  68. #endif
  69. uint64 GenerationDoneSubscriptionId = 0;
  70. FDelegateHandle ConnectionLostHandle;
  71. FEvent* WaitForGenerationDoneEvent = nullptr;
  72. FThreadSafeBool WaapiGenerationSuccess = true;
  73. FThreadSafeBool bIsBuildingData = false;
  74. };