Пример #1
0
        static void SetConverterProperty <T>(IntPtr converter, AudioConverterPropertyId propertyId, T value)
            where T : struct
        {
            var unmanagedValueSize = Marshal.SizeOf(typeof(T));
            var unmanagedValue     = Marshal.AllocHGlobal(unmanagedValueSize);

            try
            {
                Marshal.StructureToPtr(value, unmanagedValue, false);
                SafeNativeMethods.AudioConverterSetProperty(converter, propertyId, (uint)unmanagedValueSize,
                                                            unmanagedValue);
            }
            finally
            {
                Marshal.FreeHGlobal(unmanagedValue);
            }
        }
Пример #2
0
 internal void SetProperty(AudioConverterPropertyId propertyId, uint size, IntPtr data) =>
 SafeNativeMethods.AudioConverterSetProperty(_handle, propertyId, size, data);