버전

menu_open
Wwise SDK 2021.1.14
AkModule.h
이 파일의 문서화 페이지로 가기
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 /// Audiokinetic's definitions and factory of overridable Memory Manager module.
30 
31 #pragma once
32 
35 
36 /// \name Audiokinetic Memory Manager's implementation-specific definitions.
37 //@{
38 
40  );
41 
43  );
44 
45 typedef void* ( AKSOUNDENGINE_CALL *AkMemMalloc ) (
46  AkMemPoolId poolId,
47  size_t uSize
48  );
49 
50 typedef void* ( AKSOUNDENGINE_CALL *AkMemMalign ) (
51  AkMemPoolId poolId,
52  size_t uSize,
53  AkUInt32 uAlignment
54  );
55 
56 typedef void* ( AKSOUNDENGINE_CALL *AkMemRealloc ) (
57  AkMemPoolId poolId,
58  void* pAddress,
59  size_t uSize
60  );
61 
62 
64  AkMemPoolId poolId,
65  void* pAddress,
66  size_t uSize,
67  AkUInt32 uAlignment
68  );
69 
70 typedef void ( AKSOUNDENGINE_CALL *AkMemFree ) (
71  AkMemPoolId poolId,
72  void* pAddress
73  );
74 
76  );
77 
79  AkMemPoolId poolId,
80  void* pAddress
81  );
82 
84  AkMemPoolId poolId,
85  size_t uSize,
86  void* pAddress,
87  char const* pszFile,
88  AkUInt32 uLine
89  );
90 
92  AkMemPoolId poolId,
93  size_t uSize,
94  AkUInt32 uAlignment,
95  void* pAddress,
96  char const* pszFile,
97  AkUInt32 uLine
98  );
99 
101  AkMemPoolId poolId,
102  void* pOldAddress,
103  size_t uSize,
104  void* pNewAddress,
105  char const* pszFile,
106  AkUInt32 uLine
107  );
108 
110  AkMemPoolId poolId,
111  void* pOldAddress,
112  size_t uSize,
113  AkUInt32 uAlignment,
114  void* pNewAddress,
115  char const* pszFile,
116  AkUInt32 uLine
117  );
118 
120  AkMemPoolId poolId,
121  void* pAddress
122  );
123 
124 typedef void* ( *AkMemAllocVM ) (
125  size_t size,
126  size_t* extra
127  );
128 
129 typedef void ( *AkMemFreeVM ) (
130  void* address,
131  size_t size,
132  size_t extra,
133  size_t release
134  );
135 
136 /// Initialization settings for the default implementation of the Memory Manager. For more details, see \ref memorymanager_init.
137 /// \sa AK::MemoryMgr
139 {
140  /// @name High-level memory allocation hooks. When not NULL, redirect allocations normally forwarded to rpmalloc.
141  //@{
142  AkMemInitForThread pfInitForThread; ///< (Optional) Thread-specific allocator initialization hook.
143  AkMemTermForThread pfTermForThread; ///< (Optional) Thread-specific allocator termination hook.
144  AkMemMalloc pfMalloc; ///< (Optional) Memory allocation hook.
145  AkMemMalign pfMalign; ///< (Optional) Memory allocation hook.
146  AkMemRealloc pfRealloc; ///< (Optional) Memory allocation hook.
147  AkMemReallocAligned pfReallocAligned; ///< (Optional) Memory allocation hook.
148  AkMemFree pfFree; ///< (Optional) Memory allocation hook.
149  AkMemTotalReservedMemorySize pfTotalReservedMemorySize; ///< (Optional) Memory allocation statistics hook.
150  AkMemSizeOfMemory pfSizeOfMemory; ///< (Optional) Memory allocation statistics hook.
151  //@}
152 
153  /// @name Configuration.
154  //@{
155  AkUInt64 uMemAllocationSizeLimit; ///< When non-zero, limits the total amount of virtual and device memory allocated by AK::MemoryMgr.
156  //@}
157 
158  /// @name Page allocation hooks, used by rpmalloc. Default to AKPLATFORM::AllocVM et al.
159  //@{
160  AkMemAllocVM pfAllocVM; ///< Virtual page allocation hook.
161  AkMemFreeVM pfFreeVM; ///< Virtual page allocation hook.
162  AkMemAllocVM pfAllocDevice; ///< Device page allocation hook.
163  AkMemFreeVM pfFreeDevice; ///< Device page allocation hook.
164  AkUInt32 uVMPageSize; ///< Virtual memory page size. Defaults to 0 which means auto-detect.
165  AkUInt32 uDevicePageSize; ///< Device memory page size. Defaults to 0 which means auto-detect.
166  //@}
167 
168  /// @name Memory allocation debugging.
169  //@{
170  AkMemDebugMalloc pfDebugMalloc; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfMalloc.
171  AkMemDebugMalign pfDebugMalign; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfMalign.
172  AkMemDebugRealloc pfDebugRealloc; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfRealloc.
173  AkMemDebugReallocAligned pfDebugReallocAligned; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfReallocAligned.
174  AkMemDebugFree pfDebugFree; ///< (Optional) Memory allocation debugging hook. Used for tracking calls to pfFree.
175  AkUInt32 uMemoryDebugLevel; ///< Default 0 disabled. 1 debug enabled. 2 stomp allocator enabled. 3 stomp allocator and debug enabled. User implementations may use multiple non-zero values to offer different features.
176  //@}
177 };
178 //@}
179 
180 namespace AK
181 {
182 
183 namespace MemoryMgr
184 {
185 
186 /// Initialize the default implementation of the Memory Manager.
187 /// \sa AK::MemoryMgr
189  AkMemSettings * in_pSettings ///< Memory manager initialization settings.
190  );
191 
192 /// Obtain the default initialization settings for the default implementation of the Memory Manager.
194  AkMemSettings & out_pMemSettings ///< Memory manager default initialization settings.
195  );
196 
197 }
198 
199 }
200 
201 #if defined AK_WIN || defined AK_LINUX || defined AK_SONY || defined AK_XBOX || defined AK_APPLE
202 #define AK_CRT_ALLOCATOR
203 #endif
204 
205 #ifdef AK_CRT_ALLOCATOR
206 /// \name C runtime allocator functions for AkMemoryMgr
207 //@{
208 
209 namespace AK
210 {
211 
212 namespace MemoryMgr
213 {
214 
216 
218 
220  AkMemPoolId poolId,
221  size_t uSize
222  );
223 
225  AkMemPoolId poolId,
226  size_t uSize,
227  AkUInt32 uAlignment
228  );
229 
231  AkMemPoolId poolId,
232  void* pAddress,
233  size_t uSize
234  );
235 
237  AkMemPoolId poolId,
238  void* pAddress,
239  size_t uSize,
240  AkUInt32 uAlignment
241  );
242 
244  AkMemPoolId poolId,
245  void* pAddress
246  );
247 
249 
251  AkMemPoolId poolID,
252  void* pAddress
253  );
254 
255 }
256 
257 }
258 
259 //@}
260 #endif // AK_CRT_ALLOCATOR
261 
262 /// \name stomp allocator functions for AkMemoryMgr
263 //@{
264 
265 namespace AK
266 {
267 
268 namespace MemoryMgr
269 {
270 
272 
274 
276  AkMemPoolId poolId,
277  size_t uSize
278  );
279 
281  AkMemPoolId poolId,
282  size_t uSize,
283  AkUInt32 uAlignment
284  );
285 
287  AkMemPoolId poolId,
288  void* pAddress,
289  size_t uSize
290  );
291 
293  AkMemPoolId poolId,
294  void* pAddress,
295  size_t uSize,
296  AkUInt32 uAlignment
297  );
298 
300  AkMemPoolId poolId,
301  void* pAddress
302  );
303 
305 
307  AkMemPoolId poolID,
308  void* pAddress
309  );
310 
311 }
312 
313 }
314 
315 namespace AK
316 {
317 
318 namespace MemoryMgr
319 {
320 
321 /// debug tool hooks AkMemoryMgr
322 
324 
326 
328  AkMemPoolId poolId,
329  size_t uSize,
330  void* pAddress,
331  char const* pszFile,
332  AkUInt32 uLine
333  );
334 
336  AkMemPoolId poolId,
337  size_t uSize,
338  AkUInt32 uAlignment,
339  void* pAddress,
340  char const* pszFile,
341  AkUInt32 uLine
342  );
343 
345  AkMemPoolId poolId,
346  void* pOldAddress,
347  size_t uSize,
348  void* pNewAddress,
349  char const* pszFile,
350  AkUInt32 uLine
351  );
352 
354  AkMemPoolId poolId,
355  void* pOldAddress,
356  size_t uSize,
357  AkUInt32 uAlignment,
358  void* pNewAddress,
359  char const* pszFile,
360  AkUInt32 uLine
361  );
362 
364  AkMemPoolId poolId,
365  void* pAddress
366  );
367 
368 }
369 
370 }
void(* AkMemDebugMalloc)(AkMemPoolId poolId, size_t uSize, void *pAddress, char const *pszFile, AkUInt32 uLine)
Definition: AkModule.h:83
AKSOUNDENGINE_API AKRESULT AkMemDebugToolInit()
debug tool hooks AkMemoryMgr
Audiokinetic namespace
AkMemTermForThread pfTermForThread
(Optional) Thread-specific allocator termination hook.
Definition: AkModule.h:143
void(* AkMemInitForThread)()
Definition: AkModule.h:39
AKSOUNDENGINE_API void AkMemDebugToolMalloc(AkMemPoolId poolId, size_t uSize, void *pAddress, char const *pszFile, AkUInt32 uLine)
AkMemInitForThread pfInitForThread
(Optional) Thread-specific allocator initialization hook.
Definition: AkModule.h:142
AkMemFree pfFree
(Optional) Memory allocation hook.
Definition: AkModule.h:148
AkMemMalign pfMalign
(Optional) Memory allocation hook.
Definition: AkModule.h:145
AKSOUNDENGINE_API AKRESULT Init(AkMemSettings *in_pSettings)
AKSOUNDENGINE_API void AkStompAllocatorFree(AkMemPoolId poolId, void *pAddress)
AKSOUNDENGINE_API void AkCrtAllocatorInitForThread()
AKSOUNDENGINE_API void * AkStompAllocatorMalloc(AkMemPoolId poolId, size_t uSize)
#define AK_EXTERNAPIFUNC(_type, _name)
AkMemRealloc pfRealloc
(Optional) Memory allocation hook.
Definition: AkModule.h:146
AkMemFreeVM pfFreeVM
Virtual page allocation hook.
Definition: AkModule.h:161
AKRESULT
Standard function call result.
Definition: AkTypes.h:132
void *(* AkMemRealloc)(AkMemPoolId poolId, void *pAddress, size_t uSize)
Definition: AkModule.h:56
AKSOUNDENGINE_API void AkMemDebugToolFree(AkMemPoolId poolId, void *pAddress)
AkInt32 AkMemPoolId
Memory pool ID
Definition: AkTypes.h:72
AkMemDebugRealloc pfDebugRealloc
(Optional) Memory allocation debugging hook. Used for tracking calls to pfRealloc.
Definition: AkModule.h:172
void(* AkMemDebugRealloc)(AkMemPoolId poolId, void *pOldAddress, size_t uSize, void *pNewAddress, char const *pszFile, AkUInt32 uLine)
Definition: AkModule.h:100
void *(* AkMemAllocVM)(size_t size, size_t *extra)
Definition: AkModule.h:124
AkMemDebugReallocAligned pfDebugReallocAligned
(Optional) Memory allocation debugging hook. Used for tracking calls to pfReallocAligned.
Definition: AkModule.h:173
void *(* AkMemReallocAligned)(AkMemPoolId poolId, void *pAddress, size_t uSize, AkUInt32 uAlignment)
Definition: AkModule.h:63
AKSOUNDENGINE_API void AkMemDebugToolTerm()
AKSOUNDENGINE_API void * AkCrtAllocatorMalign(AkMemPoolId poolId, size_t uSize, AkUInt32 uAlignment)
AKSOUNDENGINE_API void AkMemDebugToolMalign(AkMemPoolId poolId, size_t uSize, AkUInt32 uAlignment, void *pAddress, char const *pszFile, AkUInt32 uLine)
void *(* AkMemMalloc)(AkMemPoolId poolId, size_t uSize)
Definition: AkModule.h:45
AKSOUNDENGINE_API void AkStompAllocatorTermForThread()
AKSOUNDENGINE_API void AkCrtAllocatorFree(AkMemPoolId poolId, void *pAddress)
AkMemReallocAligned pfReallocAligned
(Optional) Memory allocation hook.
Definition: AkModule.h:147
AkMemFreeVM pfFreeDevice
Device page allocation hook.
Definition: AkModule.h:163
uint64_t AkUInt64
Unsigned 64-bit integer
Definition: AkTypes.h:60
size_t(* AkMemTotalReservedMemorySize)()
Definition: AkModule.h:75
AKSOUNDENGINE_API void * AkStompAllocatorRealloc(AkMemPoolId poolId, void *pAddress, size_t uSize)
AkMemAllocVM pfAllocVM
Virtual page allocation hook.
Definition: AkModule.h:160
AKSOUNDENGINE_API void * AkCrtAllocatorRealloc(AkMemPoolId poolId, void *pAddress, size_t uSize)
void(* AkMemTermForThread)()
Definition: AkModule.h:42
AkUInt64 uMemAllocationSizeLimit
When non-zero, limits the total amount of virtual and device memory allocated by AK::MemoryMgr.
Definition: AkModule.h:155
void(* AkMemDebugReallocAligned)(AkMemPoolId poolId, void *pOldAddress, size_t uSize, AkUInt32 uAlignment, void *pNewAddress, char const *pszFile, AkUInt32 uLine)
Definition: AkModule.h:109
AKSOUNDENGINE_API void AkStompAllocatorInitForThread()
AKSOUNDENGINE_API size_t AkCrtAllocatorSizeOfMemory(AkMemPoolId poolID, void *pAddress)
void(* AkMemFree)(AkMemPoolId poolId, void *pAddress)
Definition: AkModule.h:70
AKSOUNDENGINE_API void AkMemDebugToolReallocAligned(AkMemPoolId poolId, void *pOldAddress, size_t uSize, AkUInt32 uAlignment, void *pNewAddress, char const *pszFile, AkUInt32 uLine)
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:50
AkUInt32 uMemoryDebugLevel
Default 0 disabled. 1 debug enabled. 2 stomp allocator enabled. 3 stomp allocator and debug enabled....
Definition: AkModule.h:175
AKSOUNDENGINE_API void * AkCrtAllocatorMalloc(AkMemPoolId poolId, size_t uSize)
#define AKSOUNDENGINE_CALL
Calling convention for the Wwise API
Definition: AkTypes.h:114
AkUInt32 uDevicePageSize
Device memory page size. Defaults to 0 which means auto-detect.
Definition: AkModule.h:165
AkMemTotalReservedMemorySize pfTotalReservedMemorySize
(Optional) Memory allocation statistics hook.
Definition: AkModule.h:149
AKSOUNDENGINE_API void * AkStompAllocatorReallocAligned(AkMemPoolId poolId, void *pAddress, size_t uSize, AkUInt32 uAlignment)
AkMemMalloc pfMalloc
(Optional) Memory allocation hook.
Definition: AkModule.h:144
AKSOUNDENGINE_API void AkCrtAllocatorTermForThread()
AKSOUNDENGINE_API void * AkStompAllocatorMalign(AkMemPoolId poolId, size_t uSize, AkUInt32 uAlignment)
void(* AkMemFreeVM)(void *address, size_t size, size_t extra, size_t release)
Definition: AkModule.h:129
AkMemDebugMalloc pfDebugMalloc
(Optional) Memory allocation debugging hook. Used for tracking calls to pfMalloc.
Definition: AkModule.h:170
AKSOUNDENGINE_API size_t AkStompAllocatorTotalReservedMemorySize()
uint32_t AkUInt32
Unsigned 32-bit integer
Definition: AkTypes.h:59
size_t(* AkMemSizeOfMemory)(AkMemPoolId poolId, void *pAddress)
Definition: AkModule.h:78
AkUInt32 uVMPageSize
Virtual memory page size. Defaults to 0 which means auto-detect.
Definition: AkModule.h:164
void(* AkMemDebugMalign)(AkMemPoolId poolId, size_t uSize, AkUInt32 uAlignment, void *pAddress, char const *pszFile, AkUInt32 uLine)
Definition: AkModule.h:91
AKSOUNDENGINE_API size_t AkCrtAllocatorTotalReservedMemorySize()
void(* AkMemDebugFree)(AkMemPoolId poolId, void *pAddress)
Definition: AkModule.h:119
AkMemDebugFree pfDebugFree
(Optional) Memory allocation debugging hook. Used for tracking calls to pfFree.
Definition: AkModule.h:174
AkMemSizeOfMemory pfSizeOfMemory
(Optional) Memory allocation statistics hook.
Definition: AkModule.h:150
AkMemDebugMalign pfDebugMalign
(Optional) Memory allocation debugging hook. Used for tracking calls to pfMalign.
Definition: AkModule.h:171
AKSOUNDENGINE_API void AkMemDebugToolRealloc(AkMemPoolId poolId, void *pOldAddress, size_t uSize, void *pNewAddress, char const *pszFile, AkUInt32 uLine)
AKSOUNDENGINE_API void * AkCrtAllocatorReallocAligned(AkMemPoolId poolId, void *pAddress, size_t uSize, AkUInt32 uAlignment)
AKSOUNDENGINE_API size_t AkStompAllocatorSizeOfMemory(AkMemPoolId poolID, void *pAddress)
AkMemAllocVM pfAllocDevice
Device page allocation hook.
Definition: AkModule.h:162

이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요