0
0
Fork 0

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.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks;
using GUI = Gtk.Builder.ObjectAttribute; using GUI = Gtk.Builder.ObjectAttribute;
@ -198,15 +199,32 @@ namespace Ryujinx.Ui
_systemTimeZoneSelect.Append(locationName, locationName); _systemTimeZoneSelect.Append(locationName, locationName);
} }
_audioBackendSelect.Append(AudioBackend.Dummy.ToString(), AudioBackend.Dummy.ToString()); Task.Run(() =>
{
if (SoundIoAudioOut.IsSupported) if (SoundIoAudioOut.IsSupported)
{
Application.Invoke(delegate
{
_audioBackendSelect.Append(AudioBackend.SoundIo.ToString(), "SoundIO"); _audioBackendSelect.Append(AudioBackend.SoundIo.ToString(), "SoundIO");
});
}
if (OpenALAudioOut.IsSupported) if (OpenALAudioOut.IsSupported)
{
Application.Invoke(delegate
{
_audioBackendSelect.Append(AudioBackend.OpenAl.ToString(), "OpenAL"); _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()); _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString());
_systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString()); _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
_audioBackendSelect.SetActiveId(ConfigurationState.Instance.System.AudioBackend.Value.ToString());
_systemTimeZoneSelect.SetActiveId(timeZoneContentManager.SanityCheckDeviceLocationName()); _systemTimeZoneSelect.SetActiveId(timeZoneContentManager.SanityCheckDeviceLocationName());
_resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString()); _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString());
_anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());

View file

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