mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 18:12:56 +08:00
Allow audio device selection in settings
This commit is contained in:
parent
b4f30dd417
commit
ae03ef0787
@ -1,18 +1,41 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Audio
|
||||
{
|
||||
public class AudioDevicesOptions : OptionsSubsection
|
||||
{
|
||||
protected override string Header => "Devices";
|
||||
|
||||
public AudioDevicesOptions()
|
||||
{
|
||||
Children = new[]
|
||||
private AudioManager audio;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
this.audio = audio;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
var deviceItems = new List<KeyValuePair<string, string>>();
|
||||
deviceItems.Add(new KeyValuePair<string, string>("Standard", ""));
|
||||
deviceItems.AddRange(audio.GetDeviceNames().Select(d => new KeyValuePair<string, string>(d, d)));
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OptionLabel { Text = "Output device: TODO dropdown" }
|
||||
};
|
||||
new OptionDropDown<string>()
|
||||
{
|
||||
Items = deviceItems,
|
||||
Bindable = audio.AudioDevice
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user