WaapiPlaybackTransport.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 "CoreMinimal.h"
  17. #include "Dom/JsonObject.h"
  18. class WaapiPlaybackTransport
  19. {
  20. struct TransportInfo
  21. {
  22. int32 TransportID;
  23. uint64 SubscriptionID;
  24. TransportInfo(int32 transID, uint64 subsID) : TransportID(transID), SubscriptionID(subsID) {}
  25. };
  26. public:
  27. ~WaapiPlaybackTransport();
  28. int32 FindOrAdd(const FGuid& InItemID);
  29. void Remove(const FGuid& InItemID);
  30. void TogglePlay(int32 InTransportID);
  31. void Stop(int32 InTransportID);
  32. bool IsPlaying(const FGuid& InItemID);
  33. void StopAndDestroyAll();
  34. private:
  35. uint64 SubscribeToStateChanged(int32 TransportId);
  36. void OnStateChanged(TSharedPtr<FJsonObject> InUEJsonObject);
  37. /** Remember the played items. Useful to play/stop and event. */
  38. TMap<FGuid, TransportInfo> TransportItems;
  39. FCriticalSection TransportItemsLock;
  40. };