Version
menu_open
link
Wwise SDK 2019.1.11
AkPlatformFuncs.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 // AkPlatformFuncs.h
29 
30 /// \file
31 /// Platform-dependent functions definition.
32 
33 #ifndef _AK_TOOLS_COMMON_AKPLATFORMFUNCS_H
34 #define _AK_TOOLS_COMMON_AKPLATFORMFUNCS_H
35 
36 #include <AK/SoundEngine/Common/AkTypes.h>
37 
38 // Uncomment the following to enable built-in platform profiler markers in the sound engine
39 //#define AK_ENABLE_INSTRUMENT
40 
41 #if defined(AK_WIN) || defined(AK_XBOXONE)
42 #include <AK/Tools/Win32/AkPlatformFuncs.h>
43 
44 #elif defined (AK_APPLE)
45 #include <AK/Tools/Mac/AkPlatformFuncs.h>
46 #include <AK/Tools/POSIX/AkPlatformFuncs.h>
47 
48 #elif defined (AK_ANDROID)
49 #include <AK/Tools/Android/AkPlatformFuncs.h>
50 
51 #elif defined (AK_PS4)
52 #include <AK/Tools/PS4/AkPlatformFuncs.h>
53 
54 #elif defined (AK_PELLEGRINO)
55 #include <AK/Tools/Pellegrino/AkPlatformFuncs.h>
56 
57 #elif defined (AK_EMSCRIPTEN)
58 #include <AK/Tools/Emscripten/AkPlatformFuncs.h>
59 
60 #elif defined (AK_LINUX)
61 
62 #ifdef AK_GGP
63 #include <AK/Tools/GGP/AkPlatformFuncs.h>
64 #endif
65 #include <AK/Tools/Linux/AkPlatformFuncs.h>
66 #include <AK/Tools/POSIX/AkPlatformFuncs.h>
67 
68 #elif defined (AK_QNX)
69 #include <AK/Tools/QNX/AkPlatformFuncs.h>
70 #include <AK/Tools/POSIX/AkPlatformFuncs.h>
71 
72 #elif defined (AK_NX)
73 #include <AK/Tools/NX/AkPlatformFuncs.h>
74 
75 #else
76 #error AkPlatformFuncs.h: Undefined platform
77 #endif
78 
79 #ifndef AkPrefetchZero
80 #define AkPrefetchZero(___Dest, ___Size)
81 #endif
82 
83 #ifndef AkPrefetchZeroAligned
84 #define AkPrefetchZeroAligned(___Dest, ___Size)
85 #endif
86 
87 #ifndef AkZeroMemAligned
88 #define AkZeroMemAligned(___Dest, ___Size) AKPLATFORM::AkMemSet(___Dest, 0, ___Size);
89 #endif
90 #ifndef AkZeroMemLarge
91 #define AkZeroMemLarge(___Dest, ___Size) AKPLATFORM::AkMemSet(___Dest, 0, ___Size);
92 #endif
93 #ifndef AkZeroMemSmall
94 #define AkZeroMemSmall(___Dest, ___Size) AKPLATFORM::AkMemSet(___Dest, 0, ___Size);
95 #endif
96 
97 #ifndef AkAllocaSIMD
98 #define AkAllocaSIMD( _size_ ) AkAlloca( _size_ )
99 #endif
100 
101 #ifndef AK_THREAD_INIT_CODE
102 #define AK_THREAD_INIT_CODE(_threadProperties)
103 #endif
104 
105 /// Utility functions
106 namespace AK
107 {
108  /// Count non-zero bits.
109  /// \return Number of channels.
110  AkForceInline AkUInt32 GetNumNonZeroBits( AkUInt32 in_uWord )
111  {
112  AkUInt32 num = 0;
113  while( in_uWord ){ ++num; in_uWord &= in_uWord-1; }
114  return num;
115  }
116 }
117 
118 namespace AKPLATFORM
119 {
121  {
122  AkGetDefaultThreadProperties(out_threadProperties);
123  out_threadProperties.nPriority = AK_THREAD_PRIORITY_ABOVE_NORMAL;
124  }
125 }
126 
127 #ifndef AK_PERF_RECORDING_RESET
128 #define AK_PERF_RECORDING_RESET()
129 #endif
130 #ifndef AK_PERF_RECORDING_START
131 #define AK_PERF_RECORDING_START( __StorageName__, __uExecutionCountStart__, __uExecutionCountStop__ )
132 #endif
133 #ifndef AK_PERF_RECORDING_STOP
134 #define AK_PERF_RECORDING_STOP( __StorageName__, __uExecutionCountStart__, __uExecutionCountStop__ )
135 #endif
136 
137 #ifndef AK_INSTRUMENT_BEGIN
138  #define AK_INSTRUMENT_BEGIN( _zone_name_ )
139  #define AK_INSTRUMENT_END( _zone_name_ )
140  #define AK_INSTRUMENT_SCOPE( _zone_name_ )
141 
142  #define AK_INSTRUMENT_BEGIN_C(_colour_, _zone_name_ )
143 
144  #define AK_INSTRUMENT_IDLE_BEGIN( _zone_name_ )
145  #define AK_INSTRUMENT_IDLE_END( _zone_name_ )
146  #define AK_INSTRUMENT_IDLE_SCOPE( _zone_name_ )
147 
148  #define AK_INSTRUMENT_STALL_BEGIN( _zone_name_ )
149  #define AK_INSTRUMENT_STALL_END( _zone_name_ )
150  #define AK_INSTRUMENT_STALL_SCOPE( _zone_name_ )
151 
152  #define AK_INSTRUMENT_THREAD_START( _thread_name_ )
153 #endif
154 
155 #endif // _AK_TOOLS_COMMON_AKPLATFORMFUNCS_H
Audiokinetic namespace.
int nPriority
Thread priority.
Definition: AkPlatformFuncs.h:50
AkForceInline void AkGetDefaultThreadProperties(AkThreadProperties &out_threadProperties)
Platform Independent Helper.
Definition: AkPlatformFuncs.h:237
void AkGetDefaultHighPriorityThreadProperties(AkThreadProperties &out_threadProperties)
Definition: AkPlatformFuncs.h:120
AkForceInline AkUInt32 GetNumNonZeroBits(AkUInt32 in_uWord)
Definition: AkPlatformFuncs.h:110

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