public void SetFormat(WaveFormatEx wfx) { if (wfx != null) { int cb = Marshal.SizeOf(wfx); IntPtr _ptr = Marshal.AllocCoTaskMem(cb); try { Marshal.StructureToPtr(wfx, _ptr, true); SetFormat(_ptr, cb); formatType = FormatType.WaveEx; } finally { Marshal.FreeCoTaskMem(_ptr); } } }
public static void SetFormat(ref AMMediaType mt, ref WaveFormatEx wfx) { if (wfx != null) { int cb = Marshal.SizeOf(wfx); IntPtr _ptr = Marshal.AllocCoTaskMem(cb); try { Marshal.StructureToPtr(wfx, _ptr, true); SetFormat(ref mt, _ptr, cb); if (mt != null) { mt.formatType = FormatType.WaveEx; } } finally { Marshal.FreeCoTaskMem(_ptr); } } }
public WaveFormatExtensible() { Format = new WaveFormatEx(); }