2017-02-06 19:26:32 +08:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-02-06 08:22:37 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Audio;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
2017-02-06 19:26:32 +08:00
|
|
|
|
namespace osu.Game.Overlays.Options.Sections.Audio
|
|
|
|
|
{
|
|
|
|
|
public class AudioDevicesOptions : OptionsSubsection
|
|
|
|
|
{
|
|
|
|
|
protected override string Header => "Devices";
|
|
|
|
|
|
|
|
|
|
private AudioManager audio;
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2017-02-06 08:22:37 +08:00
|
|
|
|
private void load(AudioManager audio)
|
|
|
|
|
{
|
|
|
|
|
this.audio = audio;
|
2017-02-06 19:26:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-06 08:22:37 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
var deviceItems = new List<KeyValuePair<string, string>>();
|
2017-02-06 19:26:32 +08:00
|
|
|
|
deviceItems.Add(new KeyValuePair<string, string>("Default", string.Empty));
|
2017-02-06 08:22:37 +08:00
|
|
|
|
deviceItems.AddRange(audio.GetDeviceNames().Select(d => new KeyValuePair<string, string>(d, d)));
|
2017-02-06 19:26:32 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OptionDropDown<string>()
|
2017-02-06 08:22:37 +08:00
|
|
|
|
{
|
|
|
|
|
Items = deviceItems,
|
|
|
|
|
Bindable = audio.AudioDevice
|
2017-02-06 19:26:32 +08:00
|
|
|
|
},
|
2017-02-06 08:22:37 +08:00
|
|
|
|
};
|
2017-02-06 19:26:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-03 12:26:49 +08:00
|
|
|
|
}
|