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
This commit is contained in:
Xpl0itR 2020-07-21 04:33:23 +01:00 committed by GitHub
parent 723ae240dc
commit 21dfa4974a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 6 deletions

View file

@ -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());

View file

@ -1494,6 +1494,10 @@
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Change Audio Backend</property>
<property name="margin_left">5</property>
<property name="active_id">Dummy</property>
<items>
<item id="Dummy" translatable="yes">Dummy</item>
</items>
</object>
<packing>
<property name="expand">False</property>