internal IntPtr GetProperty(AudioFilePropertyId id, uint size) { // Callers must release this! IntPtr unmanagedValue = Marshal.AllocHGlobal((int)size); SafeNativeMethods.AudioFileGetProperty(Handle, id, ref size, unmanagedValue); return(unmanagedValue); }
internal T GetProperty <T>(AudioFilePropertyId id) where T : struct { uint size = (uint)Marshal.SizeOf(typeof(T)); IntPtr unmanagedValue = Marshal.AllocHGlobal((int)size); try { SafeNativeMethods.AudioFileGetProperty(Handle, id, ref size, unmanagedValue); return(Marshal.PtrToStructure <T>(unmanagedValue)); } finally { Marshal.FreeHGlobal(unmanagedValue); } }