Version
menu_open
link
Wwise SDK 2022.1.7
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) 2023 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 /// \file
28 /// Spatial Audio interface.
29 
30 #pragma once
31 
35 
36 
37 /// Initialization settings of the spatial audio module.
39 {
47  , fMaxPathLength(10000.0f)
48  , fCPULimitPercentage(0.0f)
52 
53  {}
54 
55  AkUInt32 uMaxSoundPropagationDepth; ///< Maximum number of portals that sound can propagate through; must be less than or equal to AK_MAX_SOUND_PROPAGATION_DEPTH.
56  AkReal32 fMovementThreshold; ///< Amount that an emitter or listener has to move to trigger a recalculation of reflections/diffraction. Larger values can reduce the CPU load at the cost of reduced accuracy.
57  AkUInt32 uNumberOfPrimaryRays; ///< The number of primary rays used in the ray tracing engine. A larger number of rays will increase the chances of finding reflection and diffraction paths, but will result in higher CPU usage. When CPU limit is active (see \ref AkSpatialAudioInitSettings::fCPULimitPercentage), this setting represents the maximum allowed number of primary rays.
58  AkUInt32 uMaxReflectionOrder; ///< Maximum reflection order [1, 4] - the number of 'bounces' in a reflection path. A high reflection order renders more details at the expense of higher CPU usage.
59  AkUInt32 uMaxDiffractionOrder; ///< Maximum diffraction order [1, 8] - the number of 'bends' in a diffraction path. A high diffraction order accommodates more complex geometry at the expense of higher CPU usage.
60  ///< Diffraction must be enabled on the geometry to find diffraction paths (refer to \c AkGeometryParams). Set to 0 to disable diffraction on all geometry.
61  ///< This parameter limits the recursion depth of diffraction rays cast from the listener to scan the environment, and also the depth of the diffraction search to find paths between emitter and listener.
62  ///< To optimize CPU usage, set it to the maximum number of edges you expect the obstructing geometry to traverse.
63  ///< For example, if box-shaped geometry is used exclusively, and only a single box is expected between an emitter and then listener, limiting \c uMaxDiffractionOrder to 2 may be sufficient.
64  ///< A diffraction path search starts from the listener, so when the maximum diffraction order is exceeded, the remaining geometry between the end of the path and the emitter is ignored.
65  ///< In such case, where the search is terminated before reaching the emitter, the diffraction coefficient will be underestimated. It is calculated from a partial path, ignoring any remaining geometry.
66  AkUInt32 uDiffractionOnReflectionsOrder; ///< The maximum possible number of diffraction points at each end of a reflection path. Diffraction on reflection allows reflections to fade in and out smoothly as the listener or emitter moves in and out of the reflection's shadow zone.
67  ///< When greater than zero, diffraction rays are sent from the listener to search for reflections around one or more corners from the listener.
68  ///< Diffraction must be enabled on the geometry to find diffracted reflections (refer to \c AkGeometryParams). Set to 0 to disable diffraction on reflections.
69  AkReal32 fMaxPathLength; ///< The total length of a path composed of a sequence of segments (or rays) cannot exceed the defined maximum path length. High values compute longer paths but increase the CPU cost.
70  ///< Each individual sound is also affected by its maximum attenuation distance, specified in the Authoring tool. Reflection or diffraction paths, calculated inside Spatial Audio, will never exceed a sound's maximum attenuation distance.
71  ///< Note, however, that attenuation is considered infinite if the furthest point is above the audibility threshold.
72  AkReal32 fCPULimitPercentage; ///< Defines the targeted computation time allocated for the ray tracing engine. Defined as a percentage [0, 100] of the current audio frame. The ray tracing engine dynamically adapts the number of primary rays to target the specified computation time value. In all circumstances, the computed number of primary rays cannot exceed the number of primary rays specified by AkSpatialAudioInitSettings::uNumberOfPrimaryRays.
73  ///< A value of 0 indicates no target has been set. In this case, the number of primary rays is fixed and is set by AkSpatialAudioInitSettings::uNumberOfPrimaryRays.
74  AkUInt32 uLoadBalancingSpread; ///< Spread the computation of paths on uLoadBalancingSpread frames [1..[. When uLoadBalancingSpread is set to 1, no load balancing is done. Values greater than 1 indicate the computation of paths will be spread on this number of frames.
75  bool bEnableGeometricDiffractionAndTransmission;///< Enable computation of geometric diffraction and transmission paths for all sources that have the <b>Enable Diffraction and Transmission</b> box checked in the Positioning tab of the Wwise Property Editor.
76  ///< This flag enables sound paths around (diffraction) and through (transmission) geometry (see \c AK::SpatialAudio::SetGeometry).
77  ///< Setting \c bEnableGeometricDiffractionAndTransmission to false implies that geometry is only to be used for reflection calculation.
78  ///< Diffraction edges must be enabled on geometry for diffraction calculation (see \c AkGeometryParams).
79  ///< If \c bEnableGeometricDiffractionAndTransmission is false but a sound has <b>Enable Diffraction and Transmission</b> selected in the Positioning tab of the authoring tool, the sound will diffract through portals but will pass through geometry as if it is not there.
80  ///< One would typically disable this setting in the case that the game intends to perform its own obstruction calculation, but geometry is still passed to spatial audio for reflection calculation.
81  bool bCalcEmitterVirtualPosition; ///< An emitter that is diffracted through a portal or around geometry will have its apparent or virtual position calculated by Wwise Spatial Audio and passed on to the sound engine.
82 };
83 
84 // Settings for individual image sources.
86 {
88 
89  AkImageSourceSettings(AkVector64 in_sourcePosition, AkReal32 in_fDistanceScalingFactor, AkReal32 in_fLevel)
90  : params(in_sourcePosition, in_fDistanceScalingFactor, in_fLevel)
91  , texture()
92  {
93  }
94 
95  void SetOneTexture(AkUniqueID in_texture)
96  {
97  texture.uNumTexture = 1;
98  texture.arTextureID[0] = in_texture;
99  }
100 
101  /// Image source parameters.
103 
104  /// Acoustic texture that goes with this image source.
106 };
107 
108 /// Vertex for a spatial audio mesh.
109 struct AkVertex
110 {
111  /// Constructor
112  AkVertex() : X(0.f), Y(0.f), Z(0.f) {}
113 
114  /// Constructor
115  AkVertex(AkReal32 in_X, AkReal32 in_Y, AkReal32 in_Z) : X(in_X), Y(in_Y), Z(in_Z) {}
116 
117  AkReal32 X; ///< X coordinate
118  AkReal32 Y; ///< Y coordinate
119  AkReal32 Z; ///< Z coordinate
120 };
121 
122 /// AkExtent describes an extent with width, height and depth. halfWidth, halfHeight and halfDepth should form a vector from the centre of the volume to the positive corner.
123 /// For portals, negative values in the extent will cause an error. For rooms, negative values can be used to opt out of room transmission.
124 struct AkExtent
125 {
126  AkExtent() {}
127 
128  AkExtent(AkReal32 in_halfWidth, AkReal32 in_halfHeight, AkReal32 in_halfDepth)
129  : halfWidth(in_halfWidth)
130  , halfHeight(in_halfHeight)
131  , halfDepth(in_halfDepth)
132  {}
133 
137 };
138 
139 /// Triangle for a spatial audio mesh.
140 struct AkTriangle
141 {
142  /// Constructor
147  {}
148 
149  /// Constructor
150  AkTriangle(AkVertIdx in_pt0, AkVertIdx in_pt1, AkVertIdx in_pt2, AkSurfIdx in_surfaceInfo)
151  : point0(in_pt0)
152  , point1(in_pt1)
153  , point2(in_pt2)
154  , surface(in_surfaceInfo)
155  {}
156 
157  /// Index into the vertex table passed into \c AkGeometryParams that describes the first vertex of the triangle. Triangles are double-sided, so vertex order in not important.
159 
160  /// Index into the vertex table passed into \c AkGeometryParams that describes the second vertex of the triangle. Triangles are double-sided, so vertex order in not important.
162 
163  /// Index into the vertex table passed into \c AkGeometryParams that describes the third vertex of the triangle. Triangles are double-sided, so vertex order in not important.
165 
166  /// Index into the surface table passed into \c AkGeometryParams that describes the surface properties of the triangle.
167  /// If this field is left as \c AK_INVALID_SURFACE, then a default-constructed \c AkAcousticSurface is used.
169 };
170 
171 /// Describes the acoustic surface properties of one or more triangles.
172 /// An single acoustic surface may describe any number of triangles, depending on the granularity desired. For example, if desired for debugging, one could create a unique
173 /// \c AkAcousticSurface struct for each triangle, and define a unique name for each. Alternatively, a single \c AkAcousticSurface could be used to describe all triangles.
174 /// In fact it is not necessary to define any acoustic surfaces at all. If the \c AkTriangle::surface field is left as \c AK_INVALID_SURFACE, then a default-constructed \c AkAcousticSurface is used.
176 {
177  /// Constructor
179  , transmissionLoss(1.0f)
180  , strName(NULL)
181  {}
182 
183  /// Acoustic texture ShareSet ID for the surface. The acoustic texture is authored in Wwise, and the shareset ID may be obtained by calling \c AK::SoundEngine::GetIDFromString
184  /// \sa <tt>\ref AK::SoundEngine::GetIDFromString()</tt>
186 
187  /// Value to set when modeling sound transmission through geometry. Transmission is modeled only when the sound emitted enables diffraction and there is no direct line of sight from the emitter to the listener.
188  /// If more that one surface is between the emitter and the listener, the maximum of each surface's transmission loss value is used. If the emitter and listener are in different rooms, then the rooms' transmission loss is taken into account.
189  /// The maximum of all the surfaces' transmission loss value, and the transmission loss value (see \c AkRoomParams) is used to render the transmission path.
190  /// Valid range: (0.f-1.f)
191  /// - \ref AkRoomParams
193 
194  /// Name to describe this surface
195  const char* strName;
196 };
197 
198 /// Structure for retrieving information about the indirect paths of a sound that have been calculated via the geometric reflections API. Useful for debug draw applications.
200 {
201  /// Apparent source of the reflected sound that follows this path.
203 
204  /// Vertices of the indirect path.
205  /// pathPoint[0] is closest to the emitter, pathPoint[numPathPoints-1] is closest to the listener.
207 
208  /// The surfaces that were hit in the path.
209  /// surfaces[0] is closest to the emitter, surfaces[numPathPoints-1] is closest to the listener.
211 
212  /// Number of valid elements in the \c pathPoint[], \c surfaces[], and \c diffraction[] arrays.
214 
215  /// Number of reflections in the \c pathPoint[] array. Shadow zone diffraction does not count as a reflection. If there is no shadow zone diffraction, \c numReflections is equal to \c numPathPoints.
217 
218  /// Diffraction amount, normalized to the range [0,1]
220 
221  /// Linear gain applied to image source.
223 
224  /// Deprecated - always false. Occluded paths are not generated.
226 };
227 
228 /// Structure for retrieving information about paths for a given emitter.
229 /// The diffraction paths represent indirect sound paths from the emitter to the listener, whether they go through portals
230 /// (via the rooms and portals API) or are diffracted around edges (via the geometric diffraction API).
231 /// The direct path is included here and can be identified by checking \c nodeCount == 0. The direct path may have a non-zero transmission loss
232 /// if it passes through geometry or between rooms.
234 {
235  /// Defines the maximum number of nodes that a user can retrieve information about. Longer paths will be truncated.
237 
238  /// Diffraction points along the path. nodes[0] is the point closest to the listener; nodes[numNodes-1] is the point closest to the emitter.
239  /// Neither the emitter position nor the listener position are represented in this array.
241 
242  /// Emitter position. This is the source position for an emitter. In all cases, except for radial emitters, it is the same position as the game object position.
243  /// For radial emitters, it is the calculated position at the edge of the volume.
245 
246  /// Raw diffraction angles at each point, in radians.
248 
249  /// ID of the portals that the path passes through. For a given node at position i (in the nodes array), if the path diffracts on a geometric edge, then portals[i] will be an invalid portal ID (ie. portals[i].IsValid() will return false).
250  /// Otherwise, if the path diffracts through a portal at position i, then portals[i] will be the ID of that portal.
251  /// portal[0] represents the node closest to the listener; portal[numNodes-1] represents the node closest to the emitter.
253 
254  /// ID's of the rooms that the path passes through. For a given node at position i, room[i] is the room on the listener's side of the node. If node i diffracts through a portal,
255  /// then rooms[i] is on the listener's side of the portal, and rooms[i+1] is on the emitters side of the portal.
256  /// There is always one extra slot for a room so that the emitters room is always returned in slot room[numNodes] (assuming the path has not been truncated).
258 
259  /// Virtual emitter position. This is the position that is passed to the sound engine to render the audio using multi-positioning, for this particular path.
261 
262  /// Total number of nodes in the path. Defines the number of valid entries in the \c nodes, \c angles, and \c portals arrays. The \c rooms array has one extra slot to fit the emitter's room.
264 
265  /// Calculated total diffraction from this path, normalized to the range [0,1]
266  /// The diffraction amount is calculated from the sum of the deviation angles from a straight line, of all angles at each nodePoint.
267  // Can be thought of as how far into the 'shadow region' the sound has to 'bend' to reach the listener.
268  /// This value is applied internally, by spatial audio, as the Diffraction value and built-in parameter of the emitter game object.
269  /// \sa
270  /// - \ref AkSpatialAudioInitSettings
272 
273  /// Calculated total transmission loss from this path, normalized to the range [0,1]
274  /// This field will be 0 for diffraction paths where \c nodeCount > 0. It may be non-zero for the direct path where \c nodeCount == 0.
275  /// The path's transmission loss value is the combination of the geometric transmission loss and the room transmission loss, by taking the greater of the two.
276  /// The geometric transmission loss is calculated from the transmission loss values assigned to the geometry that this path transmits through.
277  /// If a path transmits through multiple geometries with different transmission loss values, the largest value is taken.
278  /// The room transmission loss is taken from the emitter and listener rooms' transmission loss values, and likewise,
279  /// if the listener's room and the emitter's room have different transmission loss values, the greater of the two is used.
280  /// This value is applied internally, by spatial audio, as the Transmission Loss value and built-in parameter of the emitter game object.
281  /// \sa
282  /// - \ref AkSpatialAudioInitSettings
283  /// - \ref AkRoomParams
284  /// - \ref AkAcousticSurface
286 
287  /// Total path length
288  /// Represents the sum of the length of the individual segments between nodes, with a correction factor applied for diffraction.
289  /// The correction factor simulates the phenomenon where by diffracted sound waves decay faster than incident sound waves and can be customized in the spatial audio init settings.
290  /// \sa
291  /// - \ref AkSpatialAudioInitSettings
293 
294  /// Obstruction value for this path
295  /// This value includes the accumulated portal obstruction for all portals along the path.
297 };
298 
299 /// Parameters passed to \c SetPortal
301 {
302  /// Constructor
304  bEnabled(false)
305  {}
306 
307  /// Portal's position and orientation in the 3D world.
308  /// Position vector is the center of the opening.
309  /// OrientationFront vector must be unit-length and point along the normal of the portal, and must be orthogonal to Up. It defines the local positive-Z dimension (depth/transition axis) of the portal, used by Extent.
310  /// OrientationTop vector must be unit-length and point along the top of the portal (tangent to the wall), must be orthogonal to Front. It defines the local positive-Y direction (height) of the portal, used by Extent.
312 
313  /// Portal extent. Defines the dimensions of the portal relative to its center; all components must be positive numbers. The local right and up dimensions are used in diffraction calculations,
314  /// whereas the front dimension defines a depth value which is used to implement smooth transitions between rooms. It is recommended that users experiment with different portal depths to find a value
315  /// that results in appropriately smooth transitions between rooms. Extent dimensions must be positive.
317 
318  /// Whether or not the portal is active/enabled. For example, this parameter may be used to simulate open/closed doors.
319  /// Portal diffraction is simulated when at least one portal exists and is active between an emitter and the listener.
320  bool bEnabled;
321 
322  /// ID of the room to which the portal connects, in the direction of the Front vector. If a room with this ID has not been added via AK::SpatialAudio::SetRoom,
323  /// a room will be created with this ID and with default AkRoomParams. If you would later like to update the AkRoomParams, simply call AK::SpatialAudio::SetRoom again with this same ID.
324  /// - \ref AK::SpatialAudio::SetRoom
325  /// - \ref AK::SpatialAudio::RemoveRoom
326  /// - \ref AkRoomParams
328 
329  /// ID of the room to which the portal connects, in the direction opposite to the Front vector. If a room with this ID has not been added via AK::SpatialAudio::SetRoom,
330  /// a room will be created with this ID and with default AkRoomParams. If you would later like to update the AkRoomParams, simply call AK::SpatialAudio::SetRoom again with this same ID.
331  /// - \ref AK::SpatialAudio::SetRoom
332  /// - \ref AK::SpatialAudio::RemoveRoom
333  /// - \ref AkRoomParams
335 };
336 
337 /// Parameters passed to \c SetRoom
339 {
340  /// Constructor
342  , ReverbLevel(1.f)
343  , TransmissionLoss(1.f)
346  {
347  // default invalid values
348  Up.X = 0.f;
349  Up.Y = 1.f;
350  Up.Z = 0.f;
351  Front.X = 0.f;
352  Front.Y = 0.f;
353  Front.Z = 1.f;
354  }
355 
356  /// Room Orientation. Up and Front must be orthonormal.
357  /// Room orientation has an effect when the associated aux bus (see ReverbAuxBus) is set with 3D Spatialization in Wwise, as 3D Spatialization implements relative rotation of the emitter (room) and listener.
359 
360  /// Room Orientation. Up and Front must be orthonormal.
361  /// Room orientation has an effect when the associated aux bus (see ReverbAuxBus) is set with 3D Spatialization in Wwise, as 3D Spatialization implements relative rotation of the emitter (room) and listener.
363 
364  /// The reverb aux bus that is associated with this room.
365  /// When Spatial Audio is told that a game object is in a particular room via SetGameObjectInRoom, a send to this aux bus will be created to model the reverb of the room.
366  /// Using a combination of Rooms and Portals, Spatial Audio manages which game object the aux bus is spawned on, and what control gain is sent to the bus.
367  /// When a game object is inside a connected portal, as defined by the portal's orientation and extent vectors, both this aux send and the aux send of the adjacent room are active.
368  /// Spatial audio modulates the control value for each send based on the game object's position, in relation to the portal's z-azis and extent, to crossfade the reverb between the two rooms.
369  /// If more advanced control of reverb is desired, SetGameObjectAuxSendValues can be used to add additional sends on to a game object.
370  /// - \ref AK::SpatialAudio::SetGameObjectInRoom
371  /// - \ref AK::SoundEngine::SetGameObjectAuxSendValues
373 
374  /// The reverb control value for the send to ReverbAuxBus. Valid range: (0.f-1.f)
375  /// Can be used to implement multiple rooms that share the same aux bus, but have different reverb levels.
377 
378  /// Level to set when modeling transmission through walls. Transmission is modeled only when the sound emitted enables diffraction and there is no direct line of sight from the emitter to the listener.
379  /// This transmission loss value is only applied when the listener and the emitter are in different rooms; it is taken as the maximum between the emitter's room's transmission loss value and the listener's room's transmission loss value.
380  /// If there is geometry in between the listener and the emitter, then the transmission loss value assigned to surfaces hit by the ray between the emitter and listener is also taken into account.
381  /// The maximum of all the surfaces' transmission loss value (see \c AkAcousticSurface), and the room's transmission loss value is used to render the transmission path.
382  /// Valid range: (0.f-1.f)
383  /// - \ref AkAcousticSurface
385 
386  /// Send level for sounds that are posted on the room game object; adds reverb to ambience and room tones. Valid range: (0.f-1.f). Set to a value greater than 0 to have spatial audio create a send on the room game object,
387  /// where the room game object itself is specified as the listener and ReverbAuxBus is specified as the aux bus. A value of 0 disables the aux send. This should not be confused with ReverbLevel, which is the send level
388  /// for spatial audio emitters sending to the room game object.
389  /// \aknote The room game object can be accessed though the ID that is passed to \c SetRoom() and the \c AkRoomID::AsGameObjectID() method. Posting an event on the room game object leverages automatic room game object placement
390  /// by spatial audio so that when the listener is inside the room, the sound comes from all around the listener, and when the listener is outside the room, the sound comes from the portal(s). Typically, this would be used for
391  /// surround ambiance beds or room tones. Point source sounds should use separate game objects that are registered as spatial audio emitters.
392  /// \sa
393  /// - \ref AkRoomParams::RoomGameObj_KeepRegistered
394  /// - \ref AkRoomID
396 
397  /// If set to true, the room game object will be registered on calling \c SetRoom(), and not released untill the room is deleted or removed with \c RemoveRoom(). If set to false, spatial audio will register
398  /// the room object only when it is needed by the sound propagation system for the purposes of reverb, and will unregister the game object when all reverb tails have finished.
399  /// If the game intends to post events on the room game object for the purpose of ambiance or room tones, RoomGameObj_KeepRegistered should be set to true.
400  /// \aknote The room game object can be accessed though the ID that is passed to \c SetRoom() and the \c AkRoomID::AsGameObjectID() method. Posting an event on the room game object leverages automatic room game object placement
401  /// by spatial audio so that when the listener is inside the room, the sound comes from all around the listener, and when the listener is outside the room, the sound comes from the portal(s). Typically, this would be used for
402  /// surround ambiance beds or room tones. Point source sounds should use separate game objects that are registered as spatial audio emitters.
403  /// \sa
404  /// - \ref AkRoomParams::RoomGameObj_AuxSendLevelToSelf
405  /// - \ref AkRoomID
407 
408  /// Associate this room with the geometry instance \c GeometryInstanceID, describing the shape of the room. When a room is associated with a geometry instance, the vertices are used to compute the spread value for room transmission.
409  /// The vertices are used for computing an oriented bounding box for the room where the orientation of the bounding box is given by the Up and Front vectors. The center of the room is defined as the oriented bounding box center.
410  /// The extent of the bounding box is computed from the geometry set's vertices projected on to the orientation axes.
411  /// \aknote If the geometry set is only to be used for the room and not for reflection and diffraction calculation, then make sure to set \c AkGeometryParams::EnableTriangles to false.
412  /// It will still be necessary to create an instance for the geometry, so that the vertices can be positioned, scaled and rotated as desired.
413  /// \sa
414  /// - \ref spatial_audio_roomsportals_apiconfigroomgeometry
415  /// - \ref AkGeometryParams
417 };
418 
419 /// Parameters passed to \c SetGeometry
421 {
422  /// Constructor
424 
425  /// Pointer to an array of AkTriangle structures.
426  /// This array will be copied into spatial audio memory and will not be accessed after \c SetGeometry returns.
427  /// - \ref AkTriangle
428  /// - \ref AK::SpatialAudio::SetGeometry
429  /// - \ref AK::SpatialAudio::RemoveGeometry
431 
432  /// Number of triangles in Triangles.
434 
435  /// Pointer to an array of AkVertex structures.
436  /// This array will be copied into spatial audio memory and will not be accessed after \c SetGeometry returns.
437  /// - \ref AkVertex
438  /// - \ref AK::SpatialAudio::SetGeometry
439  /// - \ref AK::SpatialAudio::RemoveGeometry
441 
442  ///< Number of vertices in Vertices.
444 
445  ///< Pointer to an array of AkAcousticSurface structures.
446  /// This array will be copied into spatial audio memory and will not be accessed after \c SetGeometry returns.
447  /// - \ref AkVertex
448  /// - \ref AK::SpatialAudio::SetGeometry
449  /// - \ref AK::SpatialAudio::RemoveGeometry
451 
452  /// Number of of AkTriangleInfo structures in in_pTriangleInfo and number of AkTriIdx's in in_infoMap.
454 
455  /// Switch to enable or disable geometric diffraction for this Geometry.
457 
458  /// Switch to enable or disable geometric diffraction on boundary edges for this Geometry. Boundary edges are edges that are connected to only one triangle.
460 
461  /// Switch to enable or disable the use of the triangles for this Geometry. When enabled, the geometry triangles are indexed for ray computation and used to computed reflection and diffraction.
462  /// Set EnableTriangles to false when using a geometry set only to describe a room, and not for reflection and diffraction calculation.
463  /// \sa
464  /// - \ref AkRoomParams
466 };
467 
468 #define AK_DEFAULT_GEOMETRY_POSITION_X (0.0)
469 #define AK_DEFAULT_GEOMETRY_POSITION_Y (0.0)
470 #define AK_DEFAULT_GEOMETRY_POSITION_Z (0.0)
471 #define AK_DEFAULT_GEOMETRY_FRONT_X (0.0)
472 #define AK_DEFAULT_GEOMETRY_FRONT_Y (0.0)
473 #define AK_DEFAULT_GEOMETRY_FRONT_Z (1.0)
474 #define AK_DEFAULT_GEOMETRY_TOP_X (0.0)
475 #define AK_DEFAULT_GEOMETRY_TOP_Y (1.0)
476 #define AK_DEFAULT_GEOMETRY_TOP_Z (0.0)
477 
478 /// Parameters passed to \c SetGeometryInstance
480 {
481  /// Constructor
482  /// Creates an instance with an identity transform.
483  /// \akwarning A default-constructed AkGeometryInstanceParams assumes the default floor plane is passed to AkInitSettings::eFloorPlane.
485  : Scale({ 1, 1, 1 })
486  {
491  }
492 
493  /// Set the position and orientation of the geometry instance.
494  /// AkWorldTransform uses one vector to define the position of the geometry instance, and two more to define the orientation; a forward vector and an up vector.
495  /// To ensure that a geometry instance has the correct rotation with respect to the game, AkInitSettings::eFloorPlane must be initialized with the correct value.
496  /// \sa
497  /// - \ref AkInitSettings::eFloorPlane
498  /// - \ref AK::SpatialAudio::SetGeometryInstance
499  /// - \ref AK::SpatialAudio::RemoveGeometryInstance
501 
502  /// Set the 3-dimensional scaling of the geometry instance.
503  /// \sa
504  /// - \ref AK::SpatialAudio::SetGeometryInstance
505  /// - \ref AK::SpatialAudio::RemoveGeometryInstance
507 
508  /// Geometry set referenced by the instance
509  /// \sa
510  /// - \ref AK::SpatialAudio::SetGeometry
511  /// - \ref AK::SpatialAudio::RemoveGeometry
512  /// - \ref AK::SpatialAudio::SetGeometryInstance
513  /// - \ref AK::SpatialAudio::RemoveGeometryInstance
515 
516  /// Associate this geometry instance with the room \c RoomID. Associating a geometry instance with a particular room will limit the scope in which the geometry is visible/accessible. \c RoomID can be left as default (-1), in which case
517  /// this geometry instance will have a global scope. It is recommended to associate geometry with a room when the geometry is (1) fully contained within the room (ie. not visible to other rooms accept by portals),
518  /// and (2) the room does not share geometry with other rooms. Doing so reduces the search space for ray casting performed by reflection and diffraction calculations. Take note that once one or more geometry instances
519  /// are associated with a room, that room will no longer be able to access geometry that is in the global scope.
520  /// - \ref AK::SpatialAudio::SetRoom
521  /// - \ref AkRoomParams
523 };
524 
525 /// Audiokinetic namespace
526 namespace AK
527 {
528  /// Audiokinetic spatial audio namespace
529  namespace SpatialAudio
530  {
531  ////////////////////////////////////////////////////////////////////////
532  /// @name Basic functions.
533  /// In order to use SpatialAudio, you need to initalize it using Init, and register the listeners that you plan on using with any of the services offered by SpatialAudio, using
534  /// RegisterListener respectively, _after_ having registered their corresponding game object to the sound engine.
535  /// \akwarning At the moment, there can be only one Spatial Audio listener registered at any given time.
536  //@{
537 
538  /// Initialize the SpatialAudio API.
540 
541  /// 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.
542  /// 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.
543  /// If not listener is explicitly registered to spatial audio, then a default listener (set via \c AK::SoundEngine::SetDefaultListeners()) is selected. If the are no default listeners, or there are more than one
544  /// default listeners, then it is necessary to call RegisterListener() to specify which listener to use with Spatial Audio.
546  AkGameObjectID in_gameObjectID ///< Game object ID
547  );
548 
549  /// Unregister a game object as a listener in the SpatialAudio API; clean up Spatial Audio listener data associated with in_gameObjectID.
550  /// If in_gameObjectID is the current registered listener, calling this function will clear the Spatial Audio listener and
551  /// Spatial Audio features will be disabled until another listener is registered.
552  /// This function is optional - listener are automatically unregistered when their game object is deleted in the sound engine.
553  /// \sa
554  /// - \ref AK::SpatialAudio::RegisterListener
556  AkGameObjectID in_gameObjectID ///< Game object ID
557  );
558 
559  /// Define a inner and outer radius around each sound position for a specified game object.
560  /// The radii are used in spread and distance calculations, simulating a radial sound source.
561  /// When applying attenuation curves, the distance between the listener and the inner sphere (defined by the sound position and \c in_innerRadius) is used.
562  /// The spread for each sound position is calculated as follows:
563  /// - If the listener is outside the outer radius, then the spread is defined by the area that the sphere takes 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.
564  /// - 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%.
565  /// - When the listener is in between the inner and outer radius, the spread interpolates linearly from 50% to 100% as the listener transitions from the outer radius towards the inner radius.
566  /// - If the listener is inside the inner radius, the spread is 100%.
567  /// \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.
568  /// To obtain accurate diffraction and transmission calculations for radial sources, where different parts of the volume may take different paths through or around geometry,
569  /// it is necessary to pass multiple sound positions into \c AK::SoundEngine::SetMultiplePositions to allow the engine to 'sample' the area at different points.
570  /// - \ref AK::SoundEngine::SetPosition
571  /// - \ref AK::SoundEngine::SetMultiplePositions
573  AkGameObjectID in_gameObjectID, ///< Game object ID
574  AkReal32 in_outerRadius, ///< Outer radius around each sound position, defining 50% spread. Must satisfy \c in_innerRadius <= \c in outerRadius.
575  AkReal32 in_innerRadius ///< Inner radius around each sound position, defining 100% spread and 0 attenuation distance. Must satisfy \c in_innerRadius <= \c in outerRadius.
576  );
577 
578  //@}
579 
580  ////////////////////////////////////////////////////////////////////////
581  /// @name Helper functions for passing game data to the Reflect plug-in.
582  /// Use this API for detailed placement of reflection image sources.
583  /// \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.
584  /// Functions of Geometry are preferred and easier to use with the Reflect plug-in. \endaknote
585  //@{
586 
587  /// Add or update an individual image source for processing via the AkReflect plug-in. Use this API for detailed placement of
588  /// 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
589  /// 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.
590  /// 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.
591  /// 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.
592  /// \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.
593  /// 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.
594  /// \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.
595  /// 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.
596  /// 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.
597  /// \endaknote
598  /// \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
599  /// \sa
600  /// - \ref AK::SpatialAudio::RemoveImageSource
601  /// - \ref AK::SpatialAudio::ClearImageSources
602  /// - \ref AK::SpatialAudio::SetGameObjectInRoom
603  /// - \ref AK::SpatialAudio::SetEarlyReflectionsAuxSend
605  AkImageSourceID in_srcID, ///< The ID of the image source being added.
606  const AkImageSourceSettings& in_info, ///< Image source information.
607  const char* in_name, ///< Name given to image source, can be used to identify the image source in the AK Reflect plugin UI.
608  AkUniqueID in_AuxBusID = AK_INVALID_AUX_ID, ///< Aux bus that has the AkReflect plug in for early reflection DSP.
609  ///< Pass AK_INVALID_AUX_ID to use the reflections aux bus defined in the authoring tool.
610  AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT ///< The ID of the emitter game object to which the image source applies.
611  ///< Pass AK_INVALID_GAME_OBJECT to apply to all game objects that have a reflections aux bus assigned in the authoring tool.
612  );
613 
614  /// Remove an individual reflection image source that was previously added via \c SetImageSource.
615  /// \sa
616  /// - \ref AK::SpatialAudio::SetImageSource
617  /// - \ref AK::SpatialAudio::ClearImageSources
619  AkImageSourceID in_srcID, ///< The ID of the image source to remove.
620  AkUniqueID in_AuxBusID = AK_INVALID_AUX_ID, ///< Aux bus that was passed to SetImageSource.
621  AkGameObjectID in_gameObjectID = AK_INVALID_GAME_OBJECT ///< Game object ID that was passed to SetImageSource.
622  );
623 
624  /// Remove all image sources matching \c in_AuxBusID and \c in_gameObjectID that were previously added via \c SetImageSource.
625  /// 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.
626  /// \sa
627  /// - \ref AK::SpatialAudio::SetImageSource
628  /// - \ref AK::SpatialAudio::RemoveImageSource
630  AkUniqueID in_AuxBusID = AK_INVALID_AUX_ID, ///< Aux bus that was passed to SetImageSource, or AK_INVALID_AUX_ID to match all aux buses.
631  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.
632  );
633 
634  //@}
635 
636  ////////////////////////////////////////////////////////////////////////
637  /// @name Geometry
638  /// Geometry API for early reflection processing using Reflect.
639  //@{
640 
641  /// 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,
642  /// 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.
643  /// It is necessary to create at least one geometry instance for each geometry set that is to be used for diffraction and reflection simulation.
644  /// \sa
645  /// - \ref AkGeometryParams
646  /// - \ref AK::SpatialAudio::SetGeometryInstance
647  /// - \ref AK::SpatialAudio::RemoveGeometry
649  AkGeometrySetID in_GeomSetID, ///< Unique geometry set ID, chosen by client.
650  const AkGeometryParams& in_params ///< Geometry parameters to set.
651  );
652 
653  /// Remove a set of geometry to the SpatialAudio API.
654  /// Calling \c AK::SpatialAudio::RemoveGeometry will remove all instances of the geometry from the scene.
655  /// \sa
656  /// - \ref AK::SpatialAudio::SetGeometry
658  AkGeometrySetID in_SetID ///< ID of geometry set to be removed.
659  );
660 
661  /// Add or update a geometry instance from the \c SpatialAudio module for geometric reflection and diffraction processing.
662  /// A geometry instance is a unique instance of a geometry set with a specified transform (position, rotation and scale).
663  /// It is necessary to create at least one geometry instance for each geometry set that is to be used for diffraction and reflection simulation.
664  /// 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.
665  /// To update the transform of an existing geometry instance, call SetGeometryInstance again, passing the same \c AkGeometryInstanceID, with the updated transform.
666  /// \sa
667  /// - \ref AkGeometryInstanceParams
668  /// - \ref AK::SpatialAudio::RemoveGeometryInstance
670  AkGeometryInstanceID in_GeometryInstanceID, ///< Unique geometry set instance ID, chosen by client.
671  const AkGeometryInstanceParams& in_params ///< Geometry instance parameters to set.
672  );
673 
674  /// Remove a geometry instance from the SpatialAudio API.
675  /// \sa
676  /// - \ref AK::SpatialAudio::SetGeometryInstance
678  AkGeometryInstanceID in_GeometryInstanceID ///< ID of geometry set instance to be removed.
679  );
680 
681  /// 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.
682  /// This function must acquire the global sound engine lock and therefore, may block waiting for the lock.
683  /// \sa
684  /// - \ref AkReflectionPathInfo
686  AkGameObjectID in_gameObjectID, ///< The ID of the game object that the client wishes to query.
687  AkUInt32 in_positionIndex, ///< The index of the associated game object position.
688  AkVector64& out_listenerPos, ///< Returns the position of the listener game object that is associated with the game object \c in_gameObjectID.
689  AkVector64& out_emitterPos, ///< Returns the position of the emitter game object \c in_gameObjectID.
690  AkReflectionPathInfo* out_aPaths, ///< Pointer to an array of \c AkReflectionPathInfo's which will be filled after returning.
691  AkUInt32& io_uArraySize ///< The number of slots in \c out_aPaths, after returning the number of valid elements written.
692  );
693 
694  //@}
695 
696  ////////////////////////////////////////////////////////////////////////
697  /// @name Rooms and Portals
698  /// Sound Propagation API using rooms and portals.
699  //@{
700 
701  /// 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.
702  /// \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
703  /// registration/unregistration of internal game objects for rooms that use these IDs and, therefore, must not collide.
704  /// 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)
705  /// in order to customize its AkRoomParams, to provide a valid auxiliary bus, for example.\endakwarning
706  /// \sa
707  /// - \ref AkRoomID
708  /// - \ref AkRoomParams
709  /// - \ref AK::SpatialAudio::RemoveRoom
711  AkRoomID in_RoomID, ///< Unique room ID, chosen by the client.
712  const AkRoomParams& in_Params, ///< Parameter for the room.
713  const char* in_RoomName = nullptr /// Name used to identify room (optional)
714  );
715 
716  /// Remove a room.
717  /// \sa
718  /// - \ref AkRoomID
719  /// - \ref AK::SpatialAudio::SetRoom
721  AkRoomID in_RoomID ///< Room ID that was passed to \c SetRoom.
722  );
723 
724  /// 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.
725  /// 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,
726  /// 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.
727  /// \sa
728  /// - \ref AkPortalID
729  /// - \ref AkPortalParams
730  /// - \ref AK::SpatialAudio::RemovePortal
732  AkPortalID in_PortalID, ///< Unique portal ID, chosen by the client.
733  const AkPortalParams& in_Params, ///< Parameter for the portal.
734  const char* in_PortalName = nullptr /// Name used to identify portal (optional)
735  );
736 
737  /// Remove a portal.
738  /// \sa
739  /// - \ref AkPortalID
740  /// - \ref AK::SpatialAudio::SetPortal
742  AkPortalID in_PortalID ///< ID of portal to be removed, which was originally passed to SetPortal.
743  );
744 
745  /// 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.
746  /// 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
747  /// 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
748  /// audio.
749  /// \sa
750  /// - \ref AK::SpatialAudio::SetRoom
751  /// - \ref AK::SpatialAudio::RemoveRoom
753  AkGameObjectID in_gameObjectID, ///< Game object ID
754  AkRoomID in_CurrentRoomID ///< RoomID that was passed to \c AK::SpatialAudio::SetRoom
755  );
756 
757  /// Set the early reflections order for reflection calculation. The reflections order indicates the number of times sound can bounce off of a surface.
758  /// A higher number requires more CPU resources but results in denser early reflections. Set to 0 to globally disable reflections processing.
760  AkUInt32 in_uReflectionsOrder, ///< Number of reflections to calculate. Valid range [0,4]
761  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.
762  );
763 
764  /// Set the diffraction order for geometric path calculation. The diffraction order indicates the number of edges a sound can diffract around.
765  /// 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.
766  /// \sa
767  /// - \ref AkSpatialAudioInitSettings::uMaxDiffractionOrder
769  AkUInt32 in_uDiffractionOrder, ///< Number of diffraction edges to consider in path calculations. Valid range [0,8]
770  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.
771  );
772 
773  /// Set the number of rays cast from the listener by the stochastic ray casting engine.
774  /// A higher number requires more CPU resources but provides more accurate results. Default value (100) should be good for most applications.
775  ///
777  AkUInt32 in_uNbPrimaryRays ///< Number of rays cast from the listener
778  );
779 
780  /// Set the number of frames on which the path validation phase will be spread. Value between [1..[
781  /// High values delay the validation of paths. A value of 1 indicates no spread at all.
782  ///
784  AkUInt32 in_uNbFrames ///< Number of spread frames
785  );
786 
787  /// Set an early reflections auxiliary bus for a particular game object.
788  /// 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,
789  /// or if an aux bus is specified via \c SetEarlyReflectionsAuxSend.
790  /// 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 -
791  /// the parameter specified on individual sounds' reflection bus takes priority over the value passed in to \c SetEarlyReflectionsAuxSend.
792  /// \aknote
793  /// Users may apply this function to avoid duplicating sounds in the actor-mixer hierarchy solely for the sake of specifying a unique early reflection bus, or in any situation where the same
794  /// 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
796  AkGameObjectID in_gameObjectID, ///< Game object ID
797  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.
798  );
799 
800  /// Set an early reflections send volume for a particular game object.
801  /// 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
802  /// playing on the game object.
803  /// Setting \c in_fSendVolume to 0.f will disable all reflection processing for this game object.
805  AkGameObjectID in_gameObjectID, ///< Game object ID
806  AkReal32 in_fSendVolume ///< Send volume (linear) for auxiliary send. Set 0.f to disable reflection processing. Valid range 0.f-1.f.
807  );
808 
809  /// Set the obstruction and occlusion value for a portal that has been registered with Spatial Audio.
810  /// Portal obstruction is used to simulate objects between the portal and the listener that are obstructing the sound coming from the portal.
811  /// The obstruction value affects only the portals dry path, and should relate to how much of the opening
812  /// is obstructed, and must be calculated by the client. It is applied to the room's game object, as well as to all the emitters virtual positions
813  /// which propagate from that room through this portal.
814  /// Portal occlusion is applied only on the room game object, and affects both the wet and dry path of the signal emitted from the room's bus.
816  AkPortalID in_PortalID, ///< Portal ID.
817  AkReal32 in_fObstruction, ///< Obstruction value. Valid range 0.f-1.f
818  AkReal32 in_fOcclusion ///< Occlusion value. Valid range 0.f-1.f
819  );
820 
821  /// Set the obstruction value of the path between a game object and a portal that has been created by Spatial Audio.
822  /// The obstruction value is applied on one of the path segments of the sound between the emitter and the listener.
823  /// Diffraction must be enabled on the sound for a diffraction path to be created.
824  /// Also, there should not be any portals between the provided game object and portal ID parameters.
825  /// The obstruction value is used to simulate objects between the portal and the game object that are obstructing the sound.
826  /// Send an obstruction value of 0 to ensure the value is removed from the internal data structure.
828  AkGameObjectID in_gameObjectID, ///< Game object ID
829  AkPortalID in_PortalID, ///< Portal ID
830  AkReal32 in_fObstruction ///< Obstruction value. Valid range 0.f-1.f
831  );
832 
833  /// Set the obstruction value of the path between two portals that has been created by Spatial Audio.
834  /// The obstruction value is applied on one of the path segments of the sound between the emitter and the listener.
835  /// Diffraction must be enabled on the sound for a diffraction path to be created.
836  /// Also, there should not be any portals between the two provided ID parameters.
837  /// The obstruction value is used to simulate objects between the portals that are obstructing the sound.
838  /// Send an obstruction value of 0 to ensure the value is removed from the internal data structure.
840  AkPortalID in_PortalID0, ///< Portal ID
841  AkPortalID in_PortalID1, ///< Portal ID
842  AkReal32 in_fObstruction ///< Obstruction value. Valid range 0.f-1.f
843  );
844 
845  /// 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].
846  /// The wet diffraction is calculated from how far into the 'shadow region' the listener is from the portal. Unlike dry diffraction, the
847  /// wet diffraction does not depend on the incident angle, but only the normal of the portal.
848  /// This value is applied by spatial audio, to the Diffraction value and built-in game parameter of the room game object that is
849  /// on the other side of the portal (relative to the listener).
850  /// This function must acquire the global sound engine lock and therefore, may block waiting for the lock.
851  /// \sa
852  /// - \ref AkSpatialAudioInitSettings
854  AkPortalID in_portal, ///< The ID of the game object that the client wishes to query.
855  AkReal32& out_wetDiffraction ///< The number of slots in \c out_aPaths, after returning the number of valid elements written.
856  );
857 
858  /// 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.
859  /// 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.
860  /// 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,
861  /// or (3) The emitter and listener are in different rooms, but there are no paths found via portals between the emitter and the listener.
862  /// 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.
863  /// This function must acquire the global sound engine lock and, therefore, may block waiting for the lock.
864  /// \sa
865  /// - \ref AkDiffractionPathInfo
867  AkGameObjectID in_gameObjectID, ///< The ID of the game object that the client wishes to query.
868  AkUInt32 in_positionIndex, ///< The index of the associated game object position.
869  AkVector64& out_listenerPos, ///< Returns the position of the listener game object that is associated with the game object \c in_gameObjectID.
870  AkVector64& out_emitterPos, ///< Returns the position of the emitter game object \c in_gameObjectID.
871  AkDiffractionPathInfo* out_aPaths, ///< Pointer to an array of \c AkDiffractionPathInfo's which will be filled on return.
872  AkUInt32& io_uArraySize ///< The number of slots in \c out_aPaths, after returning the number of valid elements written.
873  );
874 
875  /// Reset the stochastic engine state by re-initializing the random seeds.
876  ///
878 
879  //@}
880  }
881 };
AkGeometrySetID GeometryInstanceID
Definition: AkSpatialAudio.h:416
bool RoomGameObj_KeepRegistered
Definition: AkSpatialAudio.h:406
AKSOUNDENGINE_API AKRESULT QueryWetDiffraction(AkPortalID in_portal, AkReal32 &out_wetDiffraction)
AkUInt16 AkTriIdx
AKSOUNDENGINE_API AKRESULT UnregisterListener(AkGameObjectID in_gameObjectID)
Triangle for a spatial audio mesh.
Definition: AkSpatialAudio.h:141
AkUInt32 numPathPoints
Number of valid elements in the pathPoint[], surfaces[], and diffraction[] arrays.
Definition: AkSpatialAudio.h:213
AkVertex(AkReal32 in_X, AkReal32 in_Y, AkReal32 in_Z)
Constructor.
Definition: AkSpatialAudio.h:115
AkImageSourceParams params
Image source parameters.
Definition: AkSpatialAudio.h:102
Parameters passed to SetPortal.
Definition: AkSpatialAudio.h:301
Audiokinetic namespace.
AkReal32 TransmissionLoss
Definition: AkSpatialAudio.h:384
AKSOUNDENGINE_API AKRESULT RemovePortal(AkPortalID in_PortalID)
AkVector Front
Definition: AkSpatialAudio.h:358
bool EnableTriangles
Definition: AkSpatialAudio.h:465
AkTriIdx NumTriangles
Number of triangles in Triangles.
Definition: AkSpatialAudio.h:433
AkVector Up
Definition: AkSpatialAudio.h:362
bool bEnableGeometricDiffractionAndTransmission
Definition: AkSpatialAudio.h:75
void Set(const AkVector64 &in_position, const AkVector &in_orientationFront, const AkVector &in_orientationTop)
Set position and orientation. Orientation front and top should be orthogonal and normalized.
Definition: AkTypes.h:503
AkReal32 transmissionLoss
Definition: AkSpatialAudio.h:192
AkVertIdx point2
Index into the vertex table passed into AkGeometryParams that describes the third vertex of the trian...
Definition: AkSpatialAudio.h:164
AkReal32 RoomGameObj_AuxSendLevelToSelf
Definition: AkSpatialAudio.h:395
AKSOUNDENGINE_API AKRESULT SetGameObjectInRoom(AkGameObjectID in_gameObjectID, AkRoomID in_CurrentRoomID)
AkAcousticSurface()
Constructor.
Definition: AkSpatialAudio.h:178
AkTriangle(AkVertIdx in_pt0, AkVertIdx in_pt1, AkVertIdx in_pt2, AkSurfIdx in_surfaceInfo)
Constructor.
Definition: AkSpatialAudio.h:150
AkReal32 Z
Z coordinate.
Definition: AkSpatialAudio.h:119
AkReal32 halfDepth
Definition: AkSpatialAudio.h:136
AKSOUNDENGINE_API AKRESULT Init(const AkSpatialAudioInitSettings &in_initSettings)
Initialize the SpatialAudio API.
#define AK_DEFAULT_GEOMETRY_POSITION_Z
Definition: AkSpatialAudio.h:470
AkPortalParams()
Constructor.
Definition: AkSpatialAudio.h:303
#define AK_DEFAULT_GEOMETRY_FRONT_Y
Definition: AkSpatialAudio.h:472
AkAuxBusID ReverbAuxBus
Definition: AkSpatialAudio.h:372
#define AK_INVALID_VERTEX
AkUInt32 textureID
Definition: AkSpatialAudio.h:185
AkRoomID FrontRoom
Definition: AkSpatialAudio.h:327
AkUInt32 uLoadBalancingSpread
Spread the computation of paths on uLoadBalancingSpread frames [1..[. When uLoadBalancingSpread is se...
Definition: AkSpatialAudio.h:74
AKSOUNDENGINE_API AKRESULT QueryDiffractionPaths(AkGameObjectID in_gameObjectID, AkUInt32 in_positionIndex, AkVector64 &out_listenerPos, AkVector64 &out_emitterPos, AkDiffractionPathInfo *out_aPaths, AkUInt32 &io_uArraySize)
AkRoomParams()
Constructor.
Definition: AkSpatialAudio.h:341
AkUInt32 nodeCount
Total number of nodes in the path. Defines the number of valid entries in the nodes,...
Definition: AkSpatialAudio.h:263
AkUInt64 AkGameObjectID
Game object ID.
Definition: AkTypes.h:128
#define AK_EXTERNAPIFUNC(_type, _name)
AKSOUNDENGINE_API AKRESULT SetEarlyReflectionsAuxSend(AkGameObjectID in_gameObjectID, AkAuxBusID in_auxBusID)
AkUInt32 uNumTexture
Number of valid textures in the texture array.
AKRESULT
Standard function call result.
Definition: AkTypes.h:199
const char * strName
Name to describe this surface.
Definition: AkSpatialAudio.h:195
AkUInt32 uDiffractionOnReflectionsOrder
Definition: AkSpatialAudio.h:66
AkVector64 nodes[kMaxNodes]
Definition: AkSpatialAudio.h:240
AkAcousticSurface surfaces[AK_MAX_REFLECTION_PATH_LENGTH]
Definition: AkSpatialAudio.h:210
AkWorldTransform Transform
Definition: AkSpatialAudio.h:311
AkUInt32 AkImageSourceID
Image Source ID.
Definition: AkTypes.h:152
AkVector64 pathPoint[AK_MAX_REFLECTION_PATH_LENGTH]
Definition: AkSpatialAudio.h:206
#define AK_DEFAULT_GEOMETRY_FRONT_X
Definition: AkSpatialAudio.h:471
AkAcousticSurface * Surfaces
Definition: AkSpatialAudio.h:450
AkReal32 X
X coordinate.
Definition: AkSpatialAudio.h:117
AkReal32 fCPULimitPercentage
Definition: AkSpatialAudio.h:72
AKSOUNDENGINE_API AKRESULT QueryReflectionPaths(AkGameObjectID in_gameObjectID, AkUInt32 in_positionIndex, AkVector64 &out_listenerPos, AkVector64 &out_emitterPos, AkReflectionPathInfo *out_aPaths, AkUInt32 &io_uArraySize)
AkVertIdx NumVertices
Definition: AkSpatialAudio.h:443
AKSOUNDENGINE_API AKRESULT RemoveGeometryInstance(AkGeometryInstanceID in_GeometryInstanceID)
#define NULL
Definition: AkTypes.h:46
AkReal32 ReverbLevel
Definition: AkSpatialAudio.h:376
float AkReal32
32-bit floating point
Definition: AkNumeralTypes.h:46
AkUInt16 AkSurfIdx
AkReal32 halfHeight
Definition: AkSpatialAudio.h:135
Position and orientation of game objects in the world (i.e. supports 64-bit-precision position)
Definition: AkTypes.h:474
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...
Definition: AkSpatialAudio.h:200
AkSurfIdx surface
Definition: AkSpatialAudio.h:168
AKSOUNDENGINE_API AKRESULT SetPortalToPortalObstruction(AkPortalID in_PortalID0, AkPortalID in_PortalID1, AkReal32 in_fObstruction)
bool isOccluded
Deprecated - always false. Occluded paths are not generated.
Definition: AkSpatialAudio.h:225
AKSOUNDENGINE_API AKRESULT SetDiffractionOrder(AkUInt32 in_uDiffractionOrder, bool in_bUpdatePaths)
AkReal32 Y
Y Position.
Definition: AkTypes.h:468
bool bCalcEmitterVirtualPosition
An emitter that is diffracted through a portal or around geometry will have its apparent or virtual p...
Definition: AkSpatialAudio.h:81
AkUInt32 AkUniqueID
Unique 32-bit ID.
Definition: AkTypes.h:120
void SetOneTexture(AkUniqueID in_texture)
Definition: AkSpatialAudio.h:95
AkUInt32 uMaxDiffractionOrder
Definition: AkSpatialAudio.h:59
AkReal32 angles[kMaxNodes]
Raw diffraction angles at each point, in radians.
Definition: AkSpatialAudio.h:247
#define AK_DEFAULT_GEOMETRY_TOP_Z
Definition: AkSpatialAudio.h:476
AkReal32 X
X Position.
Definition: AkTypes.h:467
AkReal32 Y
Y coordinate.
Definition: AkSpatialAudio.h:118
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)
AkVector64 imageSource
Apparent source of the reflected sound that follows this path.
Definition: AkSpatialAudio.h:202
AKSOUNDENGINE_API AKRESULT SetGeometryInstance(AkGeometryInstanceID in_GeometryInstanceID, const AkGeometryInstanceParams &in_params)
AkRoomID BackRoom
Definition: AkSpatialAudio.h:334
AkVector64 emitterPos
Definition: AkSpatialAudio.h:244
AkPortalID portals[kMaxNodes]
Definition: AkSpatialAudio.h:252
#define AK_DEFAULT_GEOMETRY_POSITION_X
Definition: AkSpatialAudio.h:468
AkTriangle * Triangles
Definition: AkSpatialAudio.h:430
AkExtent Extent
Definition: AkSpatialAudio.h:316
AkReal32 transmissionLoss
Definition: AkSpatialAudio.h:285
AkUInt32 uNumberOfPrimaryRays
The number of primary rays used in the ray tracing engine. A larger number of rays will increase the ...
Definition: AkSpatialAudio.h:57
AkReal32 Z
Z Position.
Definition: AkTypes.h:469
AkUInt32 uMaxReflectionOrder
Maximum reflection order [1, 4] - the number of 'bounces' in a reflection path. A high reflection ord...
Definition: AkSpatialAudio.h:58
#define AK_DEFAULT_GEOMETRY_TOP_X
Definition: AkSpatialAudio.h:474
AKSOUNDENGINE_API AKRESULT RemoveImageSource(AkImageSourceID in_srcID, AkUniqueID in_AuxBusID=AK_INVALID_AUX_ID, AkGameObjectID in_gameObjectID=AK_INVALID_GAME_OBJECT)
AkTriangle()
Constructor.
Definition: AkSpatialAudio.h:143
Initialization settings of the spatial audio module.
Definition: AkSpatialAudio.h:39
Vertex for a spatial audio mesh.
Definition: AkSpatialAudio.h:110
AkReal32 diffraction[AK_MAX_REFLECTION_PATH_LENGTH]
Diffraction amount, normalized to the range [0,1].
Definition: AkSpatialAudio.h:219
#define AK_MAX_REFLECTION_PATH_LENGTH
AKSOUNDENGINE_API AKRESULT RemoveRoom(AkRoomID in_RoomID)
AkVertex()
Constructor.
Definition: AkSpatialAudio.h:112
AKSOUNDENGINE_API AKRESULT SetReflectionsOrder(AkUInt32 in_uReflectionsOrder, bool in_bUpdatePaths)
AkVertIdx point0
Index into the vertex table passed into AkGeometryParams that describes the first vertex of the trian...
Definition: AkSpatialAudio.h:158
Base type for ID's used by Wwise spatial audio.
AkUInt32 numReflections
Number of reflections in the pathPoint[] array. Shadow zone diffraction does not count as a reflectio...
Definition: AkSpatialAudio.h:216
static const AkUniqueID AK_INVALID_UNIQUE_ID
Invalid unique 32-bit ID.
Definition: AkTypes.h:163
AKSOUNDENGINE_API AKRESULT SetPortal(AkPortalID in_PortalID, const AkPortalParams &in_Params, const char *in_PortalName=nullptr)
AKSOUNDENGINE_API AKRESULT ResetStochasticEngine()
bool EnableDiffraction
Switch to enable or disable geometric diffraction for this Geometry.
Definition: AkSpatialAudio.h:456
Parameters passed to SetGeometryInstance.
Definition: AkSpatialAudio.h:480
AkSurfIdx NumSurfaces
Number of of AkTriangleInfo structures in in_pTriangleInfo and number of AkTriIdx's in in_infoMap.
Definition: AkSpatialAudio.h:453
AkReal32 level
Linear gain applied to image source.
Definition: AkSpatialAudio.h:222
AkWorldTransform virtualPos
Virtual emitter position. This is the position that is passed to the sound engine to render the audio...
Definition: AkSpatialAudio.h:260
#define AK_DEFAULT_GEOMETRY_TOP_Y
Definition: AkSpatialAudio.h:475
static const AkUInt32 kMaxNodes
Defines the maximum number of nodes that a user can retrieve information about. Longer paths will be ...
Definition: AkSpatialAudio.h:236
#define AK_DEFAULT_GEOMETRY_POSITION_Y
Definition: AkSpatialAudio.h:469
AKSOUNDENGINE_API AKRESULT SetGameObjectToPortalObstruction(AkGameObjectID in_gameObjectID, AkPortalID in_PortalID, AkReal32 in_fObstruction)
AkReal32 fMovementThreshold
Amount that an emitter or listener has to move to trigger a recalculation of reflections/diffraction....
Definition: AkSpatialAudio.h:56
AkRoomID rooms[kMaxNodes+1]
Definition: AkSpatialAudio.h:257
AkReal32 halfWidth
Definition: AkSpatialAudio.h:134
bool EnableDiffractionOnBoundaryEdges
Switch to enable or disable geometric diffraction on boundary edges for this Geometry....
Definition: AkSpatialAudio.h:459
static const AkGameObjectID AK_INVALID_GAME_OBJECT
Invalid game object (may also mean all game objects)
Definition: AkTypes.h:162
3D 64-bit vector. Intended as storage for world positions of sounds and objects, benefiting from 64-b...
Definition: AkTypes.h:390
AkExtent(AkReal32 in_halfWidth, AkReal32 in_halfHeight, AkReal32 in_halfDepth)
Definition: AkSpatialAudio.h:128
AkImageSourceTexture texture
Acoustic texture that goes with this image source.
Definition: AkSpatialAudio.h:105
AkImageSourceSettings(AkVector64 in_sourcePosition, AkReal32 in_fDistanceScalingFactor, AkReal32 in_fLevel)
Definition: AkSpatialAudio.h:89
uint32_t AkUInt32
Unsigned 32-bit integer.
Definition: AkNumeralTypes.h:38
#define AK_DEFAULT_GEOMETRY_FRONT_Z
Definition: AkSpatialAudio.h:473
#define AK_INVALID_SURFACE
static const AkAuxBusID AK_INVALID_AUX_ID
Invalid auxiliary bus ID (or no Aux bus ID)
Definition: AkTypes.h:169
AkVertex * Vertices
Number of vertices in Vertices.
Definition: AkSpatialAudio.h:440
AkUInt32 AkAuxBusID
Auxilliary bus ID.
Definition: AkTypes.h:133
AkUInt32 uMaxSoundPropagationDepth
Maximum number of portals that sound can propagate through; must be less than or equal to AK_MAX_SOUN...
Definition: AkSpatialAudio.h:55
AkUInt16 AkVertIdx
3D vector for some operations in 3D space. Typically intended only for localized calculations due to ...
Definition: AkTypes.h:425
AkExtent()
Definition: AkSpatialAudio.h:126
AkGeometrySetID GeometrySetID
Definition: AkSpatialAudio.h:514
AKSOUNDENGINE_API AKRESULT SetEarlyReflectionsVolume(AkGameObjectID in_gameObjectID, AkReal32 in_fSendVolume)
AkGeometryParams()
Constructor.
Definition: AkSpatialAudio.h:423
AkReal32 diffraction
Definition: AkSpatialAudio.h:271
AKSOUNDENGINE_API AKRESULT SetPortalObstructionAndOcclusion(AkPortalID in_PortalID, AkReal32 in_fObstruction, AkReal32 in_fOcclusion)
AkReal32 obstructionValue
Definition: AkSpatialAudio.h:296
AKSOUNDENGINE_API AKRESULT RemoveGeometry(AkGeometrySetID in_SetID)
AkUniqueID arTextureID[AK_MAX_NUM_TEXTURE]
Unique IDs of the Acoustics Texture ShareSets used to filter this image source.
Parameters passed to SetRoom.
Definition: AkSpatialAudio.h:339
#define AK_MAX_SOUND_PROPAGATION_DEPTH
Parameters passed to SetGeometry.
Definition: AkSpatialAudio.h:421
AkVertIdx point1
Index into the vertex table passed into AkGeometryParams that describes the second vertex of the tria...
Definition: AkSpatialAudio.h:161
AkWorldTransform PositionAndOrientation
Definition: AkSpatialAudio.h:500
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)
#define AK_DEFAULT_MOVEMENT_THRESHOLD

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