Version
menu

Wwise SDK 2025.1.0
AkSpatialAudio.h
Go to the documentation of this file.
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Copyright (c) 2025 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 /// \file
28 /// Spatial Audio interface.
29 
30 #pragma once
31 
35 
36 /// Audiokinetic namespace
37 namespace AK
38 {
39  /// Audiokinetic spatial audio namespace
40  namespace SpatialAudio
41  {
42  ////////////////////////////////////////////////////////////////////////
43  /// @name Basic functions.
44  /// In order to use SpatialAudio, you need to initialize it using Init, and register the listeners that you plan on using with any of the services offered by SpatialAudio, using
45  /// RegisterListener respectively, _after_ having registered their corresponding game object to the sound engine.
46  /// \akwarning At the moment, there can be only one Spatial Audio listener registered at any given time.
47  //@{
48 
49  /// Initialize the SpatialAudio API.
51 
52  /// Assign a game object as the Spatial Audio listener. There can be only one Spatial Audio listener registered at any given time; in_gameObjectID will replace any previously set Spatial Audio listener.
53  /// The game object passed in must be registered by the client, at some point, for sound to be heard. It is not necessary to be registered at the time of calling this function.
54  /// If no listener is explicitly registered to spatial audio, then a default listener (set via \c AK::SoundEngine::SetDefaultListeners()) is selected. If there are no default listeners, or there are more than one
55  /// default listeners, then it is necessary to call RegisterListener() to specify which listener to use with Spatial Audio.
57  AkGameObjectID in_gameObjectID ///< Game object ID
58  );
59 
60  /// Unregister a game object as a listener in the SpatialAudio API; clean up Spatial Audio listener data associated with in_gameObjectID.
61  /// If in_gameObjectID is the current registered listener, calling this function will clear the Spatial Audio listener and
62  /// Spatial Audio features will be disabled until another listener is registered.
63  /// This function is optional - listener are automatically unregistered when their game object is deleted in the sound engine.
64  /// \sa
65  /// - \ref AK::SpatialAudio::RegisterListener
67  AkGameObjectID in_gameObjectID ///< Game object ID
68  );
69 
70  /// Define an inner and outer radius around each sound position for a specified game object.
71  /// If the radii are set to 0, the game object is a point source. Non-zero radii create a Radial Emitter.
72  /// The radii are used in spread and distance calculations that simulates sound emitting from a spherical volume of space.
73  /// When applying attenuation curves, the distance between the listener and the inner sphere (defined by the sound position and \c in_innerRadius) is used.
74  /// The spread for each sound position is calculated as follows:
75  /// - If the listener is outside the outer radius, the spread is defined by the area that the sphere occupies in the listener field of view. Specifically, this angle is calculated as 2.0*asinf( \c in_outerRadius / distance ), where distance is the distance between the listener and the sound position.
76  /// - When the listener intersects the outer radius (the listener is exactly \c in_outerRadius units away from the sound position), the spread is exactly 50%.
77  /// - When the listener is between the inner and outer radii, the spread interpolates linearly from 50% to 100% as the listener transitions from the outer radius towards the inner radius.
78  /// - If the listener is inside the inner radius, the spread is 100%.
79  /// \aknote Transmission and diffraction calculations in Spatial Audio always use the center of the sphere (the position(s) passed into \c AK::SoundEngine::SetPosition or \c AK::SoundEngine::SetMultiplePositions) for raycasting.
80  /// To obtain accurate diffraction and transmission calculations for radial sources, where different parts of the volume may take different paths through or around geometry,
81  /// it is necessary to pass multiple sound positions into \c AK::SoundEngine::SetMultiplePositions to allow the engine to 'sample' the area at different points.
82  /// - \ref AK::SoundEngine::SetPosition
83  /// - \ref AK::SoundEngine::SetMultiplePositions
85  AkGameObjectID in_gameObjectID, ///< Game object ID
86  AkReal32 in_outerRadius, ///< Outer radius around each sound position, defining 50% spread. Must satisfy \c in_innerRadius <= \c in outerRadius.
87  AkReal32 in_innerRadius ///< Inner radius around each sound position, defining 100% spread and 0 attenuation distance. Must satisfy \c in_innerRadius <= \c in outerRadius.
88  );
89 
90  //@}
91 
92  ////////////////////////////////////////////////////////////////////////
93  /// @name Helper functions for passing game data to the Reflect plug-in.
94  /// Use this API for detailed placement of reflection image sources.
95  /// \aknote These functions are low-level and useful when your game engine already implements a geometrical approach to sound propagation such as an image-source or a ray tracing algorithm.
96  /// Functions of Geometry are preferred and easier to use with the Reflect plug-in. \endaknote
97  //@{
98 
99  /// Add or update an individual image source for processing via the AkReflect plug-in. Use this API for detailed placement of
100  /// reflection image sources, whose positions have been determined by the client, such as from the results of a ray cast, computation or by manual placement. One possible
101  /// use case is generating reflections that originate far enough away that they can be modeled as a static point source, for example, off of a distant mountain.
102  /// The SpatialAudio API manages image sources added via SetImageSource() and sends them to the AkReflect plug-in that is on the aux bus with ID \c in_AuxBusID.
103  /// The image source applies all game objects that have a reflections aux send defined in the authoring tool, or only to a specific game object if \c in_gameObjectID is used.
104  /// \aknote The \c AkImageSourceSettings struct passed in \c in_info must contain a unique image source ID to be able to identify this image source across frames and when updating and/or removing it later.
105  /// Each instance of AkReflect has its own set of data, so you may reuse ID, if desired, as long as \c in_gameObjectID and \c in_AuxBusID are different.
106  /// \aknote It is possible for the AkReflect plugin to process reflections from both \c SetImageSource and the geometric reflections API on the same aux bus and game object, but be aware that image source ID collisions are possible.
107  /// The image source IDs used by the geometric reflections API are generated from hashed data that uniquely identifies the reflecting surfaces. If a collision occurs, one of the reflections will not be heard.
108  /// While collision are rare, to ensure that it never occurs use an aux bus for \c SetImageSource that is unique from the aux bus(es) defined in the authoring tool, and from those passed to \c SetEarlyReflectionsAuxSend.
109  /// \endaknote
110  /// \aknote For proper operation with AkReflect and the SpatialAudio API, any aux bus using AkReflect should have 'Listener Relative Routing' checked and the 3D Spatialization set to None in the Wwise authoring tool. See \ref spatial_audio_wwiseprojectsetup_businstances for more details. \endaknote
111  /// \sa
112  /// - \ref AK::SpatialAudio::RemoveImageSource
113  /// - \ref AK::SpatialAudio::ClearImageSources
114  /// - \ref AK::SpatialAudio::SetGameObjectInRoom
115  /// - \ref AK::SpatialAudio::SetEarlyReflectionsAuxSend
117  AkImageSourceID in_srcID, ///< The ID of the image source being added.
118  const AkImageSourceSettings& in_info, ///< Image source information.
119  const char* in_name, ///< Name given to image source, can be used to identify the image source in the AK Reflect plugin UI.
120  AkUniqueID in_AuxBusID = AK_INVALID_AUX_ID, ///< Aux bus that has the AkReflect plug in for early reflection DSP.
121  ///< Pass AK_INVALID_AUX_ID to use the reflections aux bus defined in the authoring tool.
122  AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT ///< The ID of the emitter game object to which the image source applies.
123  ///< Pass AK_INVALID_GAME_OBJECT to apply to all game objects that have a reflections aux bus assigned in the authoring tool.
124  );
125 
126  /// Remove an individual reflection image source that was previously added via \c SetImageSource.
127  /// \sa
128  /// - \ref AK::SpatialAudio::SetImageSource
129  /// - \ref AK::SpatialAudio::ClearImageSources
131  AkImageSourceID in_srcID, ///< The ID of the image source to remove.
132  AkUniqueID in_AuxBusID = AK_INVALID_AUX_ID, ///< Aux bus that was passed to SetImageSource.
133  AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT ///< Game object ID that was passed to SetImageSource.
134  );
135 
136  /// Remove all image sources matching \c in_AuxBusID and \c in_gameObjectID that were previously added via \c SetImageSource.
137  /// Both \c in_AuxBusID and \c in_gameObjectID can be treated as wild cards matching all aux buses and/or all game object, by passing \c AK_INVALID_AUX_ID and/or \c AK_INVALID_GAME_OBJECT, respectively.
138  /// \sa
139  /// - \ref AK::SpatialAudio::SetImageSource
140  /// - \ref AK::SpatialAudio::RemoveImageSource
142  AkUniqueID in_AuxBusID = AK_INVALID_AUX_ID, ///< Aux bus that was passed to SetImageSource, or AK_INVALID_AUX_ID to match all aux buses.
143  AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT ///< Game object ID that was passed to SetImageSource, or AK_INVALID_GAME_OBJECT to match all game objects.
144  );
145 
146  //@}
147 
148  ////////////////////////////////////////////////////////////////////////
149  /// @name Geometry
150  /// Geometry API for early reflection processing using Reflect.
151  //@{
152 
153  /// Add or update a set of geometry from the \c SpatialAudio module for geometric reflection and diffraction processing. A geometry set is a logical set of vertices, triangles, and acoustic surfaces,
154  /// which are referenced by the same \c AkGeometrySetID. The ID (\c in_GeomSetID) must be unique and is also chosen by the client in a manner similar to \c AkGameObjectID's.
155  /// It is necessary to create at least one geometry instance for each geometry set that is to be used for diffraction and reflection simulation.
156  /// \sa
157  /// - \ref AkGeometryParams
158  /// - \ref AK::SpatialAudio::SetGeometryInstance
159  /// - \ref AK::SpatialAudio::RemoveGeometry
161  AkGeometrySetID in_GeomSetID, ///< Unique geometry set ID, chosen by client.
162  const AkGeometryParams& in_params ///< Geometry parameters to set.
163  );
164 
165  /// Remove a set of geometry to the SpatialAudio API.
166  /// Calling \c AK::SpatialAudio::RemoveGeometry will remove all instances of the geometry from the scene.
167  /// \sa
168  /// - \ref AK::SpatialAudio::SetGeometry
170  AkGeometrySetID in_SetID ///< ID of geometry set to be removed.
171  );
172 
173  /// Add or update a geometry instance from the \c SpatialAudio module for geometric reflection and diffraction processing.
174  /// A geometry instance is a unique instance of a geometry set with a specified transform (position, rotation and scale).
175  /// It is necessary to create at least one geometry instance for each geometry set that is to be used for diffraction and reflection simulation.
176  /// The ID (\c in_GeomSetInstanceID) must be unique amongst all geometry instances, including geometry instances referencing different geometry sets. The ID is chosen by the client in a manner similar to \c AkGameObjectID's.
177  /// To update the transform of an existing geometry instance, call SetGeometryInstance again, passing the same \c AkGeometryInstanceID, with the updated transform.
178  /// \sa
179  /// - \ref AkGeometryInstanceParams
180  /// - \ref AK::SpatialAudio::RemoveGeometryInstance
182  AkGeometryInstanceID in_GeometryInstanceID, ///< Unique geometry set instance ID, chosen by client.
183  const AkGeometryInstanceParams& in_params ///< Geometry instance parameters to set.
184  );
185 
186  /// Remove a geometry instance from the SpatialAudio API.
187  /// \sa
188  /// - \ref AK::SpatialAudio::SetGeometryInstance
190  AkGeometryInstanceID in_GeometryInstanceID ///< ID of geometry set instance to be removed.
191  );
192 
193  /// Query information about the reflection paths that have been calculated via geometric reflection processing in the SpatialAudio API. This function can be used for debugging purposes.
194  /// This function must acquire the global sound engine lock and therefore, may block waiting for the lock.
195  /// \sa
196  /// - \ref AkReflectionPathInfo
198  AkGameObjectID in_gameObjectID, ///< The ID of the game object that the client wishes to query.
199  AkUInt32 in_positionIndex, ///< The index of the associated game object position.
200  AkVector64& out_listenerPos, ///< Returns the position of the listener game object that is associated with the game object \c in_gameObjectID.
201  AkVector64& out_emitterPos, ///< Returns the position of the emitter game object \c in_gameObjectID.
202  AkReflectionPathInfo* out_aPaths, ///< Pointer to an array of \c AkReflectionPathInfo's which will be filled after returning.
203  AkUInt32& io_uArraySize ///< The number of slots in \c out_aPaths, after returning the number of valid elements written.
204  );
205 
206  //@}
207 
208  ////////////////////////////////////////////////////////////////////////
209  /// @name Rooms and Portals
210  /// Sound Propagation API using rooms and portals.
211  //@{
212 
213  /// Add or update a room. Rooms are used to connect portals and define an orientation for oriented reverbs. This function may be called multiple times with the same ID to update the parameters of the room.
214  /// \akwarning The ID (\c in_RoomID) must be chosen in the same manner as \c AkGameObjectID's, as they are in the same ID-space. The spatial audio lib manages the
215  /// registration/unregistration of internal game objects for rooms that use these IDs and, therefore, must not collide.
216  /// Also, the room ID must not be in the reserved range (AkUInt64)(-32) to (AkUInt64)(-2) inclusively. You may, however, explicitly add the default room ID AK::SpatialAudio::kOutdoorRoomID (-1)
217  /// in order to customize its AkRoomParams, to provide a valid auxiliary bus, for example.\endakwarning
218  /// \sa
219  /// - \ref AkRoomID
220  /// - \ref AkRoomParams
221  /// - \ref AK::SpatialAudio::RemoveRoom
223  AkRoomID in_RoomID, ///< Unique room ID, chosen by the client.
224  const AkRoomParams& in_Params, ///< Parameter for the room.
225  const char* in_RoomName = nullptr ///< Name used to identify room (optional)
226  );
227 
228  /// Remove a room.
229  /// \sa
230  /// - \ref AkRoomID
231  /// - \ref AK::SpatialAudio::SetRoom
233  AkRoomID in_RoomID ///< Room ID that was passed to \c SetRoom.
234  );
235 
236  /// Add or update an acoustic portal. A portal is an opening that connects two or more rooms to simulate the transmission of reverberated (indirect) sound between the rooms.
237  /// This function may be called multiple times with the same ID to update the parameters of the portal. The ID (\c in_PortalID) must be chosen in the same manner as \c AkGameObjectID's,
238  /// as they are in the same ID-space. The spatial audio lib manages the registration/unregistration of internal game objects for portals that use these IDs, and therefore must not collide.
239  /// \sa
240  /// - \ref AkPortalID
241  /// - \ref AkPortalParams
242  /// - \ref AK::SpatialAudio::RemovePortal
244  AkPortalID in_PortalID, ///< Unique portal ID, chosen by the client.
245  const AkPortalParams& in_Params, ///< Parameter for the portal.
246  const char* in_PortalName = nullptr ///< Name used to identify portal (optional)
247  );
248 
249  /// Remove a portal.
250  /// \sa
251  /// - \ref AkPortalID
252  /// - \ref AK::SpatialAudio::SetPortal
254  AkPortalID in_PortalID ///< ID of portal to be removed, which was originally passed to SetPortal.
255  );
256 
257  /// Use a Room as a Reverb Zone.
258  /// AK::SpatialAudio::SetReverbZone establishes a parent-child relationship between two Rooms and allows for sound propagation between them
259  /// as if they were the same Room, without the need for a connecting Portal. Setting a Room as a Reverb Zone
260  /// is useful in situations where two or more acoustic environments are not easily modeled as closed rooms connected by portals.
261  /// Possible uses for Reverb Zones include: a covered area with no walls, a forested area within an outdoor space, or any situation
262  /// where multiple reverb effects are desired within a common space. Reverb Zones have many advantages compared to standard Game-Defined
263  /// Auxiliary Sends. They are part of the wet path, and form reverb chains with other Rooms; they are spatialized according to their 3D extent;
264  /// they are also subject to other acoustic phenomena simulated in Wwise Spatial Audio, such as diffraction and transmission.
265  /// A parent Room may have multiple Reverb Zones, but a Reverb Zone can only have a single Parent. If a Room is already assigned
266  /// to a parent Room, it will first be removed from the old parent (exactly as if AK::SpatialAudio::RemoveReverbZone were called)
267  /// before then being assigned to the new parent Room. A Room can not be its own parent.
268  /// The Reverb Zone and its parent are both Rooms, and as such, must be specified using AK::SpatialAudio::SetRoom.
269  /// If AK::SpatialAudio::SetReverbZone is called before AK::SpatialAudio::SetRoom, and either of the two rooms do not yet exist,
270  /// placeholder Rooms with default parameters are created. They should be subsequently parameteized with AK::SpatialAudio::SetRoom.
271  ///
272  /// To set which Reverb Zone a Game Object is in, use the AK::SpatialAudio::SetGameObjectInRoom API, and pass the Reverb Zone's Room ID.
273  /// In Wwise Spatial Audio, a Game Object can only ever be inside a single room, and Reverb Zones are no different in this regard.
274  /// \aknote
275  /// The automatically created 'outdoors' Room is commonly used as a parent Room for Reverb Zones, since they often model open spaces.
276  /// To attach a Reverb zone to outdoors, pass AK::SpatialAudio::kOutdoorRoomID as the \c in_ParentRoom argument. Like all Rooms, the 'outdoors' Room
277  /// can be parameterized (for example, to assign a reverb bus) by passing AK::SpatialAudio::kOutdoorRoomID to AK::SpatialAudio::SetRoom.
278  /// \sa
279  /// - \ref AkRoomID
280  /// - \ref AK::SpatialAudio::SetRoom
281  /// - \ref AK::SpatialAudio::RemoveRoom
282  /// - \ref AK::SpatialAudio::RemoveReverbZone
283  /// - \ref AK::SpatialAudio::kOutdoorRoomID
285  AkRoomID in_ReverbZone, ///< ID of the Room which will be specified as a Reverb Zone.
286  AkRoomID in_ParentRoom, ///< ID of the parent Room.
287  AkReal32 in_transitionRegionWidth ///< Width of the transition region between the Reverb Zone and its parent. The transition region is centered around the Reverb Zone geometry. It only applies where triangle transmission loss is set to 0.
288  );
289 
290  /// Remove a Reverb Zone from its parent.
291  /// It will no longer be possible for sound to propagate between the two rooms, unless they are explicitly connected with a Portal.
292  /// \sa
293  /// - \ref AK::SpatialAudio::SetReverbZone
294  /// - \ref AK::SpatialAudio::RemoveRoom
295  /// - \ref AK::SpatialAudio::RemoveReverbZone
297  AkRoomID in_ReverbZone ///< ID of the Room which has been specified as a Reverb Zone.
298  );
299 
300  /// Set the room that the game object is currently located in - usually the result of a containment test performed by the client. The room must have been registered with \c SetRoom.
301  /// Setting the room for a game object provides the basis for the sound propagation service, and also sets which room's reverb aux bus to send to. The sound propagation service traces the path
302  /// of the sound from the emitter to the listener, and calculates the diffraction as the sound passes through each portal. The portals are used to define the spatial location of the diffracted and reverberated
303  /// audio.
304  /// \sa
305  /// - \ref AK::SpatialAudio::SetRoom
306  /// - \ref AK::SpatialAudio::RemoveRoom
308  AkGameObjectID in_gameObjectID, ///< Game object ID
309  AkRoomID in_CurrentRoomID ///< RoomID that was passed to \c AK::SpatialAudio::SetRoom
310  );
311 
312  /// Unset the room that the game object is currently located in.
313  /// When a game object has not been explicitly assigned to a room with \ref AK::SpatialAudio::SetGameObjectInRoom, the room is automatically computed.
314  /// \sa
315  /// - \ref AK::SpatialAudio::SetRoom
316  /// - \ref AK::SpatialAudio::RemoveRoom
318  AkGameObjectID in_gameObjectID ///< Game object ID
319  );
320 
321  /// Set a global scaling factor that manipulates reverb send values. AK::SpatialAudio::SetAdjacentRoomBleed affects the proportion of audio sent to adjacent rooms
322  /// versus the proportion sent to the emitter's current room. It updates the initialization setting specified in AkSpatialAudioInitSettings::fAdjacentRoomBleed.
323  /// This value is multiplied by AkPortalParams::AdjacentRoomBleed, which is used to scale reverb bleed for individual portals.
324  /// When calculating reverb send amounts, each portal's aperture is multiplied by fAdjacentRoomBleed, altering its perceived size:
325  /// - 1.0 (default): Maintain portals at its true geometric size (no scaling).
326  /// - > 1.0: Increases the perceived size of all portals, allowing more bleed into adjacent rooms.
327  /// - < 1.0: Decreases the perceived size of all portals, reducing bleed into adjacent rooms.
328  /// Valid range: (0.0 - infinity)
329  /// Note: Values approaching 0 may result in abrupt portal transitions.
331  AkReal32 in_fAdjacentRoomBleed
332  );
333 
334  /// Set the early reflections order for reflection calculation. The reflections order indicates the number of times sound can bounce off of a surface.
335  /// A higher number requires more CPU resources but results in denser early reflections. Set to 0 to globally disable reflections processing.
337  AkUInt32 in_uReflectionsOrder, ///< Number of reflections to calculate. Valid range [0,4]
338  bool in_bUpdatePaths ///< Set to true to clear existing higher-order paths and to force the re-computation of new paths. If false, existing paths will remain and new paths will be computed when the emitter or listener moves.
339  );
340 
341  /// Set the diffraction order for geometric path calculation. The diffraction order indicates the number of edges a sound can diffract around.
342  /// A higher number requires more CPU resources but results in paths found around more complex geometry. Set to 0 to globally disable geometric diffraction processing.
343  /// \sa
344  /// - \ref AkSpatialAudioInitSettings::uMaxDiffractionOrder
346  AkUInt32 in_uDiffractionOrder, ///< Number of diffraction edges to consider in path calculations. Valid range [0,8]
347  bool in_bUpdatePaths ///< Set to true to clear existing diffraction paths and to force the re-computation of new paths. If false, existing paths will remain and new paths will be computed when the emitter or listener moves.
348  );
349 
350  /// Set the maximum number of computed reflection paths
351  ///
353  AkUInt32 in_uMaxGlobalReflectionPaths ///< Maximum number of reflection paths. Valid range [0..[
354  );
355 
356  /// Set the maximum number of computed diffraction paths.
357  /// Pass a valid Game Object ID to to \c in_gameObjectID to affect a specific game object and override the value set in AkSpatialAudioInitSettings::uMaxDiffractionPaths.
358  /// Pass \c AK_INVALID_GAME_OBJECT to apply the same limit to all Game Objects (that have not previously been passed to SetMaxDiffractionPaths),
359  /// updating the value set for AkSpatialAudioInitSettings::uMaxDiffractionPaths.
360  ///
361  /// \sa
362  /// - \ref AkSpatialAudioInitSettings::uMaxDiffractionPaths
364  AkUInt32 in_uMaxDiffractionPaths, ///< Maximum number of reflection paths. Valid range [0..32]
365  AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT ///< Game Object ID. Pass AK_INVALID_GAME_OBJECT to affect all Game Objects, effectivly updating AkSpatialAudioInitSettings::uMaxDiffractionPaths. Pass a valid Game Object ID to override the init setting for a specific Game Object.
366  );
367 
368  /// Set the maximum number of game-defined auxiliary sends that can originate from a single emitter.
369  /// Set to 1 to only allow emitters to send directly to their current room. Set to 0 to disable the limit.
370  /// \sa
371  /// - \ref AkSpatialAudioInitSettings::uMaxEmitterRoomAuxSends
373  AkUInt32 in_uMaxEmitterRoomAuxSends ///< The maximum number of room aux send connections.
374  );
375 
376  /// Set the number of rays cast from the listener by the stochastic ray casting engine.
377  /// A higher number requires more CPU resources but provides more accurate results. Default value (35) should be good for most applications.
378  ///
380  AkUInt32 in_uNbPrimaryRays ///< Number of rays cast from the listener
381  );
382 
383  /// Set the number of frames on which the path validation phase will be spread. Value between [1..[
384  /// High values delay the validation of paths. A value of 1 indicates no spread at all.
385  ///
387  AkUInt32 in_uNbFrames ///< Number of spread frames
388  );
389 
390  /// [\ref spatial_audio_experimental "Experimental"] Enable parameter smoothing on the diffraction paths output from the Acoustics Engine, either globally or for a specific game object. Set fSmoothingConstantMs to a value greater than 0 to define the time constant (in milliseconds) for parameter smoothing.
391  /// \sa
392  /// - \ref AkSpatialAudioInitSettings::fSmoothingConstantMs
394  AkReal32 in_fSmoothingConstantMs, ///< Smoothing constant (ms)
395  AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT ///< Game Object ID. Pass AK_INVALID_GAME_OBJECT to set the global smoothing constant, affecting all Spatial Audio Emitters and Rooms.
396  );
397 
398  /// Set an early reflections auxiliary bus for a particular game object.
399  /// Geometrical reflection calculation inside spatial audio is enabled for a game object if any sound playing on the game object has a valid early reflections aux bus specified in the authoring tool,
400  /// or if an aux bus is specified via \c SetEarlyReflectionsAuxSend.
401  /// The \c in_auxBusID parameter of SetEarlyReflectionsAuxSend applies to sounds playing on the game object \c in_gameObjectID which have not specified an early reflection bus in the authoring tool -
402  /// the parameter specified on individual sounds' reflection bus takes priority over the value passed in to \c SetEarlyReflectionsAuxSend.
403  /// \aknote
404  /// Users may apply this function to avoid duplicating sounds in the Containers hierarchy solely for the sake of specifying a unique early reflection bus, or in any situation where the same
405  /// sound should be played on different game objects with different early reflection aux buses (the early reflection bus must be left blank in the authoring tool if the user intends to specify it through the API). \endaknote
407  AkGameObjectID in_gameObjectID, ///< Game object ID
408  AkAuxBusID in_auxBusID ///< Auxiliary bus ID. Applies only to sounds which have not specified an early reflection bus in the authoring tool. Pass \c AK_INVALID_AUX_ID to set only the send volume.
409  );
410 
411  /// Set an early reflections send volume for a particular game object.
412  /// The \c in_fSendVolume parameter is used to control the volume of the early reflections send. It is combined with the early reflections volume specified in the authoring tool, and is applied to all sounds
413  /// playing on the game object.
414  /// Setting \c in_fSendVolume to 0.f will disable all reflection processing for this game object.
416  AkGameObjectID in_gameObjectID, ///< Game object ID
417  AkReal32 in_fSendVolume ///< Send volume (linear) for auxiliary send. Set 0.f to disable reflection processing. Valid range 0.f-1.f.
418  );
419 
420  /// Set the obstruction and occlusion value for a portal that has been registered with Spatial Audio.
421  /// Portal obstruction simulates objects that block the direct sound path between the portal and the listener, but
422  /// allows indirect sound to pass around the obstacle. For example, use portal obstruction
423  /// when a piece of furniture blocks the line of sight of the portal opening.
424  /// Portal obstruction is applied to the connection between the emitter and the listener, and only affects the dry signal path.
425  /// Portal occlusion simulates a complete blockage of both the direct and indirect sound through a portal. For example, use portal occlusion for
426  /// opening or closing a door or window.
427  /// Portal occlusion is applied to the connection between the emitter and the first room in the chain, as well as the connection between the emitter and listener.
428  /// Portal occlusion affects both the dry and wet (reverberant) signal paths.
429  /// If you are using built-in game parameters to drive RTPCs, the obstruction and occlusion values set here
430  /// do not affect the RTPC values. This behavior is intentional and occurs because RTPCs only provide one
431  /// value per game object, but a single game object can have multiple paths through different Portals,
432  /// each with different obstruction and occlusion values.
433  /// To apply detailed obstruction to specific sound paths but not others, use \c AK::SpatialAudio::SetGameObjectToPortalObstruction and \c AK::SpatialAudio::SetPortalToPortalObstruction.
434  /// To apply occlusion and obstruction to the direct line of sight between the emitter and listener use \c AK::SoundEngine::SetObjectObstructionAndOcclusion.
435  /// \sa
436  /// - \ref AK::SpatialAudio::SetGameObjectToPortalObstruction
437  /// - \ref AK::SpatialAudio::SetPortalToPortalObstruction
438  /// - \ref AK::SoundEngine::SetObjectObstructionAndOcclusion
440  AkPortalID in_PortalID, ///< Portal ID.
441  AkReal32 in_fObstruction, ///< Obstruction value. Valid range 0.f-1.f
442  AkReal32 in_fOcclusion, ///< Occlusion value. Valid range 0.f-1.f
443  bool in_bTransition = false ///< Transition obstruction and occlusion through portals. Default false
444  );
445 
446  /// Set the obstruction value of the path between a game object and a portal that has been created by Spatial Audio.
447  /// The obstruction value is applied on one of the path segments of the sound between the emitter and the listener.
448  /// Diffraction must be enabled on the sound for a diffraction path to be created.
449  /// Also, there should not be any portals between the provided game object and portal ID parameters.
450  /// The obstruction value is used to simulate objects between the portal and the game object that are obstructing the sound.
451  /// Send an obstruction value of 0 to ensure the value is removed from the internal data structure.
452  /// \sa
453  /// - \ref AK::SpatialAudio::SetPortalObstructionAndOcclusion
455  AkGameObjectID in_gameObjectID, ///< Game object ID
456  AkPortalID in_PortalID, ///< Portal ID
457  AkReal32 in_fObstruction ///< Obstruction value. Valid range 0.f-1.f
458  );
459 
460  /// Set the obstruction value of the path between two portals that has been created by Spatial Audio.
461  /// The obstruction value is applied on one of the path segments of the sound between the emitter and the listener.
462  /// Diffraction must be enabled on the sound for a diffraction path to be created.
463  /// Also, there should not be any portals between the two provided ID parameters.
464  /// The obstruction value is used to simulate objects between the portals that are obstructing the sound.
465  /// Send an obstruction value of 0 to ensure the value is removed from the internal data structure.
466  /// \sa
467  /// - \ref AK::SpatialAudio::SetPortalObstructionAndOcclusion
469  AkPortalID in_PortalID0, ///< Portal ID
470  AkPortalID in_PortalID1, ///< Portal ID
471  AkReal32 in_fObstruction ///< Obstruction value. Valid range 0.f-1.f
472  );
473 
474  /// Query information about the wet diffraction amount for the portal \c in_portal, returned as a normalized value \c out_wetDiffraction in the range [0,1].
475  /// The wet diffraction is calculated from how far into the 'shadow region' the listener is from the portal. Unlike dry diffraction, the
476  /// wet diffraction does not depend on the incident angle, but only the normal of the portal.
477  /// This value is applied by spatial audio, to the Diffraction value and built-in game parameter of the room game object that is
478  /// on the other side of the portal (relative to the listener).
479  /// This function must acquire the global sound engine lock and therefore, may block waiting for the lock.
480  /// \sa
481  /// - \ref AkSpatialAudioInitSettings
483  AkPortalID in_portal, ///< The ID of the game object that the client wishes to query.
484  AkReal32& out_wetDiffraction ///< The number of slots in \c out_aPaths, after returning the number of valid elements written.
485  );
486 
487  /// Query information about the diffraction state for a particular listener and emitter, which has been calculated using the data provided via the spatial audio emitter API. This function can be used for debugging purposes.
488  /// Returned in \c out_aPaths, this array contains the sound paths calculated from diffraction around a geometric edge and/or diffraction through portals connecting rooms.
489  /// No paths will be returned in any of the following conditions: (1) the emitter game object has a direct line of sight to the listener game object, (2) the emitter and listener are in the same room, and the listener is completely outside the radius of the emitter,
490  /// or (3) The emitter and listener are in different rooms, but there are no paths found via portals between the emitter and the listener.
491  /// A single path with zero diffraction nodes is returned when all of the following conditions are met: (1) the emitter and listener are in the same room, (2) there is no direct line of sight, and (3) either the Voice's Attenuation's curve max distance is exceeded or the accumulated diffraction coefficient exceeds 1.0.
492  /// This function must acquire the global sound engine lock and, therefore, may block waiting for the lock.
493  /// \sa
494  /// - \ref AkDiffractionPathInfo
496  AkGameObjectID in_gameObjectID, ///< The ID of the game object that the client wishes to query.
497  AkUInt32 in_positionIndex, ///< The index of the associated game object position.
498  AkVector64& out_listenerPos, ///< Returns the position of the listener game object that is associated with the game object \c in_gameObjectID.
499  AkVector64& out_emitterPos, ///< Returns the position of the emitter game object \c in_gameObjectID.
500  AkDiffractionPathInfo* out_aPaths, ///< Pointer to an array of \c AkDiffractionPathInfo's which will be filled on return.
501  AkUInt32& io_uArraySize ///< The number of slots in \c out_aPaths, after returning the number of valid elements written.
502  );
503 
504  /// Set the operation used to calculate transmission loss on a direct path between emitter and listener.
505  ///
507  AkTransmissionOperation in_eOperation ///< The operation to be used on all transmission paths.
508  );
509 
510  /// Reset the stochastic engine state by re-initializing the random seeds.
511  ///
513 
514  //@}
515  }
516 };
AKSOUNDENGINE_API AKRESULT QueryWetDiffraction(AkPortalID in_portal, AkReal32 &out_wetDiffraction)
AKSOUNDENGINE_API AKRESULT UnregisterListener(AkGameObjectID in_gameObjectID)
Parameters passed to SetPortal.
Definition of data structures for AkAudioObject.
AKSOUNDENGINE_API AKRESULT RemovePortal(AkPortalID in_PortalID)
AKSOUNDENGINE_API AKRESULT SetGameObjectInRoom(AkGameObjectID in_gameObjectID, AkRoomID in_CurrentRoomID)
AKSOUNDENGINE_API AKRESULT SetMaxEmitterRoomAuxSends(AkUInt32 in_uMaxEmitterRoomAuxSends)
AKSOUNDENGINE_API AKRESULT Init(const AkSpatialAudioInitSettings &in_initSettings)
Initialize the SpatialAudio API.
AkTransmissionOperation
AKSOUNDENGINE_API AKRESULT SetReverbZone(AkRoomID in_ReverbZone, AkRoomID in_ParentRoom, AkReal32 in_transitionRegionWidth)
AKSOUNDENGINE_API AKRESULT SetMaxDiffractionPaths(AkUInt32 in_uMaxDiffractionPaths, AkGameObjectID in_gameObjectID=AK_INVALID_GAME_OBJECT)
AKSOUNDENGINE_API AKRESULT SetTransmissionOperation(AkTransmissionOperation in_eOperation)
AkUInt64 AkGameObjectID
Game object ID.
Definition: AkTypedefs.h:47
AKSOUNDENGINE_API AKRESULT QueryDiffractionPaths(AkGameObjectID in_gameObjectID, AkUInt32 in_positionIndex, AkVector64 &out_listenerPos, AkVector64 &out_emitterPos, AkDiffractionPathInfo *out_aPaths, AkUInt32 &io_uArraySize)
AKSOUNDENGINE_API AKRESULT SetSmoothingConstant(AkReal32 in_fSmoothingConstantMs, AkGameObjectID in_gameObjectID=AK_INVALID_GAME_OBJECT)
#define AK_EXTERNAPIFUNC(_type, _name)
AKSOUNDENGINE_API AKRESULT SetEarlyReflectionsAuxSend(AkGameObjectID in_gameObjectID, AkAuxBusID in_auxBusID)
AkUInt32 AkImageSourceID
Image Source ID.
Definition: AkTypedefs.h:71
static const AkGameObjectID AK_INVALID_GAME_OBJECT
Invalid game object (may also mean all game objects)
Definition: AkConstants.h:33
AKSOUNDENGINE_API AKRESULT QueryReflectionPaths(AkGameObjectID in_gameObjectID, AkUInt32 in_positionIndex, AkVector64 &out_listenerPos, AkVector64 &out_emitterPos, AkReflectionPathInfo *out_aPaths, AkUInt32 &io_uArraySize)
AkUInt32 AkUniqueID
Unique 32-bit ID.
Definition: AkTypedefs.h:39
AkUInt32 AkAuxBusID
Auxilliary bus ID.
Definition: AkTypedefs.h:52
AKSOUNDENGINE_API AKRESULT RemoveGeometryInstance(AkGeometryInstanceID in_GeometryInstanceID)
float AkReal32
32-bit floating point
AKSOUNDENGINE_API AKRESULT SetImageSource(AkImageSourceID in_srcID, const AkImageSourceSettings &in_info, const char *in_name, AkUniqueID in_AuxBusID=AK_INVALID_AUX_ID, AkGameObjectID in_gameObjectID=AK_INVALID_GAME_OBJECT)
AKSOUNDENGINE_API AKRESULT SetGeometry(AkGeometrySetID in_GeomSetID, const AkGeometryParams &in_params)
Structure for retrieving information about the indirect paths of a sound that have been calculated vi...
AKSOUNDENGINE_API AKRESULT SetPortalToPortalObstruction(AkPortalID in_PortalID0, AkPortalID in_PortalID1, AkReal32 in_fObstruction)
AKSOUNDENGINE_API AKRESULT RemoveReverbZone(AkRoomID in_ReverbZone)
AKSOUNDENGINE_API AKRESULT SetMaxGlobalReflectionPaths(AkUInt32 in_uMaxGlobalReflectionPaths)
AKSOUNDENGINE_API AKRESULT SetDiffractionOrder(AkUInt32 in_uDiffractionOrder, bool in_bUpdatePaths)
AKSOUNDENGINE_API AKRESULT ClearImageSources(AkUniqueID in_AuxBusID=AK_INVALID_AUX_ID, AkGameObjectID in_gameObjectID=AK_INVALID_GAME_OBJECT)
AKSOUNDENGINE_API AKRESULT SetLoadBalancingSpread(AkUInt32 in_uNbFrames)
AKSOUNDENGINE_API AKRESULT SetGeometryInstance(AkGeometryInstanceID in_GeometryInstanceID, const AkGeometryInstanceParams &in_params)
AKSOUNDENGINE_API AKRESULT RemoveImageSource(AkImageSourceID in_srcID, AkUniqueID in_AuxBusID=AK_INVALID_AUX_ID, AkGameObjectID in_gameObjectID=AK_INVALID_GAME_OBJECT)
Initialization settings of the spatial audio module.
AKSOUNDENGINE_API AKRESULT UnsetGameObjectInRoom(AkGameObjectID in_gameObjectID)
AKSOUNDENGINE_API AKRESULT RemoveRoom(AkRoomID in_RoomID)
AKSOUNDENGINE_API AKRESULT SetReflectionsOrder(AkUInt32 in_uReflectionsOrder, bool in_bUpdatePaths)
Base type for ID's used by Wwise spatial audio.
Settings for individual image sources.
AKSOUNDENGINE_API AKRESULT SetPortal(AkPortalID in_PortalID, const AkPortalParams &in_Params, const char *in_PortalName=nullptr)
static const AkAuxBusID AK_INVALID_AUX_ID
Invalid auxiliary bus ID (or no Aux bus ID)
Definition: AkConstants.h:40
AKSOUNDENGINE_API AKRESULT ResetStochasticEngine()
Parameters passed to SetGeometryInstance.
AKRESULT
Definition: AkEnums.h:32
AKSOUNDENGINE_API AKRESULT SetPortalObstructionAndOcclusion(AkPortalID in_PortalID, AkReal32 in_fObstruction, AkReal32 in_fOcclusion, bool in_bTransition=false)
AKSOUNDENGINE_API AKRESULT SetGameObjectToPortalObstruction(AkGameObjectID in_gameObjectID, AkPortalID in_PortalID, AkReal32 in_fObstruction)
3D 64-bit vector. Intended as storage for world positions of sounds and objects, benefiting from 64-b...
Definition: Ak3DObjects.h:34
uint32_t AkUInt32
Unsigned 32-bit integer.
AKSOUNDENGINE_API AKRESULT SetAdjacentRoomBleed(AkReal32 in_fAdjacentRoomBleed)
AKSOUNDENGINE_API AKRESULT SetEarlyReflectionsVolume(AkGameObjectID in_gameObjectID, AkReal32 in_fSendVolume)
AKSOUNDENGINE_API AKRESULT RemoveGeometry(AkGeometrySetID in_SetID)
Parameters passed to SetRoom.
Parameters passed to SetGeometry.
AKSOUNDENGINE_API AKRESULT RegisterListener(AkGameObjectID in_gameObjectID)
AKSOUNDENGINE_API AKRESULT SetRoom(AkRoomID in_RoomID, const AkRoomParams &in_Params, const char *in_RoomName=nullptr)
AKSOUNDENGINE_API AKRESULT SetGameObjectRadius(AkGameObjectID in_gameObjectID, AkReal32 in_outerRadius, AkReal32 in_innerRadius)
AKSOUNDENGINE_API AKRESULT SetNumberOfPrimaryRays(AkUInt32 in_uNbPrimaryRays)

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise