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 _IAKPLUGINMEMALLOC_H_ 00032 #define _IAKPLUGINMEMALLOC_H_ 00033 00034 #include <AK/SoundEngine/Common/AkTypes.h> 00035 #include <AK/SoundEngine/Common/AkMemoryMgr.h> // For AK_MEMDEBUG 00036 00037 namespace AK 00038 { 00045 class IAkPluginMemAlloc 00046 { 00047 protected: 00049 virtual ~IAkPluginMemAlloc(){} 00050 00051 public: 00052 00057 virtual void * Malloc( 00058 size_t in_uSize 00059 ) = 0; 00060 00064 virtual void Free( 00065 void * in_pMemAddress 00066 ) = 0; 00067 00068 #if defined (AK_MEMDEBUG) 00069 00070 00071 00072 virtual void * dMalloc( 00073 size_t in_uSize, 00074 const char* in_pszFile, 00075 AkUInt32 in_uLine 00076 ) = 0; 00077 #endif 00078 }; 00079 } 00080 00081 // Memory allocation macros to be used by sound engine plug-ins. 00082 #if defined (AK_MEMDEBUG) 00083 00084 AkForceInline void * operator new(size_t size,AK::IAkPluginMemAlloc * in_pAllocator,const char* szFile,AkUInt32 ulLine) throw() 00085 { 00086 return in_pAllocator->dMalloc( size, szFile, ulLine ); 00087 } 00088 00089 #ifndef AK_3DS 00090 AkForceInline void operator delete(void *, AK::IAkPluginMemAlloc *, const char*, AkUInt32) throw() {} 00091 #endif 00092 00093 #endif 00094 00095 AkForceInline void * operator new(size_t size,AK::IAkPluginMemAlloc * in_pAllocator) throw() 00096 { 00097 return in_pAllocator->Malloc( size ); 00098 } 00099 00100 #ifdef AK_PS3 00101 AkForceInline void * operator new(size_t size, unsigned int align, AK::IAkPluginMemAlloc * in_pAllocator) throw() 00102 { 00103 return in_pAllocator->Malloc( size ); 00104 } 00105 #endif 00106 00107 #ifndef AK_3DS 00108 AkForceInline void operator delete(void *,AK::IAkPluginMemAlloc *) throw() {} 00109 #endif 00110 00111 #if defined (AK_MEMDEBUG) 00112 #define AK_PLUGIN_NEW(_allocator,_what) new((_allocator),__FILE__,__LINE__) _what 00113 #define AK_PLUGIN_ALLOC(_allocator,_size) (_allocator)->dMalloc((_size),__FILE__,__LINE__) 00114 #else 00115 00116 00117 00118 00119 00120 00121 00122 00123 #define AK_PLUGIN_NEW(_allocator,_what) new(_allocator) _what 00124 00125 00126 00127 00128 00129 00130 00131 00132 #define AK_PLUGIN_ALLOC(_allocator,_size) (_allocator)->Malloc((_size)) 00133 #endif 00134 00141 template <class T> 00142 AkForceInline void AK_PLUGIN_DELETE( AK::IAkPluginMemAlloc * in_pAllocator, T * in_pObject ) 00143 { 00144 if ( in_pObject ) 00145 { 00146 in_pObject->~T(); 00147 in_pAllocator->Free( in_pObject ); 00148 } 00149 } 00150 00157 #define AK_PLUGIN_FREE(_allocator,_pvmem) (_allocator)->Free((_pvmem)) 00158 00159 #endif // _IAKPLUGINMEMALLOC_H_
Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !
Visitez notre page d'AideEnregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !
Partir du bon pied avec Wwise