AudioProxy.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AudioAllocators.h>
  10. #include <IAudioSystem.h>
  11. #include <AzCore/std/containers/deque.h>
  12. namespace Audio
  13. {
  14. ///////////////////////////////////////////////////////////////////////////////////////////////////
  15. class CAudioProxy
  16. : public IAudioProxy
  17. {
  18. public:
  19. CAudioProxy() = default;
  20. ~CAudioProxy() override;
  21. // IAudioProxy
  22. void Initialize(const char* sObjectName, void* ownerOverride = nullptr, const bool bInitAsync = true) override;
  23. void Release() override;
  24. void ExecuteTrigger(TAudioControlID nTriggerID) override;
  25. void ExecuteSourceTrigger(TAudioControlID nTriggerID, const SAudioSourceInfo& rSourceInfo) override;
  26. void StopAllTriggers() override;
  27. void StopTrigger(TAudioControlID nTriggerID) override;
  28. void SetSwitchState(TAudioControlID nSwitchID, TAudioSwitchStateID nStateID) override;
  29. void SetRtpcValue(TAudioControlID nRtpcID, float fValue) override;
  30. void SetObstructionCalcType(ObstructionType eObstructionType) override;
  31. void SetPosition(const SATLWorldPosition& refPosition) override;
  32. void SetPosition(const AZ::Vector3& refPosition) override;
  33. void SetMultiplePositions(const MultiPositionParams& params) override;
  34. void SetEnvironmentAmount(TAudioEnvironmentID nEnvironmentID, float fValue) override;
  35. void ResetEnvironments() override;
  36. void ResetParameters() override;
  37. TAudioObjectID GetAudioObjectID() const override
  38. {
  39. return m_nAudioObjectID;
  40. }
  41. // ~IAudioProxy
  42. private:
  43. void TryEnqueueRequest(AudioRequestVariant&& request);
  44. void ExecuteQueuedRequests();
  45. bool HasId() const;
  46. void Reset();
  47. AudioRequestsQueue m_queuedAudioRequests;
  48. SATLWorldPosition m_oPosition;
  49. TAudioObjectID m_nAudioObjectID{ INVALID_AUDIO_OBJECT_ID };
  50. void* m_ownerOverride{ nullptr };
  51. bool m_waitingForId{ false };
  52. bool m_releaseAtEndOfQueue{ false };
  53. };
  54. } // namespace Audio