From 21dfa4974a6697fff6a476a87a2d31d408f74e0d Mon Sep 17 00:00:00 2001 From: Xpl0itR Date: Tue, 21 Jul 2020 04:33:23 +0100 Subject: [PATCH] A couple fixes for the audio backend GUI option (#1360) * Detect available audio backends in the gui on a separate thread and hardcode dummy backend in the dropdown and select it by default * Use a Task rather than a Thread * Modify UI on UI thread --- Ryujinx/Ui/SettingsWindow.cs | 30 ++++++++++++++++++++++++------ Ryujinx/Ui/SettingsWindow.glade | 4 ++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Ryujinx/Ui/SettingsWindow.cs b/Ryujinx/Ui/SettingsWindow.cs index a278f0949..493260c31 100644 --- a/Ryujinx/Ui/SettingsWindow.cs +++ b/Ryujinx/Ui/SettingsWindow.cs @@ -11,6 +11,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; +using System.Threading.Tasks; using GUI = Gtk.Builder.ObjectAttribute; @@ -198,15 +199,32 @@ namespace Ryujinx.Ui _systemTimeZoneSelect.Append(locationName, locationName); } - _audioBackendSelect.Append(AudioBackend.Dummy.ToString(), AudioBackend.Dummy.ToString()); - if (SoundIoAudioOut.IsSupported) - _audioBackendSelect.Append(AudioBackend.SoundIo.ToString(), "SoundIO"); - if (OpenALAudioOut.IsSupported) - _audioBackendSelect.Append(AudioBackend.OpenAl.ToString(), "OpenAL"); + Task.Run(() => + { + if (SoundIoAudioOut.IsSupported) + { + Application.Invoke(delegate + { + _audioBackendSelect.Append(AudioBackend.SoundIo.ToString(), "SoundIO"); + }); + } + + if (OpenALAudioOut.IsSupported) + { + Application.Invoke(delegate + { + _audioBackendSelect.Append(AudioBackend.OpenAl.ToString(), "OpenAL"); + }); + } + + Application.Invoke(delegate + { + _audioBackendSelect.SetActiveId(ConfigurationState.Instance.System.AudioBackend.Value.ToString()); + }); + }); _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString()); _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString()); - _audioBackendSelect.SetActiveId(ConfigurationState.Instance.System.AudioBackend.Value.ToString()); _systemTimeZoneSelect.SetActiveId(timeZoneContentManager.SanityCheckDeviceLocationName()); _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); diff --git a/Ryujinx/Ui/SettingsWindow.glade b/Ryujinx/Ui/SettingsWindow.glade index 1e91011ec..d4877a3a5 100644 --- a/Ryujinx/Ui/SettingsWindow.glade +++ b/Ryujinx/Ui/SettingsWindow.glade @@ -1494,6 +1494,10 @@ False Change Audio Backend 5 + Dummy + + Dummy + False