AkAudioInputManager.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 "AkInclude.h"
  17. #include "AkAudioDevice.h"
  18. #include "Templates/Function.h"
  19. /*------------------------------------------------------------------------------------
  20. AkAudioInput Delegates
  21. ------------------------------------------------------------------------------------*/
  22. DECLARE_DELEGATE_RetVal_ThreeParams(bool, FAkGlobalAudioInputDelegate, uint32, uint32, float**);
  23. DECLARE_DELEGATE_OneParam(FAkGlobalAudioFormatDelegate, AkAudioFormat&);
  24. /*------------------------------------------------------------------------------------
  25. FAkAudioInputManager
  26. ------------------------------------------------------------------------------------*/
  27. class AKAUDIO_API FAkAudioInputManager
  28. {
  29. public:
  30. /**
  31. * Post an Input event to Wwise SoundEngine linked to an actor
  32. *
  33. * @param Event Event to post
  34. * @param Actor Actor on which to play the event
  35. * @param AudioSamplesDelegate Callback that fills the audio samples buffer
  36. * @param AudioFormatDelegate Callback that sets the audio format
  37. * @param AudioContext Context where this input is used (Editor, Player, or other)
  38. * @return ID assigned by Wwise SoundEngine
  39. */
  40. static AkPlayingID PostAudioInputEvent(
  41. UAkAudioEvent* Event,
  42. AActor* Actor,
  43. FAkGlobalAudioInputDelegate AudioSamplesDelegate,
  44. FAkGlobalAudioFormatDelegate AudioFormatDelegate,
  45. EAkAudioContext AudioContext = EAkAudioContext::Foreign
  46. );
  47. /**
  48. * Post an Input event to Wwise SoundEngine linked to a Component
  49. *
  50. * @param Event Event to post
  51. * @param Component Component on which to play the event
  52. * @param AudioSamplesDelegate Callback that fills the audio samples buffer
  53. * @param AudioFormatDelegate Callback that sets the audio format
  54. * @param AudioContext Context where this input is used (Editor, Player, or other)
  55. * @return ID assigned by Wwise SoundEngine
  56. */
  57. static AkPlayingID PostAudioInputEvent(
  58. UAkAudioEvent* Event,
  59. UAkComponent* Component,
  60. FAkGlobalAudioInputDelegate AudioSamplesDelegate,
  61. FAkGlobalAudioFormatDelegate AudioFormatDelegate,
  62. EAkAudioContext AudioContext = EAkAudioContext::Foreign
  63. );
  64. /**
  65. * Post an Input event to Wwise SoundEngine linked to a GameObject
  66. *
  67. * @param Event Event to post
  68. * @param GameObject GameObject on which to play the event
  69. * @param AudioSamplesDelegate Callback that fills the audio samples buffer
  70. * @param AudioFormatDelegate Callback that sets the audio format
  71. * @param AudioContext Context where this input is used (Editor, Player, or other)
  72. * @return ID assigned by Wwise SoundEngine
  73. */
  74. static AkPlayingID PostAudioInputEvent(
  75. UAkAudioEvent* Event,
  76. AkGameObjectID GameObject,
  77. FAkGlobalAudioInputDelegate AudioSamplesDelegate,
  78. FAkGlobalAudioFormatDelegate AudioFormatDelegate,
  79. EAkAudioContext AudioContext = EAkAudioContext::Foreign
  80. );
  81. /**
  82. * Post an Input event to Wwise SoundEngine not linked to any GameObject
  83. *
  84. * @param Event Event to post
  85. * @param AudioSamplesDelegate Callback that fills the audio samples buffer
  86. * @param AudioFormatDelegate Callback that sets the audio format
  87. * @param AudioContext Context where this input is used (Editor, Player, or other)
  88. * @return ID assigned by Wwise SoundEngine
  89. */
  90. static AkPlayingID PostAudioInputEvent(
  91. UAkAudioEvent* Event,
  92. FAkGlobalAudioInputDelegate AudioSamplesDelegate,
  93. FAkGlobalAudioFormatDelegate AudioFormatDelegate,
  94. EAkAudioContext AudioContext = EAkAudioContext::Foreign
  95. );
  96. /**
  97. * Post an event to ak soundengine
  98. *
  99. * @param AkEvent Event UObject, if null EventName is used to determine the ShortID
  100. * @param EventName Name of the event to post
  101. * @param Actor Actor on which to play the event
  102. * @param AudioSamplesDelegate Callback that fills the audio samples buffer
  103. * @param AudioFormatDelegate Callback that sets the audio format
  104. * @return ID assigned by ak soundengine
  105. *
  106. * @deprecated Use a PostAudioInputEvent without EventName.
  107. */
  108. static AkPlayingID PostAudioInputEvent(
  109. class UAkAudioEvent* AkEvent,
  110. const FString& EventName,
  111. AActor * Actor,
  112. FAkGlobalAudioInputDelegate AudioSamplesDelegate,
  113. FAkGlobalAudioFormatDelegate AudioFormatDelegate
  114. );
  115. /**
  116. * Post an event to ak soundengine
  117. *
  118. * @param AkEvent Event UObject, if null EventName is used to determine the ShortID
  119. * @param EventName Name of the event to post
  120. * @param Component AkComponent on which to play the event
  121. * @param AudioSamplesDelegate Callback that fills the audio samples buffer
  122. * @param AudioFormatDelegate Callback that sets the audio format
  123. * @return ID assigned by ak soundengine
  124. *
  125. * @deprecated Use a PostAudioInputEvent without EventName.
  126. */
  127. static AkPlayingID PostAudioInputEvent(
  128. class UAkAudioEvent* AkEvent,
  129. const FString& EventName,
  130. UAkComponent* Component,
  131. FAkGlobalAudioInputDelegate AudioSamplesDelegate,
  132. FAkGlobalAudioFormatDelegate AudioFormatDelegate
  133. );
  134. /**
  135. * Post an event to ak soundengine by name
  136. *
  137. * @param EventName Name of the event to post
  138. * @param GameObject AkGameObject on which to play the event
  139. * @param AudioSamplesDelegate Callback that fills the audio samples buffer
  140. * @param AudioFormatDelegate Callback that sets the audio format
  141. * @return ID assigned by ak soundengine
  142. *
  143. * @deprecated Use a PostAudioInputEvent without EventName.
  144. */
  145. static AkPlayingID PostAudioInputEvent(
  146. const FString& EventName,
  147. AkGameObjectID GameObject,
  148. FAkGlobalAudioInputDelegate AudioSamplesDelegate,
  149. FAkGlobalAudioFormatDelegate AudioFormatDelegate
  150. );
  151. };