/// <summary> /// Attempts to set active device to the specified name /// </summary> /// <param name="device"></param> public bool SetActiveDevice(IAudioDevice device) { using (AppLogger.Log.InfoCall()) { AppLogger.Log.Info("Set Default device", device); if (!AppModel.Instance.SetCommunications) { device.SetAsDefault(Role.Console); device.SetAsDefault(Role.Multimedia); } else { AppLogger.Log.Info("Set Default Communication device", device); device.SetAsDefault(Role.All); } _lastDevices[device.Type] = device; return(true); } }
/// <summary> /// Attempts to set active device to the specified name /// </summary> /// <param name="device"></param> public bool SetActiveDevice(IAudioDevice device) { using (AppLogger.Log.InfoCall()) { try { AppLogger.Log.Info("Set Default device", device); if (!SetCommunications) { device.SetAsDefault(Role.Console); device.SetAsDefault(Role.Multimedia); } else { AppLogger.Log.Info("Set Default Communication device", device); device.SetAsDefault(Role.All); } switch (device.Type) { case AudioDeviceType.Playback: AppConfigs.Configuration.LastPlaybackActiveId = device.Id; break; case AudioDeviceType.Recording: AppConfigs.Configuration.LastRecordingActiveId = device.Id; break; default: throw new ArgumentOutOfRangeException(); } AppConfigs.Configuration.Save(); return(true); } catch (Exception ex) { ErrorTriggered?.Invoke(this, new ExceptionEvent(ex)); } return(false); } }
/// <summary> /// Attempts to set active device to the specified name /// </summary> /// <param name="device"></param> public bool SetActiveDevice(IAudioDevice device) { using (AppLogger.Log.InfoCall()) { try { AppLogger.Log.Info("Set Default device", device); device.SetAsDefault(Role.Console); if (SetCommunications) { AppLogger.Log.Info("Set Default Communication device", device); device.SetAsDefault(Role.Communications); } switch (device.Type) { case AudioDeviceType.Playback: AppConfigs.Configuration.LastPlaybackActive = device.FriendlyName; break; case AudioDeviceType.Recording: AppConfigs.Configuration.LastRecordingActive = device.FriendlyName; break; default: throw new ArgumentOutOfRangeException(); } AppConfigs.Configuration.Save(); return true; } catch (Exception ex) { ErrorTriggered?.Invoke(this, new ExceptionEvent(ex)); } return false; } }