目录

目标平台:
Wwise SDK 2018.1.11
AkTypes.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: <VERSION> Build: <BUILDNUMBER>
25  Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
26 *******************************************************************************/
27 
28 // AkTypes.h
29 
30 /// \file
31 /// Data type definitions.
32 
33 #ifndef _AK_DATA_TYPES_PLATFORM_H_
34 #define _AK_DATA_TYPES_PLATFORM_H_
35 
36 #include <limits.h>
37 
38 #ifndef __cplusplus
39  #include <wchar.h> // wchar_t not a built-in type in C
40 #endif
41 
42 #define AK_WIN ///< Compiling for Windows
43 
44 #ifndef _WIN32_WINNT
45  #define _WIN32_WINNT 0x0602
46 #endif
47 
48 #if defined _M_IX86
49  #define AK_CPU_X86 ///< Compiling for 32-bit x86 CPU
50 #elif defined _M_AMD64
51  #define AK_CPU_X86_64 ///< Compiling for 64-bit x86 CPU
52 #elif defined _M_ARM
53  #define AK_CPU_ARM
54  #define AK_CPU_ARM_NEON
55 #elif defined _M_ARM64
56  #define AK_CPU_ARM_64
57  #define AK_CPU_ARM_NEON
58 #endif
59 
60 #ifdef WINAPI_FAMILY
61  #include <winapifamily.h>
62  #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
63  #define AK_USE_UWP_API
64  #define AK_USE_METRO_API // deprecated
65  #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PC_APP)
66  #define AK_WIN_UNIVERSAL_APP
67  #endif
68  #endif
69 #endif
70 
71 #define AK_71AUDIO
72 #define AK_71FROMSTEREOMIXER
73 #define AK_51FROMSTEREOMIXER
74 
75 #define AK_LFECENTER ///< Internal use
76 #define AK_REARCHANNELS ///< Internal use
77 
78 #define AK_SUPPORT_WCHAR ///< Can support wchar
79 #define AK_OS_WCHAR ///< Use wchar natively
80 
81 #define AK_RESTRICT __restrict ///< Refers to the __restrict compilation flag available on some platforms
82 #if defined(_MSC_VER) && (_MSC_VER >= 1700)
83  #define AK_FINAL final ///< Refers to the C++11 final keyword
84 #endif
85 #define AK_EXPECT_FALSE( _x ) (_x)
86 #define AkForceInline __forceinline ///< Force inlining
87 #define AkNoInline __declspec(noinline) ///< Disable inlining
88 
89 #define AK_SIMD_ALIGNMENT 16 ///< Platform-specific alignment requirement for SIMD data
90 #define AK_ALIGN_SIMD( __Declaration__ ) __declspec(align(AK_SIMD_ALIGNMENT)) __Declaration__ ///< Platform-specific alignment requirement for SIMD data
91 #define AK_ALIGN_DMA ///< Platform-specific data alignment for DMA transfers
92 #define AK_ALIGN_FASTDMA ///< Platform-specific data alignment for faster DMA transfers
93 #define AK_ALIGN_SIZE_FOR_DMA( __Size__ ) (__Size__) ///< Used to align sizes to next 16 byte boundary on platfroms that require it
94 #define AK_BUFFER_ALIGNMENT AK_SIMD_ALIGNMENT
95 #define AK_XAUDIO2_FLAGS 0
96 #if defined AK_CPU_X86 || defined AK_CPU_X86_64 || defined AK_CPU_ARM_NEON
97 #define AKSIMD_V4F32_SUPPORTED
98 #endif
99 
100 
101 #define AKSOUNDENGINE_CALL __cdecl ///< Calling convention for the Wwise API
102 
103 #define AK_DLLEXPORT __declspec(dllexport)
104 #define AK_DLLIMPORT __declspec(dllimport)
105 
106 typedef unsigned char AkUInt8; ///< Unsigned 8-bit integer
107 typedef unsigned short AkUInt16; ///< Unsigned 16-bit integer
108 typedef unsigned long AkUInt32; ///< Unsigned 32-bit integer
109 typedef unsigned __int64 AkUInt64; ///< Unsigned 64-bit integer
110 
111 #if defined(_WIN64)
112 typedef __int64 AkIntPtr; ///< Integer type for pointers
113 typedef unsigned __int64 AkUIntPtr; ///< Integer (unsigned) type for pointers
114 #else
115 typedef __w64 int AkIntPtr; ///< Integer type for pointers
116 typedef __w64 unsigned int AkUIntPtr; ///< Integer (unsigned) type for pointers
117 #endif
118 
119 typedef char AkInt8; ///< Signed 8-bit integer
120 typedef short AkInt16; ///< Signed 16-bit integer
121 typedef long AkInt32; ///< Signed 32-bit integer
122 typedef __int64 AkInt64; ///< Signed 64-bit integer
123 
124 typedef wchar_t AkOSChar; ///< Generic character string
125 
126 typedef float AkReal32; ///< 32-bit floating point
127 typedef double AkReal64; ///< 64-bit floating point
128 
129 typedef void * AkThread; ///< Thread handle
130 typedef AkUInt32 AkThreadID; ///< Thread ID
131 typedef AkUInt32 (__stdcall *AkThreadRoutine)( void* lpThreadParameter ); ///< Thread routine
132 typedef void * AkEvent; ///< Event handle
133 typedef void * AkFileHandle; ///< File handle
134 typedef wchar_t AkUtf16; ///< Type for 2 byte chars. Used for communication
135  ///< with the authoring tool.
136 #define AK_UINT_MAX UINT_MAX
137 
138 // For strings.
139 #define AK_MAX_PATH 260 ///< Maximum path length.
140 
141 typedef AkUInt32 AkFourcc; ///< Riff chunk
142 
143 /// Create Riff chunk
144 #define AkmmioFOURCC( ch0, ch1, ch2, ch3 ) \
145  ( (AkFourcc)(AkUInt8)(ch0) | ( (AkFourcc)(AkUInt8)(ch1) << 8 ) | \
146  ( (AkFourcc)(AkUInt8)(ch2) << 16 ) | ( (AkFourcc)(AkUInt8)(ch3) << 24 ) )
147 
148 #define AK_BANK_PLATFORM_DATA_ALIGNMENT (16) ///< Required memory alignment for bank loading by memory address (see LoadBank())
149 #define AK_BANK_PLATFORM_ALLOC_TYPE AkMalloc
150 
151 /// Macro that takes a string litteral and changes it to an AkOSChar string at compile time
152 /// \remark This is similar to the TEXT() and _T() macros that can be used to turn string litterals into wchar_t strings
153 /// \remark Usage: AKTEXT( "Some Text" )
154 #define AKTEXT(x) L ## x
155 
156 /// Memory pool attributes.
157 /// Block allocation type determines the method used to allocate
158 /// a memory pool. Block management type determines the
159 /// method used to manage memory blocks. Note that
160 /// the list of values in this enum is platform-dependent.
161 /// \sa
162 /// - AkMemoryMgr::CreatePool()
163 /// - AK::Comm::DEFAULT_MEMORY_POOL_ATTRIBUTES
165 {
166  AkNoAlloc = 0, ///< CreatePool will not allocate memory. You need to allocate the buffer yourself.
167  AkMalloc = 1<<0, ///< CreatePool will use AK::AllocHook() to allocate the memory block.
168 
169  AkVirtualAlloc = 1<<1, ///< CreatePool will use AK::VirtualAllocHook() to allocate the memory block (Windows & XboxOne only).
170  AkAllocMask = AkNoAlloc | AkMalloc | AkVirtualAlloc, ///< Block allocation type mask.
171 
172  AkFixedSizeBlocksMode = 1<<3, ///< Block management type: Fixed-size blocks. Get blocks through GetBlock/ReleaseBlock API. If not specified, use AkAlloc/AkFree.
173  AkBlockMgmtMask = AkFixedSizeBlocksMode ///< Block management type mask.
174 };
175 #define AK_MEMPOOLATTRIBUTES
176 
177 #ifdef __cplusplus
178  namespace AK
179  {
180  /// External allocation hook for the Memory Manager. Called by the Audiokinetic
181  /// implementation of the Memory Manager when creating a pool of type AkVirtualAlloc.
182  /// \aknote This needs to be defined by the client, who must allocate memory using VirtualAlloc. \endaknote
183  /// \return A pointer to the start of the allocated memory (NULL if the system is out of memory)
184  /// \sa
185  /// - \ref memorymanager
186  /// - AK::AllocHook()
187  /// - AK::FreeHook()
188  /// - AK::VirtualFreeHook()
189  extern void * AKSOUNDENGINE_CALL VirtualAllocHook(
190  void * in_pMemAddress, ///< Parameter for VirtualAlloc
191  size_t in_size, ///< Number of bytes to allocate
192  AkUInt32 in_dwAllocationType, ///< Parameter for VirtualAlloc
193  AkUInt32 in_dwProtect ///< Parameter for VirtualAlloc
194  );
195 
196  /// External deallocation hook for the Memory Manager. Called by the Audiokinetic
197  /// implementation of the Memory Manager when destroying a pool of type AkVirtualAlloc.
198  /// \aknote This needs to be defined by the client, who must deallocate memory using VirtualFree. \endaknote
199  /// \sa
200  /// - \ref memorymanager
201  /// - AK::VirtualAllocHook()
202  /// - AK::AllocHook()
203  /// - AK::FreeHook()
204  extern void AKSOUNDENGINE_CALL VirtualFreeHook(
205  void * in_pMemAddress, ///< Pointer to the start of memory allocated with VirtualAllocHook
206  size_t in_size, ///< Parameter for VirtualFree
207  AkUInt32 in_dwFreeType ///< Parameter for VirtualFree
208  );
209  }
210 #endif
211 
212 #endif //_AK_DATA_TYPES_PLATFORM_H_
213 
AkMemPoolAttributes
Definition: AkTypes.h:628
uint16_t AkUInt16
Unsigned 16-bit integer
Definition: AkTypes.h:78
int8_t AkInt8
Signed 8-bit integer
Definition: AkTypes.h:90
int64_t AkIntPtr
Definition: AkTypes.h:83
ScePthread AkThread
Thread handle
Definition: AkTypes.h:100
int16_t AkInt16
Signed 16-bit integer
Definition: AkTypes.h:91
uint8_t AkUInt8
Unsigned 8-bit integer
Definition: AkTypes.h:77
void *(* AkThreadRoutine)(void *lpThreadParameter)
Thread routine
Definition: AkTypes.h:102
wchar_t AkUtf16
Definition: AkTypes.h:107
uint64_t AkUInt64
Unsigned 64-bit integer
Definition: AkTypes.h:80
Audiokinetic namespace
#define AKSOUNDENGINE_CALL
Calling convention for the Wwise API
Definition: AkTypes.h:101
ScePthread AkThreadID
Thread ID
Definition: AkTypes.h:101
SceFiosFH AkFileHandle
File handle
Definition: AkTypes.h:105
CreatePool will use AK::AllocHook() to allocate the memory block.
Definition: AkTypes.h:631
Block management type: Fixed-size blocks. Get blocks through GetBlock/ReleaseBlock API....
Definition: AkTypes.h:634
int32_t AkInt32
Signed 32-bit integer
Definition: AkTypes.h:92
Block management type mask.
Definition: AkTypes.h:635
AkUInt32 AkFourcc
Riff chunk
Definition: AkTypes.h:115
CreatePool will not allocate memory. You need to allocate the buffer yourself.
Definition: AkTypes.h:630
Block allocation type mask.
Definition: AkTypes.h:632
int64_t AkInt64
Signed 64-bit integer
Definition: AkTypes.h:93
double AkReal64
64-bit floating point
Definition: AkTypes.h:98
uint32_t AkUInt32
Unsigned 32-bit integer
Definition: AkTypes.h:79
semaphore_t AkEvent
Definition: AkTypes.h:80
float AkReal32
32-bit floating point
Definition: AkTypes.h:97
char AkOSChar
Generic character string
Definition: AkTypes.h:95
CreatePool will use AK::VirtualAllocHook() to allocate the memory block (Windows & XboxOne only).
Definition: AkTypes.h:169
uint64_t AkUIntPtr
Definition: AkTypes.h:84