Ejemplo n.º 1
0
        static AudioConverterStatus SetConverterProperty <T>(IntPtr converter, AudioConverterPropertyId propertyId, T value) where T : struct
        {
            Contract.Requires(converter != IntPtr.Zero);

            IntPtr unmanagedValue = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(T)));

            try
            {
                Marshal.StructureToPtr(value, unmanagedValue, false);
                return(SafeNativeMethods.AudioConverterSetProperty(converter, propertyId, (uint)Marshal.SizeOf(typeof(T)), unmanagedValue));
            }
            finally
            {
                Marshal.FreeHGlobal(unmanagedValue);
            }
        }
 internal AudioConverterStatus SetProperty(AudioConverterPropertyId propertyId, uint size, IntPtr data)
 {
     return(SafeNativeMethods.AudioConverterSetProperty(_handle, propertyId, size, data));
 }