Version
menu_open
link
Wwise SDK 2021.1.14
AkSpatialAudioTypes.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 Version: v2021.1.14 Build: 6590
25 Copyright (c) 2006-2023 Audiokinetic Inc.
26 *******************************************************************************/
27 
28 /// \file
29 /// Spatial audio data type definitions.
30 
31 #pragma once
32 
34 #include <AK/Tools/Common/AkSet.h>
36 #include <AK/Tools/Common/AkLock.h>
37 
38 class AkAcousticRoom;
39 class AkAcousticPortal;
40 class AkImageSourceTriangle;
41 class AkImageSourcePlane;
42 
43 #define AK_MAX_REFLECT_ORDER 4
44 #define AK_MAX_REFLECTION_PATH_LENGTH (AK_MAX_REFLECT_ORDER + 4)
45 #define AK_MAX_SOUND_PROPAGATION_DEPTH 8
46 #define AK_DEFAULT_DIFFR_SHADOW_DEGREES (30.0f)
47 #define AK_DEFAULT_DIFFR_SHADOW_ATTEN (1.0f)
48 #define AK_DEFAULT_MOVEMENT_THRESHOLD (1.0f)
49 #define AK_DEFAULT_REFLECTIONS_ORDER (1)
50 #define AK_SA_EPSILON (0.001f)
51 #define AK_SA_DIFFRACTION_EPSILON (0.002f) // Radians
52 #define AK_SA_DIFFRACTION_DOT_EPSILON (0.000002) // 1.f - cos(AK_SA_DIFFRACTION_EPSILON)
53 #define AK_SA_PLANE_THICKNESS_RATIO (0.005f)
54 #define AK_SA_MIN_ENVIRONMENT_ABSORPTION (0.1f)
55 #define AK_SA_MIN_ENVIRONMENT_SURFACE_AREA (1.0f)
57 
61 
62 // Max values that are used for calculating diffraction paths between the listener and a portal.
66 
69 
72 
75 
76 namespace AK
77 {
78  namespace SpatialAudio
79  {
80  typedef AkString<ArrayPoolSpatialAudio, wchar_t> WString; ///< Wide string type for use in Wwise Spatial Audio
81  typedef AkString<ArrayPoolSpatialAudio, AkOSChar> OsString; ///< OS string type for use in Wwise Spatial Audio
82  typedef AkString<ArrayPoolSpatialAudio, char> String; ///< String type for use in Wwise Spatial Audio
83  typedef AkDbString<ArrayPoolSpatialAudio, char, CAkLock> DbString; ///< Instanced string type.
84 
85  typedef AkUInt16 Idx;
86  }
87 }
88 
93 
94 #define AK_INVALID_VERTEX ((AkVertIdx)(-1))
95 #define AK_INVALID_TRIANGLE ((AkTriIdx)(-1))
96 #define AK_INVALID_SURFACE ((AkSurfIdx)(-1))
97 #define AK_INVALID_EDGE ((AkEdgeIdx)(-1))
98 
99 /// Base type for ID's used by Wwise spatial audio.
101 {
102  /// Default constructor. Creates an invalid ID.
104 
105  /// Construct from a 64-bit int.
106  AkSpatialAudioID(AkUInt64 _id) : id(_id) {}
107 
108  /// Conversion from a pointer to a AkSpatialAudioID
109  explicit AkSpatialAudioID(const void * ptr) : id(reinterpret_cast<AkUInt64>(ptr)) {}
110 
111  bool operator == (AkSpatialAudioID rhs) const { return id == rhs.id; }
112  bool operator != (AkSpatialAudioID rhs) const { return id != rhs.id; }
113  bool operator < (AkSpatialAudioID rhs) const { return id < rhs.id; }
114  bool operator > (AkSpatialAudioID rhs) const { return id > rhs.id; }
115  bool operator <= (AkSpatialAudioID rhs) const { return id <= rhs.id; }
116  bool operator >= (AkSpatialAudioID rhs) const { return id >= rhs.id; }
117 
118  /// Determine if this ID is valid.
119  bool IsValid() const { return id != (AkUInt64)-1; }
120 
121  /// Conversion function used internally to convert from a AkSpatialAudioID to a AkGameObjectID.
123 
124  operator</span> AkUInt64 () { return id; }
125 
127 };
128 
129 /// Spatial Audio Room ID type. This ID type exists in the same ID-space as game object ID's. The client is responsible for not choosing room ID's
130 /// that conflict with registered game objects' ID's. Internally, the spatial audio rooms and portals API manages registration and un-registration of game objects that
131 /// represent rooms using AkRoomID's provided by the client; AkRoomID's are converted to AkGameObjectID's by calling AsGameObjectID().
132 /// \sa
133 /// - \ref AK::SpatialAudio::SetRoom
134 /// - \ref AK::SpatialAudio::RemoveRoom
135 struct AkRoomID : public AkSpatialAudioID
136 {
137  /// Default constructor. Creates an invalid ID.
139 
140  /// Construct from a 64-bit int.
142 
143  /// Conversion from a pointer to a AkRoomID
144  explicit AkRoomID(const void * ptr) : AkSpatialAudioID(ptr) {}
145 
146  /// Conversion function used to convert AkRoomID's to AkGameObjectIDs.
147  AkGameObjectID AsGameObjectID() const { return IsValid() ? (AkGameObjectID)id : OutdoorsGameObjID; }
148 
149  /// Conversion function used to convert to AkGameObjectIDs to AkRoomID.
150  static AkRoomID FromGameObjectID(AkGameObjectID in_fromGameObject)
151  {
152  AkRoomID id;
153  if (in_fromGameObject != OutdoorsGameObjID)
154  id.id = (AkUInt64)in_fromGameObject;
155  return id;
156  }
157 
158 private:
159  /// A game object ID that is in the reserved range, used for 'outdoor' rooms, i.e. when not in a room.
160  /// \akwarning This AkGameObjectID is the underlying game object ID of the outdoor room, and should not be confused with the actual outdoor room's ID, AK::SpatialAudio::kOutdoorRoomID.\endakwarning
161  static const AkGameObjectID OutdoorsGameObjID = (AkGameObjectID)-4;
162 };
163 
164 namespace AK
165 {
166  namespace SpatialAudio
167  {
168  /// The outdoor room ID. This room is created automatically and is typically used for outdoors, i.e. when not in a room.
169  static const AkRoomID kOutdoorRoomID = AkRoomID();
170  }
171 }
172 
173 ///< Unique ID for portals. This ID type exists in the same ID-space as game object ID's. The client is responsible for not choosing portal ID's
174 /// that conflict with registered game objects' ID's. Internally, the spatial audio rooms and portals API manages registration and un-registration of game objects that
175 /// represent portals using AkPortalID's provided by the client; AkPortalID's are convertied to AkGameObjectID's by calling AsGameObjectID().
176 /// \sa
177 /// - \ref AK::SpatialAudio::SetPortal
178 /// - \ref AK::SpatialAudio::RemovePortal
180 
181 ///< Unique ID for identifying geometry sets. Chosen by the client using any means desired.
182 /// \sa
183 /// - \ref AK::SpatialAudio::SetGeometry
184 /// - \ref AK::SpatialAudio::RemoveGeometry
186 
float AkReal32
32-bit floating point
Definition: AkTypes.h:70
AkUInt16 AkTriIdx
bool operator>(AkSpatialAudioID rhs) const
const AkUInt32 kDefaultDiffractionMaxPaths
Audiokinetic namespace.
AkArrayAllocatorAlignedSimd< AkMemID_SpatialAudio > ArrayPoolSpatialAudioSIMD
AkArrayAllocatorNoAlign< AkMemID_SpatialAudioPaths > ArrayPoolSpatialAudioPaths
AkUInt64 AkGameObjectID
Game object ID.
Definition: AkTypes.h:70
static AkRoomID FromGameObjectID(AkGameObjectID in_fromGameObject)
Conversion function used to convert to AkGameObjectIDs to AkRoomID.
AkArrayAllocatorAlignedSimd< AkMemID_SpatialAudioGeometry > ArrayPoolSpatialAudioGeometrySIMD
AkSpatialAudioID(AkUInt64 _id)
Construct from a 64-bit int.
AkDbString< ArrayPoolSpatialAudio, char, CAkLock > DbString
Instanced string type.
AkUInt16 AkSurfIdx
AkRoomID()
Default constructor. Creates an invalid ID.
uint64_t AkUInt64
Unsigned 64-bit integer.
Definition: AkTypes.h:60
bool operator==(AkSpatialAudioID rhs) const
bool operator!=(AkSpatialAudioID rhs) const
static const AkRoomID kOutdoorRoomID
The outdoor room ID. This room is created automatically and is typically used for outdoors,...
const AkReal32 kMaxDiffraction
AkString< ArrayPoolSpatialAudio, AkOSChar > OsString
OS string type for use in Wwise Spatial Audio.
Definition: AkString.h:67
AkSpatialAudioID(const void *ptr)
Conversion from a pointer to a AkSpatialAudioID.
AkString< ArrayPoolSpatialAudio, char > String
String type for use in Wwise Spatial Audio.
AkSpatialAudioID AkGeometrySetID
AkGameObjectID AsGameObjectID() const
Conversion function used to convert AkRoomID's to AkGameObjectIDs.
AkRoomID(AkUInt64 _id)
Construct from a 64-bit int.
bool operator>=(AkSpatialAudioID rhs) const
AkGameObjectID AsGameObjectID() const
Conversion function used internally to convert from a AkSpatialAudioID to a AkGameObjectID.
Base type for ID's used by Wwise spatial audio.
bool IsValid() const
Determine if this ID is valid.
uint16_t AkUInt16
Unsigned 16-bit integer.
Definition: AkTypes.h:58
bool operator<(AkSpatialAudioID rhs) const
AkUInt16 AkEdgeIdx
AkRoomID(const void *ptr)
Conversion from a pointer to a AkRoomID.
bool operator<=(AkSpatialAudioID rhs) const
uint32_t AkUInt32
Unsigned 32-bit integer.
Definition: AkTypes.h:59
AkArrayAllocatorNoAlign< AkMemID_SpatialAudio > ArrayPoolSpatialAudio
AkSpatialAudioID()
Default constructor. Creates an invalid ID.
AkUInt16 AkVertIdx
AkSpatialAudioID AkPortalID
AkArrayAllocatorAlignedSimd< AkMemID_SpatialAudioPaths > ArrayPoolSpatialAudioPathsSIMD
const AkUInt32 kDefaultDiffractionMaxEdges
const AkUInt32 kPortalToPortalDiffractionMaxPaths
const AkReal32 kDefaultMaxPathLength
AkString< ArrayPoolSpatialAudio, wchar_t > WString
Wide string type for use in Wwise Spatial Audio.
AkArrayAllocatorNoAlign< AkMemID_SpatialAudioGeometry > ArrayPoolSpatialAudioGeometry
const AkUInt32 kDiffractionMaxEdges
const AkUInt32 kDiffractionMaxPaths

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