Esempio n. 1
0
        internal IntPtr GetProperty(AudioFilePropertyId id, uint size)
        {
            // Callers must release this!
            var unmanagedValue = Marshal.AllocHGlobal((int)size);

            SafeNativeMethods.AudioFileGetProperty(Handle, id, ref size, unmanagedValue);
            return(unmanagedValue);
        }
Esempio n. 2
0
        internal T GetProperty <T>(AudioFilePropertyId id) where T : unmanaged
        {
            var size           = (uint)Marshal.SizeOf(typeof(T));
            var unmanagedValue = Marshal.AllocHGlobal((int)size);

            try
            {
                SafeNativeMethods.AudioFileGetProperty(Handle, id, ref size, unmanagedValue);
                return(Marshal.PtrToStructure <T>(unmanagedValue));
            }
            finally
            {
                Marshal.FreeHGlobal(unmanagedValue);
            }
        }