示例#1
0
 public void assign(out SOUND_INFO publicInfo)
 {
     publicInfo        = new SOUND_INFO();
     publicInfo.mode   = this.mode;
     publicInfo.exinfo = this.exinfo;
     publicInfo.exinfo.inclusionlist = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)));
     Marshal.WriteInt32(publicInfo.exinfo.inclusionlist, this.subsoundIndex);
     publicInfo.exinfo.inclusionlistnum = 1;
     publicInfo.subsoundIndex           = this.subsoundIndex;
     if (this.name_or_data != IntPtr.Zero)
     {
         int num;
         int num2;
         if ((this.mode & (MODE.OPENMEMORY | MODE.OPENMEMORY_POINT)) != MODE.DEFAULT)
         {
             publicInfo.mode = ((publicInfo.mode & ~MODE.OPENMEMORY_POINT) | MODE.OPENMEMORY);
             num             = (int)this.exinfo.fileoffset;
             publicInfo.exinfo.fileoffset = 0u;
             num2 = (int)this.exinfo.length;
         }
         else
         {
             num  = 0;
             num2 = MarshallingHelper.stringLengthUtf8(this.name_or_data) + 1;
         }
         publicInfo.name_or_data = new byte[num2];
         Marshal.Copy(new IntPtr(this.name_or_data.ToInt64() + (long)num), publicInfo.name_or_data, 0, num2);
     }
     else
     {
         publicInfo.name_or_data = null;
     }
 }
 public void assign(out SOUND_INFO publicInfo)
 {
     publicInfo = new SOUND_INFO();
     publicInfo.mode = this.mode;
     publicInfo.exinfo = this.exinfo;
     publicInfo.exinfo.inclusionlist = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)));
     Marshal.WriteInt32(publicInfo.exinfo.inclusionlist, this.subsoundIndex);
     publicInfo.exinfo.inclusionlistnum = 1;
     publicInfo.subsoundIndex = this.subsoundIndex;
     if (this.name_or_data != IntPtr.Zero)
     {
         int num;
         int num2;
         if ((this.mode & (MODE.OPENMEMORY | MODE.OPENMEMORY_POINT)) != MODE.DEFAULT)
         {
             publicInfo.mode = ((publicInfo.mode & ~MODE.OPENMEMORY_POINT) | MODE.OPENMEMORY);
             num = (int)this.exinfo.fileoffset;
             publicInfo.exinfo.fileoffset = 0u;
             num2 = (int)this.exinfo.length;
         }
         else
         {
             num = 0;
             num2 = MarshallingHelper.stringLengthUtf8(this.name_or_data) + 1;
         }
         publicInfo.name_or_data = new byte[num2];
         Marshal.Copy(new IntPtr(this.name_or_data.ToInt64() + (long)num), publicInfo.name_or_data, 0, num2);
     }
     else
     {
         publicInfo.name_or_data = null;
     }
 }
 public RESULT getSoundInfo(string key, out SOUND_INFO info)
 {
     using (StringHelper.ThreadSafeEncoding threadSafeEncoding = StringHelper.GetFreeHelper())
     {
         return(FMOD_Studio_System_GetSoundInfo(handle, threadSafeEncoding.byteFromStringUTF8(key), out info));
     }
 }
示例#4
0
        public RESULT getSoundInfo(string key, out SOUND_INFO info)
        {
            SOUND_INFO_INTERNAL sOUND_INFO_INTERNAL;
            RESULT rESULT = System.FMOD_Studio_System_GetSoundInfo(this.rawPtr, Encoding.UTF8.GetBytes(key + '\0'), out sOUND_INFO_INTERNAL);

            if (rESULT != RESULT.OK)
            {
                info = new SOUND_INFO();
                return(rESULT);
            }
            sOUND_INFO_INTERNAL.assign(out info);
            return(rESULT);
        }
示例#5
0
        public RESULT getSoundInfo(string key, out SOUND_INFO info)
        {
            SOUND_INFO_INTERNAL internalInfo;

            RESULT result = FMOD_Studio_System_GetSoundInfo(rawPtr, Encoding.UTF8.GetBytes(key + Char.MinValue), out internalInfo);
            if (result != RESULT.OK)
            {
                info = new SOUND_INFO();
                return result;
            }

            internalInfo.assign(out info);

            return result;
        }
示例#6
0
        // Helper functions
        public void assign(out SOUND_INFO publicInfo)
        {
            publicInfo = new SOUND_INFO();

            publicInfo.mode = mode;
            publicInfo.exinfo = exinfo;

            // Somewhat hacky: we know the inclusion list always points to subsoundIndex, so recreate it here
            #if NETFX_CORE
            publicInfo.exinfo.inclusionlist = Marshal.AllocHGlobal(Marshal.SizeOf<Int32>());
            #else
            publicInfo.exinfo.inclusionlist = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Int32)));
            #endif
            Marshal.WriteInt32(publicInfo.exinfo.inclusionlist, subsoundIndex);
            publicInfo.exinfo.inclusionlistnum = 1;

            publicInfo.subsoundIndex = subsoundIndex;

            if (name_or_data != IntPtr.Zero)
            {
                int offset;
                int length;

                if ((mode & (MODE.OPENMEMORY | MODE.OPENMEMORY_POINT)) != 0)
                {
                    // OPENMEMORY_POINT won't work, so force it to OPENMEMORY
                    publicInfo.mode = (publicInfo.mode & ~MODE.OPENMEMORY_POINT) | MODE.OPENMEMORY;

                    // We want the data from (name_or_data + offset) to (name_or_data + offset + length)
                    offset = (int)exinfo.fileoffset;

                    // We'll copy the data taking fileoffset into account, so reset it to 0
                    publicInfo.exinfo.fileoffset = 0;

                    length = (int)exinfo.length;
                }
                else
                {
                    offset = 0;
                    length = MarshallingHelper.stringLengthUtf8(name_or_data) + 1;
                }

                publicInfo.name_or_data = new byte[length];
                Marshal.Copy(new IntPtr(name_or_data.ToInt64() + offset), publicInfo.name_or_data, 0, length);
            }
            else
            {
                publicInfo.name_or_data = null;
            }
        }
示例#7
0
        public RESULT getSoundInfo(string key, out SOUND_INFO info)
        {
            var size = Marshal.SizeOf(typeof(SOUND_INFO_INTERNAL));
            IntPtr infoPtr = Marshal.AllocHGlobal(size);
            
            RESULT result = FMOD_Studio_System_GetSoundInfo(rawPtr, Encoding.UTF8.GetBytes(key + Char.MinValue), infoPtr);
            if (result != RESULT.OK)
            {
                Marshal.FreeHGlobal(infoPtr);
                info = new SOUND_INFO();
                return result;
            }
            SOUND_INFO_INTERNAL internalInfo = (SOUND_INFO_INTERNAL)Marshal.PtrToStructure(infoPtr, typeof(SOUND_INFO_INTERNAL));
            internalInfo.assign(out info);
            Marshal.FreeHGlobal(infoPtr);

            return result;
        }
 private static extern RESULT FMOD_Studio_System_GetSoundInfo(IntPtr studiosystem, byte[] key, out SOUND_INFO info);
示例#9
0
 public SoundInfo(SOUND_INFO info)
 {
     _fmodSoundInfo = info;
 }