WwiseFileHandlerBase.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 "Wwise/WwiseStreamingManagerHooks.h"
  17. #include "Wwise/WwiseExecutionQueue.h"
  18. #include "Wwise/WwiseFileState.h"
  19. class WWISEFILEHANDLER_API FWwiseFileHandlerBase : protected IWwiseStreamingManagerHooks
  20. {
  21. protected:
  22. FWwiseFileHandlerBase();
  23. ~FWwiseFileHandlerBase() override;
  24. void OpenStreaming(AkAsyncFileOpenData* io_pOpenData) override;
  25. void CloseStreaming(uint32 InShortId, FWwiseFileState& InFileState) override;
  26. AKRESULT GetOpenStreamingResult(AkAsyncFileOpenData* io_pOpenData);
  27. using FCreateStateFunction = TUniqueFunction<FWwiseFileStateSharedPtr()>;
  28. using FIncrementStateCallback = TUniqueFunction<void(const FWwiseFileStateSharedPtr&, bool bResult)>;
  29. using FDecrementStateCallback = TUniqueFunction<void()>;
  30. void IncrementFileStateUseAsync(uint32 InShortId, EWwiseFileStateOperationOrigin InOperationOrigin, FCreateStateFunction&& InCreate, FIncrementStateCallback&& InCallback);
  31. void DecrementFileStateUseAsync(uint32 InShortId, FWwiseFileState* InFileState, EWwiseFileStateOperationOrigin InOperationOrigin, FDecrementStateCallback&& InCallback);
  32. virtual void IncrementFileStateUse(uint32 InShortId, EWwiseFileStateOperationOrigin InOperationOrigin, FCreateStateFunction&& InCreate, FIncrementStateCallback&& InCallback);
  33. virtual void DecrementFileStateUse(uint32 InShortId, FWwiseFileState* InFileState, EWwiseFileStateOperationOrigin InOperationOrigin, FDecrementStateCallback&& InCallback);
  34. virtual void OnDeleteState(uint32 InShortId, FWwiseFileState& InFileState, EWwiseFileStateOperationOrigin InOperationOrigin, FDecrementStateCallback&& InCallback);
  35. virtual const TCHAR* GetManagingTypeName() const { return TEXT("UNKNOWN"); }
  36. FWwiseExecutionQueue FileHandlerExecutionQueue;
  37. FRWLock FileStatesByIdLock;
  38. TMap<uint32, FWwiseFileStateSharedPtr> FileStatesById;
  39. };