public AudioPlaybackSettingsViewModel() { PlaybackProviders = Modules.Playback; IAudioPlaybackProvider savedPlaybackProvider = Modules.Playback.FirstOrDefault(p => p.GetType().GetSimpleName() == Settings.PlaybackProvider); if (savedPlaybackProvider == null) { CurrentPlaybackProvider = Modules.Playback.FirstOrDefault(); } else { CurrentPlaybackProvider = savedPlaybackProvider; if (Settings.PlaybackDevice != null) { var setDevice = PlaybackDevices.FirstOrDefault(d => d.Device.Name == Settings.PlaybackDevice); if (setDevice != null) { CurrentPlaybackDevice = setDevice; } } } Volume = Settings.GlobalVolume * 100; }
private void UpdatePlayback() { Log.Information("Refreshing playback device of state {@State}", _state); using var enumerator = new MMDeviceEnumerator(); PlaybackDevices = CreateDeviceList(enumerator.EnumerateAudioEndPoints(DataFlow.Render, _state)); Log.Information("Refreshed playbacks: {@Playbacks}", PlaybackDevices.Select(info => new { Name = info.Name, Id = info.Id })); }
/// <summary> /// Called when one or more devices are no longer available /// </summary> /// <param name="devices"></param> public void UnavailableDevices(PlaybackDevices devices) => devices.DeviceCollection.ForEach(device => BasePlayback.DeviceNotAvailable(device));
/// <summary> /// Called to report the available devices - when registration is first made /// </summary> /// <param name="devices"></param> public void AvailableDevices(PlaybackDevices devices) => devices.DeviceCollection.ForEach(device => BasePlayback.NewDeviceDetected(device));
/// <summary> /// Called when one or more devices are no longer available /// </summary> /// <param name="devices"></param> public void UnavailableDevices(PlaybackDevices devices) => devices.DeviceCollection.ForEach(device => PlaybackSelectionController.DeviceNotAvailable(device));
/// <summary> /// Called to report the available devices - when registration is first made /// </summary> /// <param name="devices"></param> public void AvailableDevices(PlaybackDevices devices) => devices.DeviceCollection.ForEach(device => PlaybackSelectionController.NewDeviceDetected(device));