AudioSystemImplementationMock.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 <IAudioSystemImplementation.h>
  10. #include <IAudioSystem.h>
  11. #include <AzTest/AzTest.h>
  12. namespace Audio
  13. {
  14. class AudioSystemMock
  15. : public AZ::Interface<IAudioSystem>::Registrar
  16. {
  17. public:
  18. MOCK_METHOD0(Initialize, bool());
  19. MOCK_METHOD0(Release, void());
  20. MOCK_METHOD0(ExternalUpdate, void());
  21. MOCK_METHOD1(PushRequest, void(AudioRequestVariant&&));
  22. MOCK_METHOD1(PushRequests, void(AudioRequestsQueue&));
  23. MOCK_METHOD1(PushRequestBlocking, void(AudioRequestVariant&&));
  24. MOCK_METHOD1(PushCallback, void(AudioRequestVariant&&));
  25. MOCK_CONST_METHOD1(GetAudioTriggerID, TAudioControlID(const char*));
  26. MOCK_CONST_METHOD1(GetAudioRtpcID, TAudioControlID(const char*));
  27. MOCK_CONST_METHOD1(GetAudioSwitchID, TAudioControlID(const char*));
  28. MOCK_CONST_METHOD2(GetAudioSwitchStateID, TAudioSwitchStateID(TAudioControlID, const char*));
  29. MOCK_CONST_METHOD1(GetAudioPreloadRequestID, TAudioPreloadRequestID(const char*));
  30. MOCK_CONST_METHOD1(GetAudioEnvironmentID, TAudioEnvironmentID(const char*));
  31. MOCK_METHOD1(ReserveAudioListenerID, bool(TAudioObjectID&));
  32. MOCK_METHOD1(ReleaseAudioListenerID, bool(TAudioObjectID));
  33. MOCK_METHOD1(SetAudioListenerOverrideID, bool(TAudioObjectID));
  34. MOCK_CONST_METHOD0(GetControlsPath, const char*());
  35. MOCK_METHOD0(UpdateControlsPath, void());
  36. MOCK_METHOD1(RefreshAudioSystem, void(const char*));
  37. MOCK_METHOD0(GetAudioProxy, IAudioProxy*());
  38. MOCK_METHOD1(RecycleAudioProxy, void(IAudioProxy*));
  39. MOCK_METHOD1(CreateAudioSource, TAudioSourceId(const SAudioInputConfig&));
  40. MOCK_METHOD1(DestroyAudioSource, void(TAudioSourceId));
  41. MOCK_CONST_METHOD2(GetAudioControlName, const char*(EAudioControlType, TATLIDType));
  42. MOCK_CONST_METHOD2(GetAudioSwitchStateName, const char*(TAudioControlID, TAudioSwitchStateID));
  43. };
  44. class AudioSystemImplMock
  45. : public AudioSystemImplementationRequestBus::Handler
  46. {
  47. public:
  48. MOCK_METHOD1(Update, void(float));
  49. MOCK_METHOD0(Initialize, EAudioRequestStatus());
  50. MOCK_METHOD0(ShutDown, EAudioRequestStatus());
  51. MOCK_METHOD0(Release, EAudioRequestStatus());
  52. MOCK_METHOD0(StopAllSounds, EAudioRequestStatus());
  53. MOCK_METHOD2(RegisterAudioObject, EAudioRequestStatus(IATLAudioObjectData*, const char*));
  54. MOCK_METHOD1(UnregisterAudioObject, EAudioRequestStatus(IATLAudioObjectData*));
  55. MOCK_METHOD1(ResetAudioObject, EAudioRequestStatus(IATLAudioObjectData*));
  56. MOCK_METHOD1(UpdateAudioObject, EAudioRequestStatus(IATLAudioObjectData*));
  57. MOCK_METHOD2(PrepareTriggerSync, EAudioRequestStatus(IATLAudioObjectData*, const IATLTriggerImplData*));
  58. MOCK_METHOD2(UnprepareTriggerSync, EAudioRequestStatus(IATLAudioObjectData*, const IATLTriggerImplData*));
  59. MOCK_METHOD3(PrepareTriggerAsync, EAudioRequestStatus(IATLAudioObjectData*, const IATLTriggerImplData*, IATLEventData*));
  60. MOCK_METHOD3(UnprepareTriggerAsync, EAudioRequestStatus(IATLAudioObjectData*, const IATLTriggerImplData*, IATLEventData*));
  61. MOCK_METHOD4(
  62. ActivateTrigger, EAudioRequestStatus(IATLAudioObjectData*, const IATLTriggerImplData*, IATLEventData*, const SATLSourceData*));
  63. MOCK_METHOD2(StopEvent, EAudioRequestStatus(IATLAudioObjectData*, const IATLEventData*));
  64. MOCK_METHOD1(StopAllEvents, EAudioRequestStatus(IATLAudioObjectData*));
  65. MOCK_METHOD2(SetPosition, EAudioRequestStatus(IATLAudioObjectData*, const SATLWorldPosition&));
  66. MOCK_METHOD2(SetMultiplePositions, EAudioRequestStatus(IATLAudioObjectData*, const MultiPositionParams&));
  67. MOCK_METHOD3(SetRtpc, EAudioRequestStatus(IATLAudioObjectData*, const IATLRtpcImplData*, float));
  68. MOCK_METHOD2(SetSwitchState, EAudioRequestStatus(IATLAudioObjectData*, const IATLSwitchStateImplData*));
  69. MOCK_METHOD3(SetObstructionOcclusion, EAudioRequestStatus(IATLAudioObjectData*, float, float));
  70. MOCK_METHOD3(SetEnvironment, EAudioRequestStatus(IATLAudioObjectData*, const IATLEnvironmentImplData*, float));
  71. MOCK_METHOD2(SetListenerPosition, EAudioRequestStatus(IATLListenerData*, const SATLWorldPosition&));
  72. MOCK_METHOD2(ResetRtpc, EAudioRequestStatus(IATLAudioObjectData*, const IATLRtpcImplData*));
  73. MOCK_METHOD1(RegisterInMemoryFile, EAudioRequestStatus(SATLAudioFileEntryInfo*));
  74. MOCK_METHOD1(UnregisterInMemoryFile, EAudioRequestStatus(SATLAudioFileEntryInfo*));
  75. MOCK_METHOD2(ParseAudioFileEntry, EAudioRequestStatus(const AZ::rapidxml::xml_node<char>*, SATLAudioFileEntryInfo*));
  76. MOCK_METHOD1(DeleteAudioFileEntryData, void(IATLAudioFileEntryData*));
  77. MOCK_METHOD1(GetAudioFileLocation, const char* const(SATLAudioFileEntryInfo*));
  78. MOCK_METHOD1(NewAudioTriggerImplData, IATLTriggerImplData*(const AZ::rapidxml::xml_node<char>*));
  79. MOCK_METHOD1(DeleteAudioTriggerImplData, void(IATLTriggerImplData*));
  80. MOCK_METHOD1(NewAudioRtpcImplData, IATLRtpcImplData*(const AZ::rapidxml::xml_node<char>*));
  81. MOCK_METHOD1(DeleteAudioRtpcImplData, void(IATLRtpcImplData*));
  82. MOCK_METHOD1(NewAudioSwitchStateImplData, IATLSwitchStateImplData*(const AZ::rapidxml::xml_node<char>*));
  83. MOCK_METHOD1(DeleteAudioSwitchStateImplData, void(IATLSwitchStateImplData*));
  84. MOCK_METHOD1(NewAudioEnvironmentImplData, IATLEnvironmentImplData*(const AZ::rapidxml::xml_node<char>*));
  85. MOCK_METHOD1(DeleteAudioEnvironmentImplData, void(IATLEnvironmentImplData*));
  86. MOCK_METHOD1(NewGlobalAudioObjectData, IATLAudioObjectData*(TAudioObjectID));
  87. MOCK_METHOD1(NewAudioObjectData, IATLAudioObjectData*(TAudioObjectID));
  88. MOCK_METHOD1(DeleteAudioObjectData, void(IATLAudioObjectData*));
  89. MOCK_METHOD1(NewDefaultAudioListenerObjectData, IATLListenerData*(TATLIDType));
  90. MOCK_METHOD1(NewAudioListenerObjectData, IATLListenerData*(TATLIDType));
  91. MOCK_METHOD1(DeleteAudioListenerObjectData, void(IATLListenerData*));
  92. MOCK_METHOD1(NewAudioEventData, IATLEventData*(TAudioEventID));
  93. MOCK_METHOD1(DeleteAudioEventData, void(IATLEventData*));
  94. MOCK_METHOD1(ResetAudioEventData, void(IATLEventData*));
  95. MOCK_METHOD1(SetLanguage, void(const char*));
  96. MOCK_CONST_METHOD0(GetImplSubPath, const char* const());
  97. MOCK_CONST_METHOD0(GetImplementationNameString, const char* const());
  98. MOCK_CONST_METHOD1(GetMemoryInfo, void(SAudioImplMemoryInfo&));
  99. MOCK_METHOD0(GetMemoryPoolInfo, AZStd::vector<AudioImplMemoryPoolInfo>());
  100. MOCK_METHOD1(CreateAudioSource, bool(const SAudioInputConfig&));
  101. MOCK_METHOD1(DestroyAudioSource, void(TAudioSourceId));
  102. MOCK_METHOD1(SetPanningMode, void(PanningMode));
  103. };
  104. } // namespace Audio