mirror of
https://github.com/ppy/osu
synced 2025-01-10 08:09:40 +00:00
Handle preferred audio device correctly when it is unavailable
This commit allows loading, storing, and displaying a preferred audio device from config even when it is unavailable.
This commit is contained in:
parent
d79c8b9695
commit
d3380631e8
@ -35,6 +35,11 @@ namespace osu.Game.Overlays.Options.Sections.Audio
|
||||
var deviceItems = new List<KeyValuePair<string, string>>();
|
||||
deviceItems.Add(new KeyValuePair<string, string>("Default", string.Empty));
|
||||
deviceItems.AddRange(audio.AudioDeviceNames.Select(d => new KeyValuePair<string, string>(d, d)));
|
||||
|
||||
var preferredDeviceName = audio.AudioDevice.Value;
|
||||
if (!deviceItems.Any(kv => kv.Value == preferredDeviceName))
|
||||
deviceItems.Add(new KeyValuePair<string, string>(preferredDeviceName, preferredDeviceName));
|
||||
|
||||
dropdown.Items = deviceItems;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user