public static IntPtr MarshalToPtr(WaveFormat format) { int formatSize = Marshal.SizeOf(format); IntPtr formatPointer = Marshal.AllocHGlobal(formatSize); Marshal.StructureToPtr(format, formatPointer, false); return formatPointer; }
/// <summary> /// Marshal managed to native /// </summary> public IntPtr MarshalManagedToNative(object ManagedObj) { return(WaveFormat.MarshalToPtr((WaveFormat)ManagedObj)); }