示例#1
0
        /// <summary>
        ///     Creates a new Audio endpoint volume
        /// </summary>
        /// <param name="realEndpointVolume">IAudioEndpointVolume COM interface</param>
        internal AudioEndpointVolume(IAudioEndpointVolume realEndpointVolume)
        {
            ComThread.Assert();
            uint hardwareSupp;

            _audioEndPointVolume = realEndpointVolume;
            _channels            = new AudioEndpointVolumeChannels(_audioEndPointVolume);
            _stepInformation     = new AudioEndpointVolumeStepInformation(_audioEndPointVolume);
            Marshal.ThrowExceptionForHR(_audioEndPointVolume.QueryHardwareSupport(out hardwareSupp));
            _hardwareSupport = (EndpointHardwareSupport)hardwareSupp;
            _volumeRange     = new AudioEndpointVolumeVolumeRange(_audioEndPointVolume);

            _callBack = new AudioEndpointVolumeCallback(this);
            Marshal.ThrowExceptionForHR(_audioEndPointVolume.RegisterControlChangeNotify(_callBack));
        }
        /// <summary>
        ///     Creates a new Audio endpoint volume
        /// </summary>
        /// <param name="realEndpointVolume">IAudioEndpointVolume COM interface</param>
        internal AudioEndpointVolume(IAudioEndpointVolume realEndpointVolume)
        {
            ComThread.Assert();
            uint hardwareSupp;

            _audioEndPointVolume = realEndpointVolume;
            _channels = new AudioEndpointVolumeChannels(_audioEndPointVolume);
            _stepInformation = new AudioEndpointVolumeStepInformation(_audioEndPointVolume);
            Marshal.ThrowExceptionForHR(_audioEndPointVolume.QueryHardwareSupport(out hardwareSupp));
            _hardwareSupport = (EndpointHardwareSupport)hardwareSupp;
            _volumeRange = new AudioEndpointVolumeVolumeRange(_audioEndPointVolume);

            _callBack = new AudioEndpointVolumeCallback(this);
            Marshal.ThrowExceptionForHR(_audioEndPointVolume.RegisterControlChangeNotify(_callBack));
        }