Esempio n. 1
0
        internal void RegisterDevice(EDataFlow RenderType)
        {
            if (Device != null)
            {
                try
                {
                    Device.AudioEndpointVolume.OnVolumeNotification -= VolNotify;
                    if (volEvents != null)
                    {
                        Device.AudioSessionManager.Sessions[0].UnregisterAudioSessionNotification(volEvents);
                    }
                    volEvents = null;
                }
                catch { }
                Device = null;
            }

            Device    = EndPoints.DeviceEnumerator.GetDefaultAudioEndpoint(RenderType, ERole.eMultimedia);
            Value     = Device.AudioEndpointVolume.MasterVolumeLevelScalar;
            Mute      = Device.AudioEndpointVolume.Mute;
            Stereo    = Device.AudioMeterInformation.Channels.GetCount() > 1;
            volEvents = new VolEventsHandler(this);
            Device.AudioSessionManager.Sessions[0].RegisterAudioSessionNotification(volEvents);
            Device.AudioEndpointVolume.OnVolumeNotification += VolNotify;
        }
Esempio n. 2
0
 internal VolumeBar()
 {
     InitializeComponent();
     volEvents = new VolEventsHandler(this);
     handleTip.SetToolTip(Thumb, "Master Volume");
 }