WwiseResourceCookerModule.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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/WwiseResourceCookerModule.h"
  16. #include "Wwise/WwiseResourceCookerImpl.h"
  17. #include "GameDelegates.h"
  18. FDelegateHandle IWwiseResourceCookerModule::ModifyCookDelegateHandle;
  19. void IWwiseResourceCookerModule::StartupModule()
  20. {
  21. #if UE_5_0_OR_LATER
  22. // This StartupModule can be executed multiple times as more than one module can derive from the interface.
  23. // Use GetModule to load what the user wishes, and ignore the current "this".
  24. auto* This = GetModule();
  25. if (UNLIKELY(!This))
  26. {
  27. return;
  28. }
  29. // The act of GetModule() can StartupModule another one. Make sure we are not recursively set.
  30. if (ModifyCookDelegateHandle.IsValid())
  31. {
  32. return;
  33. }
  34. ModifyCookDelegateHandle = FGameDelegates::Get().GetModifyCookDelegate().AddRaw(This, &IWwiseResourceCookerModule::OnModifyCook);
  35. #endif
  36. }
  37. void IWwiseResourceCookerModule::ShutdownModule()
  38. {
  39. #if UE_5_0_OR_LATER
  40. if (!ModifyCookDelegateHandle.IsValid())
  41. {
  42. return;
  43. }
  44. FGameDelegates::Get().GetModifyCookDelegate().Remove(ModifyCookDelegateHandle);
  45. ModifyCookDelegateHandle.Reset();
  46. #endif
  47. }