Version
menu_open
link
Target Platform(s):

include/AK/SoundEngine/Platforms/Windows/AkTypes.h

Go to the documentation of this file.
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 
00028 // AkTypes.h
00029 
00030 /// \file 
00031 /// Data type definitions.
00032 
00033 #ifndef _AK_DATA_TYPES_PLATFORM_H_
00034 #define _AK_DATA_TYPES_PLATFORM_H_
00035 
00036 #include <limits.h>
00037 
00038 #ifndef __cplusplus
00039     #include <wchar.h> // wchar_t not a built-in type in C
00040 #endif
00041 
00042 #define AK_WIN                                      ///< Compiling for Windows
00043     
00044 #ifndef _WIN32_WINNT
00045     #define _WIN32_WINNT 0x0602
00046 #endif                      
00047     
00048 #if defined _M_IX86
00049     #define AK_CPU_X86                              ///< Compiling for 32-bit x86 CPU
00050 #elif defined _M_AMD64
00051     #define AK_CPU_X86_64                           ///< Compiling for 64-bit x86 CPU
00052 #elif defined _M_ARM
00053     #define AK_CPU_ARM
00054     #define AK_CPU_ARM_NEON
00055 #endif
00056     
00057 #ifdef WINAPI_FAMILY
00058     #include <winapifamily.h>
00059     #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
00060         #define AK_USE_UWP_API
00061         #define AK_USE_METRO_API // deprecated
00062         #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PC_APP)
00063             #define AK_WIN_UNIVERSAL_APP
00064         #endif
00065     #endif
00066 #endif
00067 
00068 #define AK_71AUDIO
00069 #define AK_71FROMSTEREOMIXER
00070 #define AK_51FROMSTEREOMIXER
00071 
00072 #define AK_LFECENTER                            ///< Internal use
00073 #define AK_REARCHANNELS                         ///< Internal use
00074 
00075 #define AK_SUPPORT_WCHAR                        ///< Can support wchar
00076 #define AK_OS_WCHAR                             ///< Use wchar natively
00077 
00078 #define AK_RESTRICT     __restrict              ///< Refers to the __restrict compilation flag available on some platforms
00079 #if defined(_MSC_VER) && (_MSC_VER >= 1700)
00080     #define AK_FINAL        final                   ///< Refers to the C++11 final keyword
00081 #endif
00082 #define AK_EXPECT_FALSE( _x )   (_x)
00083 #define AkForceInline   __forceinline           ///< Force inlining
00084 #define AkNoInline      __declspec(noinline)    ///< Disable inlining
00085 
00086 #define AK_SIMD_ALIGNMENT   16                  ///< Platform-specific alignment requirement for SIMD data
00087 #define AK_ALIGN_SIMD( __Declaration__ ) __declspec(align(AK_SIMD_ALIGNMENT)) __Declaration__ ///< Platform-specific alignment requirement for SIMD data
00088 #define AK_ALIGN_DMA                            ///< Platform-specific data alignment for DMA transfers
00089 #define AK_ALIGN_FASTDMA                        ///< Platform-specific data alignment for faster DMA transfers
00090 #define AK_ALIGN_SIZE_FOR_DMA( __Size__ ) (__Size__) ///< Used to align sizes to next 16 byte boundary on platfroms that require it
00091 #define AK_BUFFER_ALIGNMENT AK_SIMD_ALIGNMENT
00092 #define AK_XAUDIO2_FLAGS 0
00093 #if defined AK_CPU_X86 || defined AK_CPU_X86_64 || defined AK_CPU_ARM_NEON
00094 #define AKSIMD_V4F32_SUPPORTED
00095 #endif
00096 
00097 
00098 #define AKSOUNDENGINE_CALL __cdecl              ///< Calling convention for the Wwise API
00099 
00100 #define AK_DLLEXPORT __declspec(dllexport)
00101 #define AK_DLLIMPORT __declspec(dllimport)      
00102 
00103 typedef unsigned char       AkUInt8;            ///< Unsigned 8-bit integer
00104 typedef unsigned short      AkUInt16;           ///< Unsigned 16-bit integer
00105 typedef unsigned long       AkUInt32;           ///< Unsigned 32-bit integer
00106 typedef unsigned __int64    AkUInt64;           ///< Unsigned 64-bit integer
00107 
00108 #if defined(_WIN64)
00109 typedef __int64 AkIntPtr;                       ///< Integer type for pointers
00110 typedef unsigned __int64 AkUIntPtr;             ///< Integer (unsigned) type for pointers
00111 #else
00112 typedef __w64 int AkIntPtr;                     ///< Integer type for pointers
00113 typedef __w64 unsigned int AkUIntPtr;           ///< Integer (unsigned) type for pointers
00114 #endif
00115 
00116 typedef char            AkInt8;                 ///< Signed 8-bit integer
00117 typedef short           AkInt16;                ///< Signed 16-bit integer
00118 typedef long            AkInt32;                ///< Signed 32-bit integer
00119 typedef __int64         AkInt64;                ///< Signed 64-bit integer
00120 
00121 typedef wchar_t         AkOSChar;               ///< Generic character string
00122 
00123 typedef float           AkReal32;               ///< 32-bit floating point
00124 typedef double          AkReal64;               ///< 64-bit floating point
00125 
00126 typedef void *                  AkThread;       ///< Thread handle
00127 typedef AkUInt32                AkThreadID;     ///< Thread ID
00128 typedef AkUInt32 (__stdcall *AkThreadRoutine)(  void* lpThreadParameter ); ///< Thread routine
00129 typedef void *                  AkEvent;        ///< Event handle
00130 typedef void *                  AkFileHandle;   ///< File handle
00131 typedef wchar_t         AkUtf16;                ///< Type for 2 byte chars. Used for communication
00132                                                 ///< with the authoring tool.
00133 #define AK_UINT_MAX     UINT_MAX
00134 
00135 // For strings.
00136 #define AK_MAX_PATH     260                     ///< Maximum path length.
00137 
00138 typedef AkUInt32            AkFourcc;           ///< Riff chunk
00139 
00140 /// Create Riff chunk
00141 #define AkmmioFOURCC( ch0, ch1, ch2, ch3 )                                      \
00142         ( (AkFourcc)(AkUInt8)(ch0) | ( (AkFourcc)(AkUInt8)(ch1) << 8 ) |        \
00143         ( (AkFourcc)(AkUInt8)(ch2) << 16 ) | ( (AkFourcc)(AkUInt8)(ch3) << 24 ) )
00144 
00145 #define AK_BANK_PLATFORM_DATA_ALIGNMENT (16)    ///< Required memory alignment for bank loading by memory address (see LoadBank())
00146 #define AK_BANK_PLATFORM_ALLOC_TYPE     AkMalloc
00147 
00148 /// Macro that takes a string litteral and changes it to an AkOSChar string at compile time
00149 /// \remark This is similar to the TEXT() and _T() macros that can be used to turn string litterals into wchar_t strings
00150 /// \remark Usage: AKTEXT( "Some Text" )
00151 #define AKTEXT(x) L ## x
00152 
00153 /// Memory pool attributes.
00154 /// Block allocation type determines the method used to allocate
00155 /// a memory pool. Block management type determines the
00156 /// method used to manage memory blocks. Note that
00157 /// the list of values in this enum is platform-dependent.
00158 /// \sa
00159 /// - AkMemoryMgr::CreatePool()
00160 /// - AK::Comm::DEFAULT_MEMORY_POOL_ATTRIBUTES
00161 enum AkMemPoolAttributes
00162 {
00163     AkNoAlloc       = 0,    ///< CreatePool will not allocate memory.  You need to allocate the buffer yourself.
00164     AkMalloc        = 1<<0, ///< CreatePool will use AK::AllocHook() to allocate the memory block.
00165 
00166     AkVirtualAlloc  = 1<<1, ///< CreatePool will use AK::VirtualAllocHook() to allocate the memory block (Windows & XboxOne only).
00167     AkAllocMask     = AkNoAlloc | AkMalloc | AkVirtualAlloc,    ///< Block allocation type mask.        
00168 
00169     AkFixedSizeBlocksMode   = 1<<3,         ///< Block management type: Fixed-size blocks. Get blocks through GetBlock/ReleaseBlock API.  If not specified, use AkAlloc/AkFree.
00170     AkBlockMgmtMask = AkFixedSizeBlocksMode ///< Block management type mask.
00171 };
00172 #define AK_MEMPOOLATTRIBUTES
00173 
00174 #ifdef __cplusplus
00175     namespace AK
00176     {
00177         /// External allocation hook for the Memory Manager. Called by the Audiokinetic 
00178         /// implementation of the Memory Manager when creating a pool of type AkVirtualAlloc.
00179         /// \aknote This needs to be defined by the client, who must allocate memory using VirtualAlloc. \endaknote
00180         /// \return A pointer to the start of the allocated memory (NULL if the system is out of memory)
00181         /// \sa 
00182         /// - \ref memorymanager
00183         /// - AK::AllocHook()
00184         /// - AK::FreeHook()
00185         /// - AK::VirtualFreeHook()
00186         extern void * AKSOUNDENGINE_CALL VirtualAllocHook( 
00187             void * in_pMemAddress,      ///< Parameter for VirtualAlloc
00188             size_t in_size,             ///< Number of bytes to allocate
00189             AkUInt32 in_dwAllocationType,   ///< Parameter for VirtualAlloc
00190             AkUInt32 in_dwProtect           ///< Parameter for VirtualAlloc
00191             );
00192     
00193         /// External deallocation hook for the Memory Manager. Called by the Audiokinetic 
00194         /// implementation of the Memory Manager when destroying a pool of type AkVirtualAlloc.
00195         /// \aknote This needs to be defined by the client, who must deallocate memory using VirtualFree. \endaknote
00196         /// \sa 
00197         /// - \ref memorymanager
00198         /// - AK::VirtualAllocHook()
00199         /// - AK::AllocHook()
00200         /// - AK::FreeHook()
00201         extern void AKSOUNDENGINE_CALL VirtualFreeHook( 
00202             void * in_pMemAddress,  ///< Pointer to the start of memory allocated with VirtualAllocHook
00203             size_t in_size,         ///< Parameter for VirtualFree
00204             AkUInt32 in_dwFreeType      ///< Parameter for VirtualFree
00205             );
00206     }
00207 #endif
00208 
00209 #endif //_AK_DATA_TYPES_PLATFORM_H_
00210 

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise