/// <summary>
        ///     Returns a new <see cref="AudioEndpointVolume" /> instance based on a <see cref="MMDevice" /> instance.
        /// </summary>
        /// <param name="device"><see cref="MMDevice" /> instance to create the <see cref="AudioEndpointVolume" /> for.</param>
        /// <returns>A new <see cref="AudioEndpointVolume" /> instance based on the specified <paramref name="device" />.</returns>
        public static AudioEndpointVolume FromDevice(MMDevice device)
        {
            IntPtr ptr = device.Activate(new Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), CLSCTX.CLSCTX_ALL,
                                         IntPtr.Zero);

            return(new AudioEndpointVolume(ptr));
        }
        /// <summary>
        /// Creates a new AudioMeterInformation instance for the given device.
        /// </summary>
        /// <returns>AudioMeterInformation</returns>
        public static AudioMeterInformation FromDevice(MMDevice device)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            var ptr = device.Activate(new Guid("C02216F6-8C67-4B5B-9D00-D008E73E0064"), ExecutionContext.CLSCTX_ALL, IntPtr.Zero);

            return(new AudioMeterInformation(ptr));
        }
Exemple #3
0
        /// <summary>
        /// Creates a new instance of <see cref="AudioSessionManager2"/> based on a <see cref="MMDevice"/>.
        /// </summary>
        /// <param name="device">Device to use to activate the <see cref="AudioSessionManager2"/>.</param>
        /// <returns><see cref="AudioSessionManager2"/> instance for the specified <paramref name="device"/>.</returns>
// ReSharper disable once InconsistentNaming
        public static AudioSessionManager2 FromMMDevice(MMDevice device)
        {
            return(new AudioSessionManager2(device.Activate(IID_IAudioSessionManager2, CLSCTX.CLSCTX_ALL, IntPtr.Zero)));
        }
 /// <summary>
 ///     Returns a new <see cref="AudioEndpointVolume" /> instance based on a <see cref="MMDevice" /> instance.
 /// </summary>
 /// <param name="device"><see cref="MMDevice" /> instance to create the <see cref="AudioEndpointVolume" /> for.</param>
 /// <returns>A new <see cref="AudioEndpointVolume" /> instance based on the specified <paramref name="device" />.</returns>
 public static AudioEndpointVolume FromDevice(MMDevice device)
 {
     IntPtr ptr = device.Activate(new Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), CLSCTX.CLSCTX_ALL,
         IntPtr.Zero);
     return new AudioEndpointVolume(ptr);
 }
Exemple #5
0
 /// <summary>
 /// Creates a new instance of <see cref="AudioSessionManager2"/> based on a <see cref="MMDevice"/>.
 /// </summary>
 /// <param name="device">Device to use to activate the <see cref="AudioSessionManager2"/>.</param>
 /// <returns><see cref="AudioSessionManager2"/> instance for the specified <paramref name="device"/>.</returns>
 // ReSharper disable once InconsistentNaming
 public static AudioSessionManager2 FromMMDevice(MMDevice device)
 {
     return new AudioSessionManager2(device.Activate(IID_IAudioSessionManager2, CLSCTX.CLSCTX_ALL, IntPtr.Zero));
 }
        /// <summary>
        /// Creates a new AudioMeterInformation instance for the given device.
        /// </summary>
        /// <returns>AudioMeterInformation</returns>
        public static AudioMeterInformation FromDevice(MMDevice device)
        {
            if (device == null)
                throw new ArgumentNullException("device");

            var ptr = device.Activate(new Guid("C02216F6-8C67-4B5B-9D00-D008E73E0064"), ExecutionContext.CLSCTX_ALL, IntPtr.Zero);
            return new AudioMeterInformation(ptr);
        }