public void OnDefaultDeviceChanged(DataFlow dataFlow, Role deviceRole, string defaultDeviceId) { if (dataFlow == DataFlow.Render && deviceRole == Role.Multimedia) { DefaultDeviceChanged?.Invoke(this, defaultDeviceId); } }
public void OnDefaultDeviceChanged(DataFlow flow, Role role, string defaultDeviceId) { Task.Factory.StartNew(() => { var device = _enumerator.GetDevice(defaultDeviceId); DefaultDeviceChanged?.Invoke(this, new DeviceDefaultChangedEvent(device, role)); }); }
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)); } }
private void RaiseDefaultDeviceChanged(int id) { if (SynchronizationContext.Current != _synchronizationContext) { _synchronizationContext.Post(o => DefaultDeviceChanged?.Invoke(this, id), null); } else { DefaultDeviceChanged.Invoke(this, id); } }
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); }); }; }
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); } }
/// <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; }
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(); }
protected virtual void OnDefaultDeviceChanged() { DefaultDeviceChanged?.Invoke(this, EventArgs.Empty); }
void NotifyDefaultDeviceChanged(DataFlow flow) { _Context.Send( x => DefaultDeviceChanged?.Invoke(this, flow) , null); }
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); }