Пример #1
0
 public void OnDefaultDeviceChanged(DataFlow dataFlow, Role deviceRole, string defaultDeviceId)
 {
     if (dataFlow == DataFlow.Render && deviceRole == Role.Multimedia)
     {
         DefaultDeviceChanged?.Invoke(this, defaultDeviceId);
     }
 }
Пример #2
0
 public void OnDefaultDeviceChanged(DataFlow flow, Role role, string defaultDeviceId)
 {
     Task.Factory.StartNew(() =>
     {
         var device = _enumerator.GetDevice(defaultDeviceId);
         DefaultDeviceChanged?.Invoke(this, new DeviceDefaultChangedEvent(device, role));
     });
 }
Пример #3
0
 public void OnDefaultDeviceChanged(DataFlow flow, Role role, string defaultDeviceId)
 {
     using (var enumerator = new MMDeviceEnumerator())
     {
         var device = enumerator.GetDevice(defaultDeviceId);
         DefaultDeviceChanged?.Invoke(this, new DeviceDefaultChangedEvent(device, (DeviceRole)role));
     }
 }
Пример #4
0
 private void RaiseDefaultDeviceChanged(int id)
 {
     if (SynchronizationContext.Current != _synchronizationContext)
     {
         _synchronizationContext.Post(o => DefaultDeviceChanged?.Invoke(this, id), null);
     }
     else
     {
         DefaultDeviceChanged.Invoke(this, id);
     }
 }
Пример #5
0
        private AppModel()
        {
            _notificationManager = new NotificationManager(this);

            _deviceCyclerManager = new DeviceCyclerManager();
            MMNotificationClient.Instance.DefaultDeviceChanged += (sender, @event) =>
            {
                _dispatcher.Debounce(250, o =>
                {
                    Log.Information(@"[WINAPI] Default device changed to {device}:{role}", @event.Device, @event.Role);
                    DefaultDeviceChanged?.Invoke(sender, @event);
                });
            };
        }
Пример #6
0
 private void RaiseDefaultDeviceChanged(int id, DeviceFlow deviceFlow)
 {
     if (_stopping)
     {
         return;
     }
     if (SynchronizationContext.Current != _synchronizationContext)
     {
         _synchronizationContext.Post(o => DefaultDeviceChanged?.Invoke(this, id, deviceFlow), null);
     }
     else
     {
         DefaultDeviceChanged.Invoke(this, id, deviceFlow);
     }
 }
Пример #7
0
        /// <summary>
        /// The OnDefaultDeviceChanged method notifies the client that the default audio endpoint
        /// device for a particular device role has changed.
        /// </summary>
        /// <param name="dataFlow">The data-flow direction of the endpoint device.</param>
        /// <param name="role">The device role of the audio endpoint device.</param>
        /// <param name="deviceId">The device id that identifies the audio endpoint device.</param>
        /// <returns>HRESULT</returns>
        void IMMNotificationClient.OnDefaultDeviceChanged(DataFlow dataFlow, Role role, string deviceId)
        {
            DefaultDeviceChanged?.Invoke(this, new DefaultDeviceChangedEventArgs(deviceId, dataFlow, role));

            //return (int) HResult.S_OK;
        }
Пример #8
0
        private AppModel()
        {
            RegisterForRestart();
            RegisterRecovery();
            _notificationManager = new NotificationManager(this);

            _deviceCyclerManager = new DeviceCyclerManager();
            MMNotificationClient.Instance.DefaultDeviceChanged += (sender, @event) => { _dispatcher.Debounce(250, o => { DefaultDeviceChanged?.Invoke(sender, @event); }); };
        }
 public void OnDefaultDeviceChanged(EDataFlow dataFlow, ERole deviceRole, string pwstrDefaultDeviceId)
 {
     Debug.WriteLine("Audio device changed!");
     DefaultDeviceChanged?.Invoke();
 }
Пример #10
0
 protected virtual void OnDefaultDeviceChanged()
 {
     DefaultDeviceChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #11
0
 void NotifyDefaultDeviceChanged(DataFlow flow)
 {
     _Context.Send(
         x => DefaultDeviceChanged?.Invoke(this, flow)
         , null);
 }
Пример #12
0
 public void OnDefaultDeviceChanged(DataFlow flow, Role role, string defaultDeviceId) => DefaultDeviceChanged?.Invoke(this, new DefaultDeviceChangedEventArgs(flow, role, defaultDeviceId));
 public void OnDefaultDeviceChanged(DataFlow flow, Role role, string defaultDeviceId)
 {
     DefaultDeviceChanged?.Invoke(this, EventArgs.Empty);
 }