/// <summary> /// Returns a new instance of the <see cref="AudioClient" /> class. /// </summary> /// <param name="device">Device which should be used to create the <see cref="AudioClient" /> instance.</param> /// <returns><see cref="AudioClient" /> instance.</returns> // ReSharper disable once InconsistentNaming public static AudioClient FromMMDevice(MMDevice device) { if (device == null) throw new ArgumentNullException("device"); IntPtr ptr; int result = device.ActivateNative(IID_IAudioClient, CLSCTX.CLSCTX_ALL, IntPtr.Zero, out ptr); CoreAudioAPIException.Try(result, "IMMDevice", "Activate"); return new AudioClient(ptr); }
public static AudioClient FromMMDevice(MMDevice device) { if (device == null) throw new ArgumentNullException("device"); IntPtr ptr; int result = device.ActivateNative(IID_IAudioClient, ExecutionContext.CLSCTX_ALL, IntPtr.Zero, out ptr); CoreAudioAPIException.Try(result, "IMMDevice", "Activate"); return new AudioClient(ptr); }