[詳解]
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 char* pString = (
char *)in_rptr;
130 while (*in_rptr != 0)
152 #define READBANKDATA( _Type, _Ptr, _Size ) \
153 AK::ReadBankData<_Type>( _Ptr, _Size )
155 #define READVARIABLESIZEBANKDATA( _Type, _Ptr, _Size ) \
156 AK::ReadVariableSizeBankData<_Type>( _Ptr, _Size )
159 #define READBANKSTRING( _Ptr, _Size, _out_StringSize ) \
160 AK::ReadBankStringUtf8( _Ptr, _Size, _out_StringSize )
163 #define SKIPBANKDATA( _Type, _Ptr, _Size ) \
164 ( _Ptr ) += sizeof( _Type ); \
165 ( _Size ) -= sizeof( _Type )
168 #define SKIPBANKBYTES( _NumBytes, _Ptr, _Size ) \
169 ( _Size ) -= _NumBytes; \
170 ( _Ptr ) += _NumBytes
173 #define COPYBANKSTRING_CHAR( _Ptr, _Size, _OutPtr, _MaxOutPtrSize ) \
174 AKPLATFORM::SafeStrCpy( _OutPtr, ((const char*)_Ptr), (_MaxOutPtrSize) ); \
175 SKIPBANKBYTES( (AkUInt32)strlen((const char*)_Ptr) + 1, _Ptr, _Size )
178 #define COPYBANKSTRING_OSCHAR( _Ptr, _Size, _OutPtr, _MaxOutPtrSize ) \
179 AK_UTF8_TO_OSCHAR( _OutPtr, ((const char*)_Ptr), (_MaxOutPtrSize) ); \
180 SKIPBANKBYTES( (AkUInt32)strlen((const char*)_Ptr) + 1, _Ptr, _Size )
183 #define COPYBANKSTRING_WCHAR( _Ptr, _Size, OutPtr, _MaxOutPtrSize ) \
184 AK_CHAR_TO_UTF16( _OutPtr, ((const char*)_Ptr), (_MaxOutPtrSize) ); \
185 SKIPBANKBYTES( (AkUInt32)strlen((const char*)_Ptr) + 1, _Ptr, _Size )
191 #define READBANKDATA( _Type, _Ptr, _Size ) \
192 AK::ReadBankData<_Type>( _Ptr )
194 #define READVARIABLESIZEBANKDATA( _Type, _Ptr, _Size ) \
195 AK::ReadVariableSizeBankData<_Type>( _Ptr )
197 #define READBANKSTRING( _Ptr, _Size, _out_StringSize ) \
198 AK::ReadBankStringUtf8( _Ptr, _out_StringSize )
201 #define SKIPBANKDATA( _Type, _Ptr, _Size ) \
202 ( _Ptr ) += sizeof( _Type )
205 #define SKIPBANKBYTES( _NumBytes, _Ptr, _Size ) \
206 ( _Ptr ) += _NumBytes;
209 #define COPYBANKSTRING_CHAR( _Ptr, _Size, _OutPtr, _MaxPtrSize ) \
210 AKPLATFORM::SafeStrCpy( _OutPtr, (const char*)_Ptr, _MaxPtrSize ); \
211 SKIPBANKBYTES( (AkUInt32)strlen((const char*)_Ptr)+1, _Ptr, _Size )
214 #define COPYBANKSTRING_OSCHAR( _Ptr, _Size, _OutPtr, _MaxPtrSize ) \
215 AK_UTF8_TO_OSCHAR( _OutPtr, (const char*)_Ptr, _MaxPtrSize ); \
216 SKIPBANKBYTES( (AkUInt32)strlen((const char*)_Ptr)+1, _Ptr, _Size )
219 #define COPYBANKSTRING_WCHAR( _Ptr, _Size, OutPtr, _MaxPtrSize ) \
220 AK_CHAR_TO_UTF16( _OutPtr, (const char*)_Ptr, _MaxPtrSize ); \
221 SKIPBANKBYTES( (AkUInt32)strlen((const char*)_Ptr)+1, _Ptr, _Size )
225 #define GETBANKDATABIT( _Data, _Shift ) \
226 (((_Data) >> (_Shift)) & 0x1)
230 #define CHECKBANKDATASIZE( _DATASIZE_, _ERESULT_ ) AKASSERT( _DATASIZE_ == 0 || _ERESULT_ != AK_Success );
232 #define CHECKBANKDATASIZE(_DATASIZE_, _ERESULT_ )
235 #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)
あなたのプロジェクトについて教えてください。ご不明な点はありませんか。
プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。
Wwiseからはじめよう