バージョン
00001 /******************************************************************************* 00002 The content of this file includes portions of the AUDIOKINETIC Wwise Technology 00003 released in source code form as part of the SDK installer package. 00004 00005 Commercial License Usage 00006 00007 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology 00008 may use this file in accordance with the end user license agreement provided 00009 with the software or, alternatively, in accordance with the terms contained in a 00010 written agreement between you and Audiokinetic Inc. 00011 00012 Apache License Usage 00013 00014 Alternatively, this file may be used under the Apache License, Version 2.0 (the 00015 "Apache License"); you may not use this file except in compliance with the 00016 Apache License. You may obtain a copy of the Apache License at 00017 http://www.apache.org/licenses/LICENSE-2.0. 00018 00019 Unless required by applicable law or agreed to in writing, software distributed 00020 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 00021 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for 00022 the specific language governing permissions and limitations under the License. 00023 00024 Version: <VERSION> Build: <BUILDNUMBER> 00025 Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc. 00026 *******************************************************************************/ 00027 00030 00031 #ifndef _AKMEMORYMGR_H_ 00032 #define _AKMEMORYMGR_H_ 00033 00034 #include <AK/SoundEngine/Common/AkTypes.h> 00035 #include <AK/SoundEngine/Common/AkSoundEngineExport.h> 00036 00037 #ifndef AK_OPTIMIZED 00038 00039 #define AK_MAX_MEM_POOL_NAME_SIZE 64 00040 00042 #define AK_SETPOOLNAME( _poolid, _name ) \ 00043 if( AK_INVALID_POOL_ID != _poolid ) \ 00044 { \ 00045 AK::MemoryMgr::SetPoolName( _poolid, _name ); \ 00046 } 00047 00048 //#define AK_MEMDEBUG 00049 00050 #else 00051 #define AK_SETPOOLNAME(_poolid,_name) 00052 #endif 00053 00054 00055 namespace AK 00056 { 00061 namespace MemoryMgr 00062 { 00069 struct PoolStats 00070 { 00071 // Current state 00072 AkUInt32 uReserved; 00073 AkUInt32 uUsed; 00074 AkUInt32 uMaxFreeBlock; 00075 00076 // Statistics 00077 AkUInt32 uAllocs; 00078 AkUInt32 uFrees; 00079 AkUInt32 uPeakUsed; 00080 }; 00081 00086 struct PoolMemInfo 00087 { 00088 // Current state 00089 AkUInt32 uReserved; 00090 AkUInt32 uUsed; 00091 }; 00092 00099 AK_EXTERNAPIFUNC( bool, IsInitialized )(); 00100 00105 AK_EXTERNAPIFUNC( void, Term )(); 00106 00109 00110 00118 AK_EXTERNAPIFUNC( AkMemPoolId, CreatePool )( 00119 void * in_pMemAddress, 00120 AkUInt32 in_uMemSize, 00121 AkUInt32 in_uBlockSize, 00122 AkUInt32 in_eAttributes, 00123 AkUInt32 in_uBlockAlign = 0 00124 ); 00125 00126 #ifdef AK_SUPPORT_WCHAR 00127 00128 00129 00130 00131 AK_EXTERNAPIFUNC( AKRESULT, SetPoolName )( 00132 AkMemPoolId in_poolId, 00133 const wchar_t* in_pszPoolName 00134 ); 00135 #endif //AK_SUPPORT_WCHAR 00136 00141 AK_EXTERNAPIFUNC( AKRESULT, SetPoolName )( 00142 AkMemPoolId in_poolId, 00143 const char* in_pszPoolName 00144 ); 00145 00150 AK_EXTERNAPIFUNC( AkOSChar*, GetPoolName )( 00151 AkMemPoolId in_poolId 00152 ); 00153 00160 AK_EXTERNAPIFUNC( AKRESULT, SetMonitoring )( 00161 AkMemPoolId in_poolId, 00162 bool in_bDoMonitor 00163 ); 00164 00169 AK_EXTERNAPIFUNC( AKRESULT, DestroyPool )( 00170 AkMemPoolId in_poolId 00171 ); 00172 00177 AK_EXTERNAPIFUNC( AKRESULT, GetPoolStats )( 00178 AkMemPoolId in_poolId, 00179 PoolStats& out_stats 00180 ); 00181 00189 AK_EXTERNAPIFUNC( void, GetPoolMemoryUsed )( 00190 AkMemPoolId in_poolId, 00191 PoolMemInfo& out_memInfo 00192 ); 00193 00198 AK_EXTERNAPIFUNC( AkInt32, GetNumPools )(); 00199 00204 AK_EXTERNAPIFUNC( AkInt32, GetMaxPools )(); 00205 00211 AK_EXTERNAPIFUNC( AKRESULT, CheckPoolId )( 00212 AkMemPoolId in_poolId 00213 ); 00214 00219 AK_EXTERNAPIFUNC( AkMemPoolAttributes, GetPoolAttributes )( 00220 AkMemPoolId in_poolId 00221 ); 00222 00224 00227 00228 00229 #if defined (AK_MEMDEBUG) 00230 00231 00232 00233 00234 AK_EXTERNAPIFUNC( void *, dMalloc )( 00235 AkMemPoolId in_poolId, 00236 size_t in_uSize, 00237 const char *in_pszFile, 00238 AkUInt32 in_uLine 00239 ); 00240 #endif 00241 00242 00243 00244 00245 AK_EXTERNAPIFUNC( void *, Malloc )( 00246 AkMemPoolId in_poolId, 00247 size_t in_uSize 00248 ); 00249 00254 AK_EXTERNAPIFUNC( AKRESULT, Free )( 00255 AkMemPoolId in_poolId, 00256 void * in_pMemAddress 00257 ); 00258 00259 #if defined (AK_MEMDEBUG) 00260 00261 00262 00263 00264 00265 AK_EXTERNAPIFUNC( void *, dMalign )( 00266 AkMemPoolId in_poolId, 00267 size_t in_uSize, 00268 AkUInt32 in_uAlignment, 00269 const char* in_pszFile, 00270 AkUInt32 in_uLine 00271 ); 00272 #endif 00273 00279 AK_EXTERNAPIFUNC( void *, Malign )( 00280 AkMemPoolId in_poolId, 00281 size_t in_uSize, 00282 AkUInt32 in_uAlignment 00283 ); 00284 00291 AK_EXTERNAPIFUNC( AKRESULT, Falign )( 00292 AkMemPoolId in_poolId, 00293 void * in_pMemAddress 00294 ); 00295 00297 00300 00301 00311 AK_EXTERNAPIFUNC( void *, GetBlock )( 00312 AkMemPoolId in_poolId 00313 ); 00314 00320 AK_EXTERNAPIFUNC( AKRESULT, ReleaseBlock )( 00321 AkMemPoolId in_poolId, 00322 void * in_pMemAddress 00323 ); 00324 00332 AK_EXTERNAPIFUNC( AkUInt32, GetBlockSize )( 00333 AkMemPoolId in_poolId 00334 ); 00335 00338 AK_EXTERNAPIFUNC( void, StartProfileThreadUsage) ( 00339 AkMemPoolId in_PoolId 00340 ); 00341 00345 AK_EXTERNAPIFUNC( AkUInt32, StopProfileThreadUsage ) ( 00346 AkMemPoolId in_PoolId 00347 ); 00348 00350 } 00351 } 00352 00353 #endif // _AKMEMORYMGR_H_