Table of Contents

Wwise SDK 2019.1.6
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: <VERSION> Build: <BUILDNUMBER>
25 Copyright (c) <COPYRIGHTYEAR> 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 + 2)
45 #define AK_MAX_SOUND_PROPAGATION_DEPTH 8
46 #define AK_DEFAULT_DIFFR_SHADOW_DEGREES (30.0f)
47 #define AK_DEFAULT_DIFFR_SHADOW_ATTEN (2.0f)
48 #define AK_DEFAULT_MOVEMENT_THRESHOLD (1.0f)
49 #define AK_SA_EPSILON (0.001f)
50 #define AK_SA_DIFFRACTION_EPSILON (0.1f) // Radians
51 #define AK_SA_PLANE_THICKNESS_RATIO (0.005f)
52 
54 
58 
59 // Max values that are used for calculating diffraction paths between the listener and a portal.
63 
65 
66 AK_DEFINE_ARRAY_POOL(_ArrayPoolSpatialAudio, g_SpatialAudioPoolId);
69 
70 namespace AK
71 {
72  namespace SpatialAudio
73  {
74  typedef AkString<ArrayPoolSpatialAudio, wchar_t> WString; ///< Wide string type for use in Wwise Spatial Audio
75  typedef AkString<ArrayPoolSpatialAudio, AkOSChar> OsString; ///< OS string type for use in Wwise Spatial Audio
76  typedef AkString<ArrayPoolSpatialAudio, char> String; ///< String type for use in Wwise Spatial Audio
77  typedef AkDbString<ArrayPoolSpatialAudio, char, CAkLock> DbString; ///< Instanced string type.
78 
79  typedef AkUInt16 Idx;
80  }
81 }
82 
87 
88 #define AK_INVALID_VERTEX ((AkVertIdx)(-1))
89 #define AK_INVALID_TRIANGLE ((AkTriIdx)(-1))
90 #define AK_INVALID_SURFACE ((AkSurfIdx)(-1))
91 #define AK_INVALID_EDGE ((AkEdgeIdx)(-1))
92 
93 /// Base type for ID's used by Wwise spatial audio.
95 {
96  /// Default constructor. Creates an invalid ID.
98 
99  /// Construct from a 64-bit int.
100  AkSpatialAudioID(AkUInt64 _id) : id(_id) {}
101 
102  /// Conversion from a pointer to a AkSpatialAudioID
103  explicit AkSpatialAudioID(const void * ptr) : id(reinterpret_cast<AkUInt64>(ptr)) {}
104 
105  bool operator == (AkSpatialAudioID rhs) const { return id == rhs.id; }
106  bool operator != (AkSpatialAudioID rhs) const { return id != rhs.id; }
107  bool operator < (AkSpatialAudioID rhs) const { return id < rhs.id; }
108  bool operator > (AkSpatialAudioID rhs) const { return id > rhs.id; }
109  bool operator <= (AkSpatialAudioID rhs) const { return id <= rhs.id; }
110  bool operator >= (AkSpatialAudioID rhs) const { return id >= rhs.id; }
111 
112  /// Determine if this ID is valid.
113  bool IsValid() const { return id != (AkUInt64)-1; }
114 
115  /// Conversion function used internally to convert from a AkSpatialAudioID to a AkGameObjectID.
117 
118  operator</span> AkUInt64 () { return id; }
119 
121 };
122 
123 /// 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
124 /// 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
125 /// represent rooms using AkRoomID's provided by the client; AkRoomID's are convertied to AkGameObjectID's by calling AsGameObjectID().
126 /// \sa
127 /// - \ref AK::SpatialAudio::SetRoom
128 /// - \ref AK::SpatialAudio::RemoveRoom
129 struct AkRoomID : public AkSpatialAudioID
130 {
131  /// A game object ID that is in the reserved range, used for 'outdoor' rooms, ie when not in a room.
133 
134  /// Default constructor. Creates an invalid ID.
136 
137  /// Construct from a 64-bit int.
139 
140  /// Conversion from a pointer to a AkRoomID
141  explicit AkRoomID(const void * ptr) : AkSpatialAudioID(ptr) {}
142 
143  /// Conversion function used internally to convert AkRoomID's to AkGameObjectIDs.
145 };
146 
147 ///< 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
148 /// 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
149 /// represent portals using AkPortalID's provided by the client; AkPortalID's are convertied to AkGameObjectID's by calling AsGameObjectID().
150 /// \sa
151 /// - \ref AK::SpatialAudio::SetPortal
152 /// - \ref AK::SpatialAudio::RemovePortal
154 
155 ///< Unique ID for identifying geometry sets. Chosen by the client using any means desired.
156 /// \sa
157 /// - \ref AK::SpatialAudio::SetGeometry
158 /// - \ref AK::SpatialAudio::RemoveGeometry
160 
161 
static const AkGameObjectID OutdoorsGameObjID
A game object ID that is in the reserved range, used for 'outdoor' rooms, ie when not in a room.
AkString< ArrayPoolSpatialAudio, char > String
String type for use in Wwise Spatial Audio.
AkGameObjectID AsGameObjectID() const
Conversion function used internally to convert from a AkSpatialAudioID to a AkGameObjectID.
uint16_t AkUInt16
Unsigned 16-bit integer.
Definition: AkTypes.h:77
AkUInt16 AkSurfIdx
bool operator !=(AkSpatialAudioID rhs) const
uint64_t AkUInt64
Unsigned 64-bit integer.
Definition: AkTypes.h:79
Audiokinetic namespace.
AkString< ArrayPoolSpatialAudio, AkOSChar > OsString
OS string type for use in Wwise Spatial Audio.
AK_DEFINE_ARRAY_POOL(_ArrayPoolSpatialAudio, g_SpatialAudioPoolId)
AkUInt16 AkVertIdx
bool operator==(AkSpatialAudioID rhs) const
AkSpatialAudioID(AkUInt64 _id)
Construct from a 64-bit int.
Definition: AkString.h:60
const AkUInt32 kListenerDiffractionMaxPaths
AkSpatialAudioID(const void *ptr)
Conversion from a pointer to a AkSpatialAudioID.
bool operator >=(AkSpatialAudioID rhs) const
const AkUInt32 kListenerDiffractionMaxEdges
AkDbString< ArrayPoolSpatialAudio, char, CAkLock > DbString
Instanced string type.
const AkUInt32 kPortalToPortalDiffractionMaxPaths
AkRoomID()
Default constructor. Creates an invalid ID.
const AkReal32 kDefaultMaxPathLength
AkUInt64 AkGameObjectID
Game object ID.
Definition: AkTypes.h:70
AkUInt16 AkEdgeIdx
const AkUInt32 kDefaultDiffractionMaxEdges
const AkUInt32 kDefaultDiffractionMaxPaths
AkString< ArrayPoolSpatialAudio, wchar_t > WString
Wide string type for use in Wwise Spatial Audio.
AkGameObjectID AsGameObjectID() const
Conversion function used internally to convert AkRoomID's to AkGameObjectIDs.
bool operator >(AkSpatialAudioID rhs) const
bool IsValid() const
Determine if this ID is valid.
AkSpatialAudioID AkGeometrySetID
bool operator<(AkSpatialAudioID rhs) const
AkRoomID(AkUInt64 _id)
Construct from a 64-bit int.
AkRoomID(const void *ptr)
Conversion from a pointer to a AkRoomID.
const AkReal32 kMaxDiffraction
Base type for ID's used by Wwise spatial audio.
AkSpatialAudioID AkPortalID
uint32_t AkUInt32
Unsigned 32-bit integer.
Definition: AkTypes.h:78
AkMemPoolId g_SpatialAudioPoolId
AkArrayAllocatorNoAlign< _ArrayPoolSpatialAudio > ArrayPoolSpatialAudio
float AkReal32
32-bit floating point
Definition: AkTypes.h:96
bool operator<=(AkSpatialAudioID rhs) const
AkUInt16 AkTriIdx
AkInt32 AkMemPoolId
Memory pool ID.
Definition: AkTypes.h:72
AkArrayAllocatorAlignedSimd< _ArrayPoolSpatialAudio > ArrayPoolSpatialAudioSIMD
AkSpatialAudioID()
Default constructor. Creates an invalid ID.