AkGameplayStatics.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  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. /*=============================================================================
  16. AkGameplayStatics.h:
  17. =============================================================================*/
  18. #pragma once
  19. #include "AkAudioDevice.h"
  20. #include "AkInclude.h"
  21. #include "AkGameplayTypes.h"
  22. #include "AkUnrealHelper.h"
  23. #include "Kismet/BlueprintFunctionLibrary.h"
  24. #include "AkGameplayStatics.generated.h"
  25. // PostEvent functions need to return the PlayingID (uint32), but Blueprints only work with int32.
  26. // Make sure AkPlayingID is always 32 bits, or else we're gonna have a bad time.
  27. static_assert(sizeof(AkPlayingID) == sizeof(int32), "AkPlayingID is not 32 bits anymore. Change return value of PostEvent functions and callback info structures members!");
  28. UCLASS()
  29. class AKAUDIO_API UAkGameplayStatics : public UBlueprintFunctionLibrary
  30. {
  31. GENERATED_BODY()
  32. public:
  33. UAkGameplayStatics(const class FObjectInitializer& ObjectInitializer);
  34. /** Get an AkComponent attached to and following the specified component.
  35. * @param AttachPointName - Optional named point within the AttachComponent to play the sound at.
  36. */
  37. UFUNCTION(BlueprintCallable, Category="Audiokinetic")
  38. static class UAkComponent * GetAkComponent( class USceneComponent* AttachToComponent, bool& ComponentCreated, FName AttachPointName = NAME_None, FVector Location = FVector(ForceInit), EAttachLocation::Type LocationType = EAttachLocation::KeepRelativeOffset );
  39. UFUNCTION(BlueprintCallable, Category="Audiokinetic")
  40. static bool IsEditor();
  41. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  42. static bool IsGame(UObject* WorldContextObject);
  43. /** Posts a Wwise Event attached to and following the root component of the specified actor.
  44. *
  45. * @param AkEvent - Event to play.
  46. * @param Actor - Actor on which to play the event. If the Actor is left empty, the Event will be played as an Ambient sound.
  47. * @param bStopWhenAttachedToDestroyed - Specifies whether the sound should stop playing when the owner of the attach to component is destroyed.
  48. * @param EventName - Deprecated: Event name in case the AkEvent is not set.
  49. */
  50. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Actor", meta=(AdvancedDisplay="2", AutoCreateRefTerm = "PostEventCallback"))
  51. static int32 PostEvent( class UAkAudioEvent* AkEvent,
  52. class AActor* Actor,
  53. UPARAM(meta = (Bitmask, BitmaskEnum = "/Script/AkAudio.EAkCallbackType")) int32 CallbackMask,
  54. const FOnAkPostEventCallback& PostEventCallback,
  55. bool bStopWhenAttachedToDestroyed = false,
  56. FString EventName = FString(""));
  57. /**
  58. * Posts a Wwise Event attached to and following the root component of the specified actor, and waits for the end of the event to continue execution.
  59. * Additional calls made while an event is active are ignored.
  60. *
  61. * @param AkEvent - Event to play.
  62. * @param Actor - actor on which to play the event.
  63. * @param bStopWhenAttachedToDestroyed - Specifies whether the sound should stop playing when the owner of the attach to component is destroyed.
  64. */
  65. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Actor", meta = (Latent, LatentInfo = "LatentInfo", AdvancedDisplay = "2"))
  66. static int32 PostAndWaitForEndOfEvent(class UAkAudioEvent* AkEvent,
  67. class AActor* Actor,
  68. bool bStopWhenAttachedToDestroyed,
  69. FLatentActionInfo LatentInfo);
  70. /** Posts a Wwise Event attached and following the root component of the specified actor, wait for the media to be loaded and waits for the end of the event to continue execution.
  71. * Additional calls made while an event is active are ignored.
  72. *
  73. * @warning This function is deprecated. Use \ref PostAndWaitForEndOfEvent or \ref UAkAudioEvent::PostOnActorAndWait.
  74. * Async operations are deprecated.
  75. *
  76. * @param AkEvent - ak event to play.
  77. * @param Actor - actor on which to play the event.
  78. * @param bStopWhenAttachedToDestroyed - Specifies whether the sound should stop playing when the owner of the attach to component is destroyed.
  79. */
  80. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Actor", meta = (Latent, LatentInfo = "LatentInfo", AdvancedDisplay = "3", bStopWhenAttachedToDestroyed = "false", AutoCreateRefTerm = "ExternalSources", DeprecatedFunction, DeprecationMessage = "Use \"UAkAudioEvent::PostOnActorAndWait\"."))
  81. static void PostAndWaitForEndOfEventAsync(class UAkAudioEvent* AkEvent,
  82. class AActor* Actor,
  83. int32& PlayingID,
  84. bool bStopWhenAttachedToDestroyed,
  85. FLatentActionInfo LatentInfo
  86. );
  87. /** Posts a Wwise Event by name attached to and following the root component of the specified actor.
  88. *
  89. * @warning This function is deprecated. You are expected to use an UAkAudioEvent. Please see \ref PostEvent or \ref UAkAudioEvent::PostOnActor.
  90. *
  91. * @param AkEvent - ak event to play.
  92. * @param Actor - actor on which to play the event.
  93. * @param bStopWhenAttachedToDestroyed - Specifies whether the sound should stop playing when the owner of the attach to component is destroyed.
  94. */
  95. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Actor", meta=(DeprecatedFunction, DeprecationMessage = "Use the \"Event Name\" field of PostEvent"))
  96. static void PostEventByName( const FString& EventName,
  97. class AActor* Actor,
  98. bool bStopWhenAttachedToDestroyed = false);
  99. /** Posts a Wwise Event at the specified location. This is a fire and forget sound, created on a temporary Wwise Game Object. Replication is also not handled at this point.
  100. *
  101. * @param AkEvent - Wwise Event to post.
  102. * @param Location - Location from which to post the Wwise Event.
  103. * @param Orientation - Orientation of the event.
  104. * @param EventName - Deprecated: Event name in case the AkEvent is not set.
  105. */
  106. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic", meta=(WorldContext="WorldContextObject", AdvancedDisplay = "3"))
  107. static int32 PostEventAtLocation(UAkAudioEvent* AkEvent, FVector Location, FRotator Orientation,
  108. const FString& EventName, UObject* WorldContextObject);
  109. /** Posts a Wwise Event by name at the specified location. This is a fire and forget sound, created on a temporary Wwise Game Object. Replication is also not handled at this point.
  110. *
  111. * @warning This function is deprecated. You are expected to use an UAkAudioEvent. Please see \ref UAkAudioEvent::PostAtLocation.
  112. *
  113. * @param AkEvent - Wwise Event to post.
  114. * @param Location - Location from which to post the Wwise Event.
  115. * @param Orientation - Orientation of the event.
  116. */
  117. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic", meta=(WorldContext="WorldContextObject", DeprecatedFunction, DeprecationMessage = "Use \"UAkAudioEvent::PostAtLocation\"."))
  118. static void PostEventAtLocationByName(const FString& EventName, FVector Location, FRotator Orientation, UObject* WorldContextObject );
  119. /** Execute action on event attached to and following the root component of the specified actor
  120. *
  121. * @warning This function is deprecated. Please see \ref UAkAudioEvent::ExecuteAction.
  122. *
  123. * @param AkEvent - Wwise Event to act upon.
  124. * @param ActionType - Which action to do.
  125. * @param Actor - Which actor to use.
  126. * @param TransitionDuration - Transition duration in milliseconds.
  127. * @param FadeCurve - The interpolation curve of the transition.
  128. * @param PlayingID - Use the return value of a Post Event to act only on this specific instance of an event.
  129. */
  130. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic|Actor", meta=(DeprecatedFunction, DeprecationMessage = "Use \"UAkAudioEvent::ExecuteAction\"."))
  131. static void ExecuteActionOnEvent(class UAkAudioEvent* AkEvent, AkActionOnEventType ActionType, class AActor* Actor, int32 TransitionDuration = 0, EAkCurveInterpolation FadeCurve = EAkCurveInterpolation::Linear, int32 PlayingID = 0);
  132. /** Execute action on specific playing ID
  133. *
  134. * @warning This function is deprecated. You are expected to use an UAkAudioEvent. Please see \ref UAkAudioEvent::ExecuteAction.
  135. *
  136. * @param ActionType - Which action to do.
  137. * @param PlayingID - Use the return value of a Post Event to act only on this specific instance of an event.
  138. * @param TransitionDuration - Transition duration in milliseconds.
  139. * @param FadeCurve - The interpolation curve of the transition.
  140. */
  141. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic|Actor", meta=(DeprecatedFunction, DeprecationMessage = "Use \"UAkAudioEvent::ExecuteAction\"."))
  142. static void ExecuteActionOnPlayingID(AkActionOnEventType ActionType, int32 PlayingID, int32 TransitionDuration = 0, EAkCurveInterpolation FadeCurve = EAkCurveInterpolation::Linear);
  143. /** Spawn an AkComponent at a location. Allows, for example, to set a switch on a fire and forget sound.
  144. * @param AkEvent - Wwise Event to post.
  145. * @param Location - Location from which to post the Wwise Event.
  146. * @param Orientation - Orientation of the event.
  147. * @param AutoPost - Automatically post the event once the AkComponent is created.
  148. * @param AutoDestroy - Automatically destroy the AkComponent once the event is finished.
  149. */
  150. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic", meta=(WorldContext="WorldContextObject", AdvancedDisplay = "6"))
  151. static class UAkComponent* SpawnAkComponentAtLocation(UObject* WorldContextObject, class UAkAudioEvent* AkEvent, FVector Location, FRotator Orientation, bool AutoPost, const FString& EventName, bool AutoDestroy = true);
  152. /**
  153. * Sets the value of a Game Parameter, optionally targetting the root component of a specified actor.
  154. * @param RTPC - The name of the Game Parameter to set
  155. * @param Value - The value of the Game Parameter
  156. * @param InterpolationTimeMs - Duration during which the Game Parameter is interpolated towards Value (in ms)
  157. * @param Actor - (Optional) Actor on which to set the Game Parameter value
  158. */
  159. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic", meta = (AdvancedDisplay = "4"))
  160. static void SetRTPCValue(class UAkRtpc const* RTPCValue, float Value, int32 InterpolationTimeMs, class AActor* Actor, FName RTPC);
  161. /**
  162. * Gets the value of a Game Parameter, optionally targetting the root component of a specified actor.
  163. * @param RTPC - The name of the Game Parameter to set
  164. * @param Value - The value of the Game Parameter
  165. * @param InterpolationTimeMs - Duration during which the Game Parameter is interpolated towards Value (in ms)
  166. * @param Actor - (Optional) Actor on which to set the Game Parameter value
  167. */
  168. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic", meta = (AdvancedDisplay = "7"))
  169. static void GetRTPCValue(class UAkRtpc const* RTPCValue, int32 PlayingID, ERTPCValueType InputValueType, float& Value, ERTPCValueType& OutputValueType, class AActor* Actor, FName RTPC);
  170. /**
  171. * Resets the value of a Game Parameter to its default value, optionally targetting the root component of a specified actor.
  172. * @param RTPCValue - The name of the Game Parameter to reset
  173. * @param InterpolationTimeMs - Duration during which the Game Parameter is interpolated towards its default value (in ms)
  174. * @param Actor - (Optional) Actor on which to reset the Game Parameter value
  175. * @param RTPC - The name of the Game Parameter to reset
  176. */
  177. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic", meta = (AdvancedDisplay = "8"))
  178. static void ResetRTPCValue(class UAkRtpc const* RTPCValue, int32 InterpolationTimeMs, class AActor* Actor, FName RTPC);
  179. /**
  180. * Set the active State for a given State Group.
  181. * @param StateGroup - Name of the State Group to be modified
  182. * @param State - Name of the State to be made active
  183. */
  184. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic", meta = (AdvancedDisplay = "1"))
  185. static void SetState(class UAkStateValue const* StateValue, FName StateGroup, FName State);
  186. /**
  187. * Posts a Trigger, targetting the root component of a specified actor.
  188. * @param Trigger - Name of the Trigger
  189. * @param Actor - Actor on which to post the Trigger
  190. */
  191. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Actor", meta = (AdvancedDisplay = "2"))
  192. static void PostTrigger(class UAkTrigger const* TriggerValue, class AActor* Actor, FName Trigger);
  193. /**
  194. * Sets the active Switch for a given Switch Group, targetting the root component of a specified actor.
  195. * @param SwitchGroup - Name of the Switch Group to be modified
  196. * @param SwitchState - Name of the Switch to be made active
  197. * @param Actor - Actor on which to set the switch
  198. */
  199. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Actor", meta = (AdvancedDisplay = "2"))
  200. static void SetSwitch(class UAkSwitchValue const* SwitchValue, class AActor* Actor, FName SwitchGroup, FName SwitchState);
  201. /** Sets multiple positions to a single game object.
  202. * Setting multiple positions on a single game object is a way to simulate multiple emission sources while using the resources of only one voice.
  203. * This can be used to simulate wall openings, area sounds, or multiple objects emitting the same sound in the same area.
  204. * Note: Calling SetMultiplePositions() with only one position is the same as calling SetPosition()
  205. * @param GameObjectAkComponent AkComponent of the game object on which to set positions.
  206. * @param Positions Array of transforms to apply.
  207. * @param MultiPositionType Position type
  208. * @return AK_Success when successful, AK_InvalidParameter if parameters are not valid.
  209. *
  210. */
  211. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  212. static void SetMultiplePositions(UAkComponent* GameObjectAkComponent, TArray<FTransform> Positions,
  213. AkMultiPositionType MultiPositionType = AkMultiPositionType::MultiDirections);
  214. /** Sets multiple positions to a single game object, with flexible assignment of input channels.
  215. * Setting multiple positions on a single game object is a way to simulate multiple emission sources while using the resources of only one voice.
  216. * This can be used to simulate wall openings, area sounds, or multiple objects emitting the same sound in the same area.
  217. * Note: Calling AK::SoundEngine::SetMultiplePositions() with only one position is the same as calling AK::SoundEngine::SetPosition()
  218. * @param GameObjectAkComponent AkComponent of the game object on which to set positions.
  219. * @param ChannelMasks Array of channel configuration to apply for each position.
  220. * @param Positions Array of transforms to apply.
  221. * @param MultiPositionType Position type
  222. * @return AK_Success when successful, AK_InvalidParameter if parameters are not valid.
  223. */
  224. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  225. static void SetMultipleChannelEmitterPositions(UAkComponent* GameObjectAkComponent,
  226. TArray<AkChannelConfiguration> ChannelMasks,
  227. TArray<FTransform> Positions,
  228. AkMultiPositionType MultiPositionType = AkMultiPositionType::MultiDirections
  229. );
  230. /** Sets multiple positions to a single game object, with flexible assignment of input channels.
  231. * Setting multiple positions on a single game object is a way to simulate multiple emission sources while using the resources of only one voice.
  232. * This can be used to simulate wall openings, area sounds, or multiple objects emitting the same sound in the same area.
  233. * Note: Calling AK::SoundEngine::SetMultiplePositions() with only one position is the same as calling AK::SoundEngine::SetPosition()
  234. * @param GameObjectAkComponent AkComponent of the game object on which to set positions.
  235. * @param ChannelMasks Array of channel mask to apply for each position.
  236. * @param Positions Array of transforms to apply.
  237. * @param MultiPositionType Position type
  238. * @return AK_Success when successful, AK_InvalidParameter if parameters are not valid.
  239. */
  240. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  241. static void SetMultipleChannelMaskEmitterPositions(UAkComponent* GameObjectAkComponent,
  242. TArray<FAkChannelMask> ChannelMasks,
  243. TArray<FTransform> Positions,
  244. AkMultiPositionType MultiPositionType = AkMultiPositionType::MultiDirections
  245. );
  246. /**
  247. * Sets UseReverbVolumes flag on a specified actor. Set value to true to use reverb volumes on this component.
  248. *
  249. * @param inUseReverbVolumes - Whether to use reverb volumes or not.
  250. * @param Actor - Actor on which to set the flag
  251. */
  252. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Actor")
  253. static void UseReverbVolumes(bool inUseReverbVolumes, class AActor* Actor);
  254. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Actor", meta = (AdvancedDisplay = "6", DeprecatedFunction, DeprecationMessage = "This function is deprecated and will be removed in future releases."))
  255. static void UseEarlyReflections(class AActor* Actor,
  256. class UAkAuxBus* AuxBus,
  257. int Order = 1,
  258. float BusSendGain = 1.f,
  259. float MaxPathLength = 100000.f,
  260. bool SpotReflectors = false,
  261. const FString& AuxBusName = FString(""));
  262. /**
  263. * Sets the Reflections Order for Spatial Audio Reflect.
  264. *
  265. * @param Order - The order of Reflection. Can be 0 to 4.
  266. * @param RefreshPaths - whether the paths should be refreshed immediately.
  267. */
  268. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Spatial Audio")
  269. static void SetReflectionsOrder(int Order, bool RefreshPaths);
  270. /**
  271. * Sets the obstruction and occlusion value of sounds going through this portal.
  272. *
  273. * @param PortalComponent - The portal through which sound path need to pass to get obstructed and occluded.
  274. * @param ObstructionValue - The obstruction value. Can be 0 to 1.
  275. * @param OcclusionValue - The occlusion value. Can be 0 to 1.
  276. */
  277. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Spatial Audio")
  278. static void SetPortalObstructionAndOcclusion(UAkPortalComponent* PortalComponent, float ObstructionValue, float OcclusionValue);
  279. /**
  280. * Sets the obstruction value of sounds going from this game object through this portal.
  281. *
  282. * @param GameObjectAkComponent - The game object emitting the sound that we want to obstruct.
  283. * @param PortalComponent - The portal through which the sound from the game object can go.
  284. * @param OcclusionValue - The occlusion value. Can be 0 to 1.
  285. */
  286. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Spatial Audio")
  287. static void SetGameObjectToPortalObstruction(UAkComponent* GameObjectAkComponent, UAkPortalComponent* PortalComponent, float ObstructionValue);
  288. /**
  289. * Sets the obstruction value of sounds going from a first portal through the next portal.
  290. *
  291. * @param PortalComponent0 - The first portal through which a sound path goes.
  292. * @param PortalComponent1 - The next portal throuh which the sound path goes from the first portal.
  293. * @param OcclusionValue - The occlusion value. Can be 0 to 1.
  294. */
  295. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Spatial Audio")
  296. static void SetPortalToPortalObstruction(UAkPortalComponent* PortalComponent0, UAkPortalComponent* PortalComponent1, float ObstructionValue);
  297. /**
  298. * Set the output bus volume (direct) to be used for the specified game object.
  299. * The control value is a number ranging from 0.0f to 1.0f.
  300. *
  301. * @param BusVolume - Bus volume to set
  302. * @param Actor - Actor on which to set the flag
  303. */
  304. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic|Actor")
  305. static void SetOutputBusVolume(float BusVolume, class AActor* Actor);
  306. /**
  307. * Force channel configuration for the specified bus.
  308. * This function has unspecified behavior when changing the configuration of a bus that
  309. * is currently playing.
  310. * You cannot change the configuration of the master bus.
  311. *
  312. * @param BusName Bus Name
  313. * @param ChannelConfiguration Desired channel configuration.
  314. * @return Always returns AK_Success
  315. */
  316. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  317. static void SetBusConfig(const FString& BusName, AkChannelConfiguration ChannelConfiguration);
  318. /**
  319. * Set the panning rule of the specified output.
  320. * This may be changed anytime once the sound engine is initialized.
  321. * @warning This function posts a message through the sound engine's internal message queue, whereas GetPanningRule() queries the current panning rule directly.
  322. *
  323. * @param PanRule Panning rule.
  324. */
  325. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  326. static void SetPanningRule(PanningRule PanRule);
  327. /**
  328. * Adds an output to the sound engine. Use this to add controller-attached headphones, controller speakers, DVR output, etc.
  329. * The in_Settings parameter contains an Audio Device shareset to specify the output plugin to use and a device ID to specify the instance, if necessary (e.g. which game controller).
  330. *
  331. * Like most functions of AK::SoundEngine, AddOutput is asynchronous.
  332. * A successful return code merely indicates that the request is properly queued. Error codes returned by this function indicate various invalid parameters.
  333. * To know if this function succeeds or not, and the failure code, register an AkDeviceStatusCallbackFunc callback with RegisterAudioDeviceStatusCallback.
  334. *
  335. * @param in_Settings Creation parameters for this output.
  336. * @param out_pDeviceID (Optional) Output ID to use with all other Output management functions. Leave to NULL if not required.
  337. * @param in_pListenerIDs Specific listener(s) to attach to this device. If specified, only the sounds routed to game objects linked to those listeners will play in this device. It is necessary to have separate listeners if multiple devices of the same type can coexist (e.g. controller speakers) If not specified, sound routing simply obey the associations between Master Busses and Audio Devices setup in the Wwise Project.
  338. */
  339. UFUNCTION(BlueprintCallable, meta = (AutoCreateRefTerm = "in_ListenerIDs"), Category = "Audiokinetic")
  340. static void AddOutput(const FAkOutputSettings& in_Settings, FAkOutputDeviceID& out_DeviceID, UPARAM(ref) TArray<UAkComponent*>& in_ListenerIDs);
  341. /**
  342. * Removes one output added through AK::SoundEngine::AddOutput If a listener was associated with the device, you should consider unregistering the listener prior to call RemoveOutput so that Game Object/Listener routing is properly updated according to your game scenario.
  343. *
  344. * @param in_OutputDeviceId ID of the output to remove. Use the returned ID from AddOutput, GetOutputID, or ReplaceOutputt.
  345. */
  346. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  347. static void RemoveOutput(FAkOutputDeviceID in_OutputDeviceId);
  348. /**
  349. * Replaces the main output device previously created during engine initialization with a new output device.
  350. * In addition to simply removing one output device and adding a new one, the new output device will also be used on all of the master busses
  351. * that the old output device was associated with, and preserve all listeners that were attached to the old output device.
  352. *
  353. * @param MainOutputSettings Creation parameters for this output
  354. */
  355. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  356. static void ReplaceMainOutput(const FAkOutputSettings& MainOutputSettings);
  357. /**
  358. * Gets speaker angles of the specified device. Speaker angles are used for 3D positioning of sounds over standard configurations.
  359. * Note that the current version of Wwise only supports positioning on the plane.
  360. * The speaker angles are expressed as an array of loudspeaker pairs, in degrees, relative to azimuth ]0,180].
  361. * Supported loudspeaker setups are always symmetric; the center speaker is always in the middle and thus not specified by angles.
  362. * Angles must be set in ascending order.
  363. *
  364. * @param SpeakerAngles Returned array of loudspeaker pair angles, in degrees relative to azimuth [0,180].
  365. * @param HeightAngle Elevation of the height layer, in degrees relative to the plane [-90,90].
  366. * @param DeviceShareSet ShareSet for which to get the angles.
  367. *
  368. */
  369. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  370. static void GetSpeakerAngles(TArray<float>& SpeakerAngles, float& HeightAngle, const FString& DeviceShareSet = "");
  371. /**
  372. * Sets speaker angles of the specified device. Speaker angles are used for 3D positioning of sounds over standard configurations.
  373. * Note that the current version of Wwise only supports positioning on the plane.
  374. * The speaker angles are expressed as an array of loudspeaker pairs, in degrees, relative to azimuth ]0,180].
  375. * Supported loudspeaker setups are always symmetric; the center speaker is always in the middle and thus not specified by angles.
  376. * Angles must be set in ascending order.
  377. *
  378. * @param SpeakerAngles Array of loudspeaker pair angles, in degrees relative to azimuth [0,180]
  379. * @param HeightAngle Elevation of the height layer, in degrees relative to the plane [-90,90]
  380. * @param DeviceShareSet ShareSet for which to set the angles on.
  381. */
  382. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  383. static void SetSpeakerAngles(const TArray<float>& SpeakerAngles, float HeightAngle, const FString& DeviceShareSet = "");
  384. /**
  385. * Sets the occlusion calculation refresh interval, targetting the root component of a specified actor.
  386. * @param RefreshInterval - Value of the wanted refresh interval
  387. * @param Actor - Actor on which to set the refresh interval
  388. */
  389. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Actor")
  390. static void SetOcclusionRefreshInterval(float RefreshInterval, class AActor* Actor );
  391. /**
  392. * Stop all sounds for an actor.
  393. */
  394. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Actor")
  395. static void StopActor(class AActor* Actor);
  396. /**
  397. * Stop all sounds.
  398. */
  399. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic")
  400. static void StopAll();
  401. /**
  402. * Cancels an Event callback
  403. */
  404. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic")
  405. static void CancelEventCallback(const FOnAkPostEventCallback& PostEventCallback);
  406. /**
  407. * Start all Ak ambient sounds.
  408. */
  409. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|AkAmbientSound", meta=(WorldContext = "WorldContextObject"))
  410. static void StartAllAmbientSounds(UObject* WorldContextObject);
  411. /**
  412. * Stop all Ak ambient sounds.
  413. */
  414. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|AkAmbientSound", meta=(WorldContext = "WorldContextObject"))
  415. static void StopAllAmbientSounds(UObject* WorldContextObject);
  416. /**
  417. * Clear all loaded banks
  418. */
  419. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic|SoundBanks", meta = (DeprecatedFunction, DeprecationMessage = "Use the \"ClearSoundBanksAndMedia\" instead."))
  420. static void ClearBanks();
  421. /**
  422. * Clear all loaded banks
  423. */
  424. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic|SoundBanks")
  425. static void ClearSoundBanksAndMedia();
  426. /**
  427. * Loads the Init SoundBank
  428. */
  429. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic|SoundBanks")
  430. static void LoadInitBank();
  431. /**
  432. * Unloads the Init SoundBank
  433. */
  434. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic|SoundBanks")
  435. static void UnloadInitBank();
  436. /**
  437. * Loads a bank by its name.
  438. * @param Bank - The bank to load.
  439. */
  440. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic|SoundBanks", meta = (DeprecatedFunction, DeprecationMessage = "To manually load and unload the bank and media resources for your Wwise Assets, use the Wwise Asset LoadData and UnloadData Blueprint functions."))
  441. static void LoadBankByName(const FString& BankName);
  442. /**
  443. * Unloads a bank by its name.
  444. * @param Bank - The bank to unload.
  445. */
  446. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category = "Audiokinetic|SoundBanks", meta = (DeprecatedFunction, DeprecationMessage = "To manually load and unload the bank and media resources for your Wwise Assets, use the Wwise Asset LoadData and UnloadData Blueprint functions."))
  447. static void UnloadBankByName(const FString& BankName);
  448. /**
  449. * Starts a Wwise output capture. The output file will be located in the same folder as the SoundBanks.
  450. * @param Filename - The name to give to the output file.
  451. */
  452. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Debug")
  453. static void StartOutputCapture(const FString& Filename);
  454. /**
  455. * Add text marker in output capture file.
  456. * @param MarkerText - The name text to put in the marker.
  457. */
  458. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Debug")
  459. static void AddOutputCaptureMarker(const FString& MarkerText);
  460. /**
  461. * Stops a Wwise output capture. The output file will be located in the same folder as the SoundBanks.
  462. */
  463. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Debug")
  464. static void StopOutputCapture();
  465. /**
  466. * Starts a Wwise profiler capture. The output file will be located in the same folder as the SoundBanks.
  467. * @param Filename - The name to give to the output file.
  468. */
  469. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Debug")
  470. static void StartProfilerCapture(const FString& Filename);
  471. /**
  472. * Stops a Wwise profiler capture. The output file will be located in the same folder as the SoundBanks.
  473. */
  474. UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="Audiokinetic|Debug")
  475. static void StopProfilerCapture();
  476. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Culture")
  477. static FString GetCurrentAudioCulture();
  478. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Culture")
  479. static TArray<FString> GetAvailableAudioCultures();
  480. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Culture", meta = (WorldContext = "WorldContextObject", Latent, LatentInfo = "LatentInfo"))
  481. static void SetCurrentAudioCulture(const FString& AudioCulture, FLatentActionInfo LatentInfo, UObject* WorldContextObject);
  482. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Culture")
  483. static void SetCurrentAudioCultureAsync(const FString& AudioCulture, const FOnSetCurrentAudioCultureCallback& Completed);
  484. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  485. static UObject* GetAkAudioTypeUserData(const UAkAudioType* Instance, const UClass* Type);
  486. /** Sets an effect ShareSet on an output device
  487. *
  488. * @param InDeviceID Output ID, as returned from AddOutput or GetOutputID. You can pass 0 for the main (default) output
  489. * @param InEffectIndex Effect slot index (0-3)
  490. * @param InEffectShareSet Effect ShareSet asset
  491. * @return Always returns True
  492. */
  493. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  494. static bool SetOutputDeviceEffect(const FAkOutputDeviceID InDeviceID, const int32 InEffectIndex, const UAkEffectShareSet* InEffectShareSet);
  495. /** Sets an Effect ShareSet at the specified Bus and Effect slot index.
  496. *
  497. * @param InBusName Bus name
  498. * @param InEffectIndex Effect slot index (0-3)
  499. * @param InEffectShareSet Effect ShareSet asset
  500. * @return True when successfully posted, False otherwise.
  501. */
  502. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  503. static bool SetBusEffectByName(const FString InBusName, const int32 InEffectIndex, const UAkEffectShareSet* InEffectShareSet);
  504. /** Sets an Effect ShareSet at the specified Bus and Effect slot index.
  505. *
  506. * @param InBusID Bus Short ID.
  507. * @param InEffectIndex Effect slot index (0-3)
  508. * @param InEffectShareSet Effect ShareSet asset
  509. * @return True when successfully posted, False otherwise.
  510. */
  511. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  512. static bool SetBusEffectByID(const FAkUniqueID InBusID, const int32 InEffectIndex, const UAkEffectShareSet* InEffectShareSet);
  513. /** Sets an Effect ShareSet at the specified Bus and Effect slot index.
  514. *
  515. * @param InAuxBus Aux Bus Asset.
  516. * @param InEffectIndex Effect slot index (0-3)
  517. * @param InEffectShareSet Effect ShareSet asset
  518. * @return True when successfully posted, False otherwise.
  519. */
  520. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  521. static bool SetAuxBusEffect(const UAkAuxBus* InAuxBus, const int32 InEffectIndex, const UAkEffectShareSet* InEffectShareSet);
  522. /** Sets an Effect ShareSet at the specified audio node and Effect slot index.
  523. *
  524. * @param InAudioNodeID Can be a member of the Actor-Mixer or Interactive Music Hierarchy (not a bus).
  525. * @param InEffectIndex Effect slot index (0-3)
  526. * @param InEffectShareSet Effect ShareSet asset
  527. * @return Always returns True.
  528. */
  529. UFUNCTION(BlueprintCallable, Category = "Audiokinetic")
  530. static bool SetActorMixerEffect(const FAkUniqueID InAudioNodeID, const int32 InEffectIndex, const UAkEffectShareSet* InEffectShareSet);
  531. /**
  532. * Use the position of a separate Actor for distance calculations for a specified listener.
  533. * When called, Wwise calculates distance attenuation and filtering
  534. * based on the distance between the AkComponent on the distance probe Actor and the sound source.
  535. * Useful for third-person perspective applications, the distance probe may be set to the player character's position,
  536. * and the listener position to that of the camera. In this scenario, attenuation is based on
  537. * the distance between the character and the sound, whereas panning, spatialization, and spread and focus calculations are base on the camera.
  538. * @param Listener - The listener that is being affected. By default, the listener is attached to the Player Camera Manager.
  539. * @param DistanceProbe - An actor to assign as the distance probe.
  540. */
  541. UFUNCTION(BlueprintCallable, Category = "Audiokinetic|Actor")
  542. static void SetDistanceProbe(AActor* Listener, AActor* DistanceProbe);
  543. static bool m_bSoundEngineRecording;
  544. };