Wwise Version
Wwise SDK 2019.2.13
AkModule.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 /// Audiokinetic's definitions and factory of overridable Memory Manager module.
30 
31 #pragma once
32 
34 
35 /// \name Audiokinetic Memory Manager's implementation-specific definitions.
36 //@{
37 
38 typedef void ( *AkMemInitForThread ) (
39  );
40 
41 typedef void ( *AkMemTermForThread ) (
42  );
43 
44 typedef void* ( *AkMemMalloc ) (
45  AkMemPoolId poolId,
46  size_t uSize
47  );
48 
49 typedef void* ( *AkMemMalign ) (
50  AkMemPoolId poolId,
51  size_t uSize,
52  AkUInt32 uAlignment
53  );
54 
55 typedef void* ( *AkMemRealloc ) (
56  AkMemPoolId poolId,
57  void* pAddress,
58  size_t uSize
59  );
60 
61 typedef void ( *AkMemFree ) (
62  AkMemPoolId poolId,
63  void* pAddress
64  );
65 
66 typedef void ( *AkMemFalign ) (
67  AkMemPoolId poolId,
68  void* pAddress
69  );
70 
71 typedef size_t ( *AkMemTotalReservedMemorySize ) (
72  );
73 
74 typedef size_t ( *AkMemSizeOfMemory ) (
75  AkMemPoolId poolId,
76  void* pAddress
77  );
78 
79 typedef void ( *AkMemDebugMalloc ) (
80  AkMemPoolId poolId,
81  size_t uSize,
82  void* pAddress,
83  char const* pszFile,
84  AkUInt32 uLine
85  );
86 
87 typedef void ( *AkMemDebugMalign ) (
88  AkMemPoolId poolId,
89  size_t uSize,
90  AkUInt32 uAlignment,
91  void* pAddress,
92  char const* pszFile,
93  AkUInt32 uLine
94  );
95 
96 typedef void ( *AkMemDebugRealloc ) (
97  AkMemPoolId poolId,
98  void* pOldAddress,
99  size_t uSize,
100  void* pNewAddress,
101  char const* pszFile,
102  AkUInt32 uLine
103  );
104 
105 typedef void ( *AkMemDebugFree ) (
106  AkMemPoolId poolId,
107  void* pAddress
108  );
109 
110 typedef void ( *AkMemDebugFalign ) (
111  AkMemPoolId poolId,
112  void* pAddress
113  );
114 
116  );
117 
118 typedef void * ( *AkMemAllocVM ) (
119  size_t size,
120  size_t* extra
121  );
122 
123 typedef void ( *AkMemFreeVM ) (
124  void* address,
125  size_t size,
126  size_t extra,
127  size_t release
128  );
129 
130 /// Initialization settings for the default implementation of the Memory Manager. For more details, see \ref memorymanager_init.
131 /// \sa AK::MemoryMgr
133 {
134  /// @name High-level memory allocation hooks. When not NULL, redirect allocations normally forwarded to rpmalloc.
135  //@{
136  AkMemInitForThread pfInitForThread; ///< (Optional) Thread-specific allocator initialization hook.
137  AkMemTermForThread pfTermForThread; ///< (Optional) Thread-specific allocator termination hook.
138  AkMemMalloc pfMalloc; ///< (Optional) Memory allocation hook.
139  AkMemMalign pfMalign; ///< (Optional) Memory allocation hook.
140  AkMemRealloc pfRealloc; ///< (Optional) Memory allocation hook.
141  AkMemFree pfFree; ///< (Optional) Memory allocation hook.
142  AkMemFalign pfFalign; ///< (Optional) Memory allocation hook.
143  AkMemTotalReservedMemorySize pfTotalReservedMemorySize; ///< (Optional) Memory allocation statistics hook.
144  AkMemSizeOfMemory pfSizeOfMemory; ///< (Optional) Memory allocation statistics hook.
145  //@}
146 
147  /// @name Configuration.
148  //@{
149  AkUInt64 uMemAllocationSizeLimit; ///< When non-zero, limits the total amount of virtual and device memory allocated by AK::MemoryMgr.
150  //@}
151 
152  /// @name Memory allocation debugging hooks.
153  //@{
154  AkMemDebugMalloc pfDebugMalloc; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfMalloc.
155  AkMemDebugMalign pfDebugMalign; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfMalign.
156  AkMemDebugRealloc pfDebugRealloc; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfRealloc.
157  AkMemDebugFree pfDebugFree; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfFree.
158  AkMemDebugFalign pfDebugFalign; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfFalign.
159  AkMemDebugCheckForOverwrite pfDebugCheckForOverwrite; ///< (Optional) Memory allocation debugging hook. Used for detecting memory overwrites.
160  //@}
161 
162  /// @name Page allocation hooks, used by rpmalloc. Default to AKPLATFORM::AllocVM et al.
163  //@{
164  AkMemAllocVM pfAllocVM; ///< Virtual page allocation hook.
165  AkMemFreeVM pfFreeVM; ///< Virtual page allocation hook.
166  AkMemAllocVM pfAllocDevice; ///< Device page allocation hook.
167  AkMemFreeVM pfFreeDevice; ///< Device page allocation hook.
168  AkUInt32 uVMPageSize; ///< Virtual memory page size. Defaults to 0 which means auto-detect.
169  AkUInt32 uDevicePageSize; ///< Device memory page size. Defaults to 0 which means auto-detect.
170  //@}
171 };
172 //@}
173 
174 namespace AK
175 {
176  /// \name Audiokinetic implementation-specific modules factories.
177  //@{
178  namespace MemoryMgr
179  {
180  /// @name Initialization
181  //@{
182 
183  /// Initialize the default implementation of the Memory Manager.
184  /// \sa AK::MemoryMgr
186  AkMemSettings * in_pSettings ///< Memory manager initialization settings.
187  );
188 
189  /// Obtain the default initialization settings for the default implementation of the Memory Manager.
191  AkMemSettings & out_pMemSettings ///< Memory manager default initialization settings.
192  );
193 
194  //@}
195  }
196  //@}
197 }
AkMemDebugCheckForOverwrite pfDebugCheckForOverwrite
(Optional) Memory allocation debugging hook. Used for detecting memory overwrites.
Definition: AkModule.h:159
void(* AkMemDebugMalloc)(AkMemPoolId poolId, size_t uSize, void *pAddress, char const *pszFile, AkUInt32 uLine)
Definition: AkModule.h:79
uint64_t AkUInt64
Unsigned 64-bit integer.
Definition: AkTypes.h:86
Audiokinetic namespace.
AkMemTermForThread pfTermForThread
(Optional) Thread-specific allocator termination hook.
Definition: AkModule.h:137
void(* AkMemInitForThread)()
Definition: AkModule.h:38
AkMemInitForThread pfInitForThread
(Optional) Thread-specific allocator initialization hook.
Definition: AkModule.h:136
AkMemFree pfFree
(Optional) Memory allocation hook.
Definition: AkModule.h:141
AkMemMalign pfMalign
(Optional) Memory allocation hook.
Definition: AkModule.h:139
AKSOUNDENGINE_API AKRESULT Init(AkMemSettings *in_pSettings)
#define AK_EXTERNAPIFUNC(_type, _name)
AkMemRealloc pfRealloc
(Optional) Memory allocation hook.
Definition: AkModule.h:140
AkMemFreeVM pfFreeVM
Virtual page allocation hook.
Definition: AkModule.h:165
AKRESULT
Standard function call result.
Definition: AkTypes.h:122
void *(* AkMemRealloc)(AkMemPoolId poolId, void *pAddress, size_t uSize)
Definition: AkModule.h:55
AkInt32 AkMemPoolId
Memory pool ID.
Definition: AkTypes.h:67
AkMemDebugRealloc pfDebugRealloc
(Optional) Memory allocation debugging hook. Used for tracking calls to pfRealloc.
Definition: AkModule.h:156
void(* AkMemDebugRealloc)(AkMemPoolId poolId, void *pOldAddress, size_t uSize, void *pNewAddress, char const *pszFile, AkUInt32 uLine)
Definition: AkModule.h:96
void *(* AkMemAllocVM)(size_t size, size_t *extra)
Definition: AkModule.h:118
void *(* AkMemMalloc)(AkMemPoolId poolId, size_t uSize)
Definition: AkModule.h:44
AkMemFreeVM pfFreeDevice
Device page allocation hook.
Definition: AkModule.h:167
size_t(* AkMemTotalReservedMemorySize)()
Definition: AkModule.h:71
AkMemAllocVM pfAllocVM
Virtual page allocation hook.
Definition: AkModule.h:164
void(* AkMemTermForThread)()
Definition: AkModule.h:41
AkUInt64 uMemAllocationSizeLimit
When non-zero, limits the total amount of virtual and device memory allocated by AK::MemoryMgr.
Definition: AkModule.h:149
void(* AkMemFree)(AkMemPoolId poolId, void *pAddress)
Definition: AkModule.h:61
AKSOUNDENGINE_API void GetDefaultSettings(AkMemSettings &out_pMemSettings)
Obtain the default initialization settings for the default implementation of the Memory Manager.
void *(* AkMemMalign)(AkMemPoolId poolId, size_t uSize, AkUInt32 uAlignment)
Definition: AkModule.h:49
AkUInt32 uDevicePageSize
Device memory page size. Defaults to 0 which means auto-detect.
Definition: AkModule.h:169
AkMemTotalReservedMemorySize pfTotalReservedMemorySize
(Optional) Memory allocation statistics hook.
Definition: AkModule.h:143
AkMemMalloc pfMalloc
(Optional) Memory allocation hook.
Definition: AkModule.h:138
AkMemFalign pfFalign
(Optional) Memory allocation hook.
Definition: AkModule.h:142
void(* AkMemDebugFalign)(AkMemPoolId poolId, void *pAddress)
Definition: AkModule.h:110
void(* AkMemFreeVM)(void *address, size_t size, size_t extra, size_t release)
Definition: AkModule.h:123
AkMemDebugMalloc pfDebugMalloc
(Optional) Memory allocation debugging hook. Used for tracking calls to pfMalloc.
Definition: AkModule.h:154
AkMemDebugFalign pfDebugFalign
(Optional) Memory allocation debugging hook. Used for tracking calls to pfFalign.
Definition: AkModule.h:158
size_t(* AkMemSizeOfMemory)(AkMemPoolId poolId, void *pAddress)
Definition: AkModule.h:74
AkUInt32 uVMPageSize
Virtual memory page size. Defaults to 0 which means auto-detect.
Definition: AkModule.h:168
void(* AkMemFalign)(AkMemPoolId poolId, void *pAddress)
Definition: AkModule.h:66
void(* AkMemDebugMalign)(AkMemPoolId poolId, size_t uSize, AkUInt32 uAlignment, void *pAddress, char const *pszFile, AkUInt32 uLine)
Definition: AkModule.h:87
AKRESULT(* AkMemDebugCheckForOverwrite)()
Definition: AkModule.h:115
void(* AkMemDebugFree)(AkMemPoolId poolId, void *pAddress)
Definition: AkModule.h:105
uint32_t AkUInt32
Unsigned 32-bit integer.
Definition: AkTypes.h:85
AkMemDebugFree pfDebugFree
(Optional) Memory allocation debugging hook. Used for tracking calls to pfFree.
Definition: AkModule.h:157
AkMemSizeOfMemory pfSizeOfMemory
(Optional) Memory allocation statistics hook.
Definition: AkModule.h:144
AkMemDebugMalign pfDebugMalign
(Optional) Memory allocation debugging hook. Used for tracking calls to pfMalign.
Definition: AkModule.h:155
AkMemAllocVM pfAllocDevice
Device page allocation hook.
Definition: AkModule.h:166