private void OnDeviceStateChanged(object sender, AudioDeviceStateEventArgs e) { AudioDeviceViewModel viewModel = FindViewModel(e.Device.Id); if (viewModel != null) { viewModel.UpdateStatus(_deviceManager); OnViewModelPropertyChanged(new AudioDeviceViewModelEventArgs(viewModel)); } }
private void OnDeviceStateChanged(object sender, AudioDeviceStateEventArgs e) { if (!Settings.Default.AutoSwitchToPluggedInDevice) { return; } // NOTE: The audio stack does a pretty good job of switching inputs when an audio device // is unplugged. For example, if you plug your headphones in and we then set that to the // default device, then you unplug them, Windows will switch back to the last set default // audio device. This means that we don't need any smarts here to remember previous // devices. if (e.NewState == AudioDeviceState.Active) { _manager.SetDefaultAudioDevice(e.Device); } }