Go to the documentation of this file.
28 #ifndef _AK_BANKREADHELPERS_H_
29 #define _AK_BANKREADHELPERS_H_
33 template<
typename T >
37 typedef T __attribute__((aligned(1))) UnalignedT;
38 return *
reinterpret_cast<const UnalignedT *
>(in_pVal);
39 #elif defined(_MSC_VER) && !defined(AK_CPU_X86)
40 return *
reinterpret_cast<const T __unaligned *
>(in_pVal);
42 return *
reinterpret_cast<const T *
>(in_pVal);
46 template<
typename T >
50 #if defined(__has_warning)
51 #if __has_warning("-Walign-mismatch")
52 #define __IGNORE_RECENT_CLANG_WARNINGS
53 #pragma clang diagnostic push
54 #pragma clang diagnostic ignored "-Walign-mismatch"
58 typedef T __attribute__((aligned(1))) UnalignedT;
59 *
reinterpret_cast<UnalignedT *
>(out_pVal) = in_val;
61 #ifdef __IGNORE_RECENT_CLANG_WARNINGS
62 #undef __IGNORE_RECENT_CLANG_WARNINGS
63 #pragma clang diagnostic pop
65 #elif defined(_MSC_VER) && !defined(AK_CPU_X86)
66 *
reinterpret_cast<T __unaligned *
>(out_pVal) = in_val;
68 *
reinterpret_cast<T *
>(out_pVal) = in_val;
73 template<
typename T >
81 T l_Value = ReadUnaligned<T>(in_rptr);
85 in_rSize -=
sizeof(T);
90 template<
typename T >
100 AkUInt8 currentByte = *in_rptr;
105 l_Value = (currentByte & 0x7F);
106 while (0x80 & currentByte)
108 currentByte = *in_rptr;
113 l_Value = l_Value << 7;
114 l_Value |= (currentByte & 0x7F);
127 out_uStringSize = ReadBankData<AkUInt32>(in_rptr
134 if (out_uStringSize > 0)
136 pString =
reinterpret_cast<char*
>(in_rptr);
137 in_rptr += out_uStringSize;
139 in_rSize -= out_uStringSize;
150 #define READBANKDATA( _Type, _Ptr, _Size ) \
151 AK::ReadBankData<_Type>( _Ptr, _Size )
153 #define READVARIABLESIZEBANKDATA( _Type, _Ptr, _Size ) \
154 AK::ReadVariableSizeBankData<_Type>( _Ptr, _Size )
157 #define READBANKSTRING_UTF8( _Ptr, _Size, _out_StringSize ) \
158 AK::ReadBankStringUtf8( _Ptr, _Size, _out_StringSize )
161 #define READBANKSTRING( _Ptr, _Size, _out_StringSize ) \
162 AK::ReadBankStringUtf8( _Ptr, _Size, _out_StringSize ) //same as UTF-8 for now.
165 #define SKIPBANKDATA( _Type, _Ptr, _Size ) \
166 ( _Ptr ) += sizeof( _Type ); \
167 ( _Size ) -= sizeof( _Type )
170 #define SKIPBANKBYTES( _NumBytes, _Ptr, _Size ) \
171 ( _Ptr ) += _NumBytes; \
172 ( _Size ) -= _NumBytes
177 #define READBANKDATA( _Type, _Ptr, _Size ) \
178 AK::ReadBankData<_Type>( _Ptr )
180 #define READVARIABLESIZEBANKDATA( _Type, _Ptr, _Size ) \
181 AK::ReadVariableSizeBankData<_Type>( _Ptr )
183 #define READBANKSTRING_UTF8( _Ptr, _Size, _out_StringSize ) \
184 AK::ReadBankStringUtf8( _Ptr, _out_StringSize )
186 #define READBANKSTRING( _Ptr, _Size, _out_StringSize ) \
187 AK::ReadBankStringUtf8( _Ptr, _out_StringSize )
190 #define SKIPBANKDATA( _Type, _Ptr, _Size ) \
191 ( _Ptr ) += sizeof( _Type )
194 #define SKIPBANKBYTES( _NumBytes, _Ptr, _Size ) \
195 ( _Ptr ) += _NumBytes;
199 #define GETBANKDATABIT( _Data, _Shift ) \
200 (((_Data) >> (_Shift)) & 0x1)
204 #define CHECKBANKDATASIZE( _DATASIZE_, _ERESULT_ ) AKASSERT( _DATASIZE_ == 0 || _ERESULT_ != AK_Success );
206 #define CHECKBANKDATASIZE(_DATASIZE_, _ERESULT_ )
209 #endif //_AK_BANKREADHELPERS_H_
void WriteUnaligned(AkUInt8 *out_pVal, const T in_val)
T ReadBankData(AkUInt8 *&in_rptr)
Read data from bank and advance pointer.
T ReadVariableSizeBankData(AkUInt8 *&in_rptr)
T ReadUnaligned(const AkUInt8 *in_pVal)
char * ReadBankStringUtf8(AkUInt8 *&in_rptr, AkUInt32 &out_uStringSize)
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