public RESULT getCommandString(int commandIndex, out string description)
        {
            description = null;
            using (StringHelper.ThreadSafeEncoding threadSafeEncoding = StringHelper.GetFreeHelper())
            {
                int    num    = 256;
                IntPtr intPtr = Marshal.AllocHGlobal(256);
                RESULT rESULT = FMOD_Studio_CommandReplay_GetCommandString(handle, commandIndex, intPtr, num);
                while (true)
                {
                    switch (rESULT)
                    {
                    case RESULT.ERR_TRUNCATED:
                        break;

                    case RESULT.OK:
                        description = threadSafeEncoding.stringFromNative(intPtr);
                        goto default;

                    default:
                        Marshal.FreeHGlobal(intPtr);
                        return(rESULT);
                    }
                    Marshal.FreeHGlobal(intPtr);
                    num   *= 2;
                    intPtr = Marshal.AllocHGlobal(num);
                    rESULT = FMOD_Studio_CommandReplay_GetCommandString(handle, commandIndex, intPtr, num);
                }
            }
        }
Esempio n. 2
0
 public RESULT getPath(out string path)
 {
     path = null;
     using (StringHelper.ThreadSafeEncoding threadSafeEncoding = StringHelper.GetFreeHelper())
     {
         IntPtr intPtr    = Marshal.AllocHGlobal(256);
         int    retrieved = 0;
         RESULT rESULT    = FMOD_Studio_VCA_GetPath(handle, intPtr, 256, out retrieved);
         if (rESULT == RESULT.ERR_TRUNCATED)
         {
             Marshal.FreeHGlobal(intPtr);
             intPtr = Marshal.AllocHGlobal(retrieved);
             rESULT = FMOD_Studio_VCA_GetPath(handle, intPtr, retrieved, out retrieved);
         }
         if (rESULT == RESULT.OK)
         {
             path = threadSafeEncoding.stringFromNative(intPtr);
         }
         Marshal.FreeHGlobal(intPtr);
         return(rESULT);
     }
 }