public AITalkResultCode GetParam(ref AITalk_TTtsParam param) { uint num; AITalkResultCode code = AITalkAPI.GetParam(IntPtr.Zero, out num); this.OnWriteLog("[AITalkAPI_GetParam] " + code); if (code == AITalkResultCode.AITALKERR_INSUFFICIENT) { IntPtr ptr = Marshal.AllocCoTaskMem((int)num); Marshal.WriteInt32(ptr, (int)num); code = AITalkAPI.GetParam(ptr, out num); this.OnWriteLog("[AITalkAPI_GetParam] " + code); if (code != AITalkResultCode.AITALKERR_SUCCESS) { Marshal.FreeCoTaskMem(ptr); return(code); } param = AITalkMarshal.IntPtrToTTtsParam(ptr); Marshal.FreeCoTaskMem(ptr); } return(code); }