public static AKRESULT PrepareGameSyncs(PreparationType in_PreparationType, AkGroupType in_eGameSyncType, string in_pszGroupName, string [] in_ppszGameSyncName, uint in_uNumGameSyncs, AkCallbackManager.BankCallback in_pfnBankCallback, object in_pCookie) { //Find the required size int size = 0; foreach(string s in in_ppszGameSyncName) size += s.Length + 1; int sizeofChar = 2; //Unicode IntPtr pMem = Marshal.AllocHGlobal(size * sizeofChar); //Write the length of array Marshal.WriteInt16(pMem, (short)in_ppszGameSyncName.Length); IntPtr pCurrent = (IntPtr)(pMem.ToInt64() + sizeofChar); //Copy the strings one after the other. foreach(string s in in_ppszGameSyncName) { Marshal.Copy(s.ToCharArray(), 0, pCurrent, s.Length); pCurrent = (IntPtr)(pCurrent.ToInt64() + sizeofChar * s.Length); Marshal.WriteInt16(pCurrent, 0); //Null-terminated string pCurrent = (IntPtr)(pCurrent.ToInt64() + sizeofChar); } in_pCookie = new AkCallbackManager.BankCallbackPackage(in_pfnBankCallback, in_pCookie); try { AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareGameSyncs__SWIG_2((int)in_PreparationType, (int)in_eGameSyncType, in_pszGroupName, pMem, in_uNumGameSyncs, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode()); return ret; } finally { Marshal.FreeHGlobal(pMem); } }
public static AKRESULT PrepareGameSyncs(PreparationType in_PreparationType, AkGroupType in_eGameSyncType, uint in_GroupID, uint[] in_paGameSyncID, uint in_uNumGameSyncs, AkCallbackManager.BankCallback in_pfnBankCallback, object in_pCookie) { in_pCookie = new AkCallbackManager.BankCallbackPackage(in_pfnBankCallback, in_pCookie); { AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareGameSyncs__SWIG_3((int)in_PreparationType, (int)in_eGameSyncType, in_GroupID, in_paGameSyncID, in_uNumGameSyncs, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode()); return ret; } }
public static AKRESULT PrepareGameSyncs(PreparationType in_PreparationType, AkGroupType in_eGameSyncType, uint in_GroupID, uint[] in_paGameSyncID, uint in_uNumGameSyncs) { AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareGameSyncs__SWIG_1((int)in_PreparationType, (int)in_eGameSyncType, in_GroupID, in_paGameSyncID, in_uNumGameSyncs); return ret; }