コード例 #1
0
ファイル: AudioClient.cs プロジェクト: noah4477/HardwareMixer
        /// <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);
        }
コード例 #2
0
ファイル: AudioClient.cs プロジェクト: CheViana/AudioLab
        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);
        }