1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-10-01 12:30:00 +02:00

Implement audio backend configuration option (#1325)

* Implement audio backend configuration option

* Use OpenAL by default

* Increment version number in config.json

and add 30px to the height of the settings window

* nits

* capitalise audio backend names
This commit is contained in:
Xpl0itR 2020-07-04 00:16:49 +01:00 committed by GitHub
parent af72875bee
commit 7cb6532971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 152 additions and 54 deletions

View file

@ -0,0 +1,9 @@
namespace Ryujinx.Configuration
{
public enum AudioBackend
{
Dummy,
OpenAl,
SoundIo
}
}

View file

@ -13,7 +13,7 @@ namespace Ryujinx.Configuration
/// <summary> /// <summary>
/// The current version of the file format /// The current version of the file format
/// </summary> /// </summary>
public const int CurrentVersion = 9; public const int CurrentVersion = 10;
public int Version { get; set; } public int Version { get; set; }
@ -127,6 +127,11 @@ namespace Ryujinx.Configuration
/// </summary> /// </summary>
public int FsGlobalAccessLogMode { get; set; } public int FsGlobalAccessLogMode { get; set; }
/// <summary>
/// The selected audio backend
/// </summary>
public AudioBackend AudioBackend { get; set; }
/// <summary> /// <summary>
/// Enable or disable ignoring missing services /// Enable or disable ignoring missing services
/// </summary> /// </summary>

View file

@ -205,6 +205,11 @@ namespace Ryujinx.Configuration
/// </summary> /// </summary>
public ReactiveObject<int> FsGlobalAccessLogMode { get; private set; } public ReactiveObject<int> FsGlobalAccessLogMode { get; private set; }
/// <summary>
/// The selected audio backend
/// </summary>
public ReactiveObject<AudioBackend> AudioBackend { get; private set; }
/// <summary> /// <summary>
/// Enable or disable ignoring missing services /// Enable or disable ignoring missing services
/// </summary> /// </summary>
@ -221,6 +226,7 @@ namespace Ryujinx.Configuration
EnablePtc = new ReactiveObject<bool>(); EnablePtc = new ReactiveObject<bool>();
EnableFsIntegrityChecks = new ReactiveObject<bool>(); EnableFsIntegrityChecks = new ReactiveObject<bool>();
FsGlobalAccessLogMode = new ReactiveObject<int>(); FsGlobalAccessLogMode = new ReactiveObject<int>();
AudioBackend = new ReactiveObject<AudioBackend>();
IgnoreMissingServices = new ReactiveObject<bool>(); IgnoreMissingServices = new ReactiveObject<bool>();
} }
} }
@ -370,6 +376,7 @@ namespace Ryujinx.Configuration
EnablePtc = System.EnablePtc, EnablePtc = System.EnablePtc,
EnableFsIntegrityChecks = System.EnableFsIntegrityChecks, EnableFsIntegrityChecks = System.EnableFsIntegrityChecks,
FsGlobalAccessLogMode = System.FsGlobalAccessLogMode, FsGlobalAccessLogMode = System.FsGlobalAccessLogMode,
AudioBackend = System.AudioBackend,
IgnoreMissingServices = System.IgnoreMissingServices, IgnoreMissingServices = System.IgnoreMissingServices,
GuiColumns = new GuiColumns GuiColumns = new GuiColumns
{ {
@ -425,6 +432,7 @@ namespace Ryujinx.Configuration
System.EnablePtc.Value = false; System.EnablePtc.Value = false;
System.EnableFsIntegrityChecks.Value = true; System.EnableFsIntegrityChecks.Value = true;
System.FsGlobalAccessLogMode.Value = 0; System.FsGlobalAccessLogMode.Value = 0;
System.AudioBackend.Value = AudioBackend.OpenAl;
System.IgnoreMissingServices.Value = false; System.IgnoreMissingServices.Value = false;
Ui.GuiColumns.FavColumn.Value = true; Ui.GuiColumns.FavColumn.Value = true;
Ui.GuiColumns.IconColumn.Value = true; Ui.GuiColumns.IconColumn.Value = true;
@ -547,7 +555,8 @@ namespace Ryujinx.Configuration
Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 6."); Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 6.");
configurationFileFormat.ControllerConfig = new List<ControllerConfig>(); configurationFileFormat.ControllerConfig = new List<ControllerConfig>();
configurationFileFormat.KeyboardConfig = new List<KeyboardConfig>{ configurationFileFormat.KeyboardConfig = new List<KeyboardConfig>
{
new KeyboardConfig new KeyboardConfig
{ {
Index = 0, Index = 0,
@ -634,15 +643,18 @@ namespace Ryujinx.Configuration
configurationFileUpdated = true; configurationFileUpdated = true;
} }
if (configurationFileFormat.Version < 10)
{
Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 10.");
configurationFileFormat.AudioBackend = AudioBackend.OpenAl;
configurationFileUpdated = true;
}
List<InputConfig> inputConfig = new List<InputConfig>(); List<InputConfig> inputConfig = new List<InputConfig>();
foreach (ControllerConfig controllerConfig in configurationFileFormat.ControllerConfig) inputConfig.AddRange(configurationFileFormat.ControllerConfig);
{ inputConfig.AddRange(configurationFileFormat.KeyboardConfig);
inputConfig.Add(controllerConfig);
}
foreach (KeyboardConfig keyboardConfig in configurationFileFormat.KeyboardConfig)
{
inputConfig.Add(keyboardConfig);
}
Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy; Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy;
Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath; Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath;
@ -660,13 +672,13 @@ namespace Ryujinx.Configuration
System.TimeZone.Value = configurationFileFormat.SystemTimeZone; System.TimeZone.Value = configurationFileFormat.SystemTimeZone;
System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset; System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset;
System.EnableDockedMode.Value = configurationFileFormat.DockedMode; System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration; EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync; Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
System.EnableMulticoreScheduling.Value = configurationFileFormat.EnableMulticoreScheduling; System.EnableMulticoreScheduling.Value = configurationFileFormat.EnableMulticoreScheduling;
System.EnablePtc.Value = configurationFileFormat.EnablePtc; System.EnablePtc.Value = configurationFileFormat.EnablePtc;
System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks; System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks;
System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode; System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode;
System.AudioBackend.Value = configurationFileFormat.AudioBackend;
System.IgnoreMissingServices.Value = configurationFileFormat.IgnoreMissingServices; System.IgnoreMissingServices.Value = configurationFileFormat.IgnoreMissingServices;
Ui.GuiColumns.FavColumn.Value = configurationFileFormat.GuiColumns.FavColumn; Ui.GuiColumns.FavColumn.Value = configurationFileFormat.GuiColumns.FavColumn;
Ui.GuiColumns.IconColumn.Value = configurationFileFormat.GuiColumns.IconColumn; Ui.GuiColumns.IconColumn.Value = configurationFileFormat.GuiColumns.IconColumn;

View file

@ -1,5 +1,5 @@
{ {
"version": 9, "version": 10,
"max_anisotropy": -1, "max_anisotropy": -1,
"graphics_shaders_dump_path": "", "graphics_shaders_dump_path": "",
"logging_enable_debug": false, "logging_enable_debug": false,
@ -22,6 +22,7 @@
"enable_ptc": false, "enable_ptc": false,
"enable_fs_integrity_checks": true, "enable_fs_integrity_checks": true,
"fs_global_access_log_mode": 0, "fs_global_access_log_mode": 0,
"audio_backend": "OpenAl",
"ignore_missing_services": false, "ignore_missing_services": false,
"gui_columns": { "gui_columns": {
"fav_column": true, "fav_column": true,

View file

@ -647,25 +647,33 @@ namespace Ryujinx.Ui
return new Renderer(); return new Renderer();
} }
/// <summary>
/// Picks an <see cref="IAalOutput"/> audio output renderer supported on this machine
/// </summary>
/// <returns>An <see cref="IAalOutput"/> supported by this machine</returns>
private static IAalOutput InitializeAudioEngine() private static IAalOutput InitializeAudioEngine()
{ {
if (OpenALAudioOut.IsSupported) if (ConfigurationState.Instance.System.AudioBackend.Value == AudioBackend.SoundIo)
{ {
return new OpenALAudioOut(); if (SoundIoAudioOut.IsSupported)
}
else if (SoundIoAudioOut.IsSupported)
{ {
return new SoundIoAudioOut(); return new SoundIoAudioOut();
} }
else else
{ {
return new DummyAudioOut(); Logger.PrintWarning(LogClass.Audio, "SoundIO is not supported, falling back to dummy audio out.");
} }
} }
else if (ConfigurationState.Instance.System.AudioBackend.Value == AudioBackend.OpenAl)
{
if (OpenALAudioOut.IsSupported)
{
return new OpenALAudioOut();
}
else
{
Logger.PrintWarning(LogClass.Audio, "OpenAL is not supported, falling back to dummy audio out.");
}
}
return new DummyAudioOut();
}
//Events //Events
private void Application_Added(object sender, ApplicationAddedEventArgs args) private void Application_Added(object sender, ApplicationAddedEventArgs args)

View file

@ -1,5 +1,7 @@
using Gtk; using Gtk;
using Ryujinx.Audio;
using Ryujinx.Configuration; using Ryujinx.Configuration;
using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Configuration.System; using Ryujinx.Configuration.System;
using Ryujinx.HLE.HOS.Services.Time.TimeZone; using Ryujinx.HLE.HOS.Services.Time.TimeZone;
using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.FileSystem;
@ -9,7 +11,7 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using Ryujinx.Common.Configuration.Hid;
using GUI = Gtk.Builder.ObjectAttribute; using GUI = Gtk.Builder.ObjectAttribute;
namespace Ryujinx.Ui namespace Ryujinx.Ui
@ -42,6 +44,7 @@ namespace Ryujinx.Ui
[GUI] ComboBoxText _systemLanguageSelect; [GUI] ComboBoxText _systemLanguageSelect;
[GUI] ComboBoxText _systemRegionSelect; [GUI] ComboBoxText _systemRegionSelect;
[GUI] ComboBoxText _systemTimeZoneSelect; [GUI] ComboBoxText _systemTimeZoneSelect;
[GUI] ComboBoxText _audioBackendSelect;
[GUI] SpinButton _systemTimeYearSpin; [GUI] SpinButton _systemTimeYearSpin;
[GUI] SpinButton _systemTimeMonthSpin; [GUI] SpinButton _systemTimeMonthSpin;
[GUI] SpinButton _systemTimeDaySpin; [GUI] SpinButton _systemTimeDaySpin;
@ -191,8 +194,15 @@ namespace Ryujinx.Ui
_systemTimeZoneSelect.Append(locationName, locationName); _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");
_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());
_anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());
@ -417,6 +427,7 @@ namespace Ryujinx.Ui
ConfigurationState.Instance.Ui.EnableCustomTheme.Value = _custThemeToggle.Active; ConfigurationState.Instance.Ui.EnableCustomTheme.Value = _custThemeToggle.Active;
ConfigurationState.Instance.System.Language.Value = Enum.Parse<Language>(_systemLanguageSelect.ActiveId); ConfigurationState.Instance.System.Language.Value = Enum.Parse<Language>(_systemLanguageSelect.ActiveId);
ConfigurationState.Instance.System.Region.Value = Enum.Parse<Configuration.System.Region>(_systemRegionSelect.ActiveId); ConfigurationState.Instance.System.Region.Value = Enum.Parse<Configuration.System.Region>(_systemRegionSelect.ActiveId);
ConfigurationState.Instance.System.AudioBackend.Value = Enum.Parse<AudioBackend>(_audioBackendSelect.ActiveId);
ConfigurationState.Instance.System.TimeZone.Value = _systemTimeZoneSelect.ActiveId; ConfigurationState.Instance.System.TimeZone.Value = _systemTimeZoneSelect.ActiveId;
ConfigurationState.Instance.System.SystemTimeOffset.Value = _systemTimeOffset; ConfigurationState.Instance.System.SystemTimeOffset.Value = _systemTimeOffset;
ConfigurationState.Instance.Ui.CustomThemePath.Value = _custThemePath.Buffer.Text; ConfigurationState.Instance.Ui.CustomThemePath.Value = _custThemePath.Buffer.Text;

View file

@ -7,13 +7,41 @@
<property name="step_increment">1</property> <property name="step_increment">1</property>
<property name="page_increment">10</property> <property name="page_increment">10</property>
</object> </object>
<object class="GtkAdjustment" id="_systemTimeDaySpinAdjustment">
<property name="lower">1</property>
<property name="upper">31</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="_systemTimeHourSpinAdjustment">
<property name="upper">23</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="_systemTimeMinuteSpinAdjustment">
<property name="upper">59</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="_systemTimeMonthSpinAdjustment">
<property name="lower">1</property>
<property name="upper">12</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="_systemTimeYearSpinAdjustment">
<property name="lower">2000</property>
<property name="upper">2060</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkWindow" id="_settingsWin"> <object class="GtkWindow" id="_settingsWin">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="title" translatable="yes">Ryujinx - Settings</property> <property name="title" translatable="yes">Ryujinx - Settings</property>
<property name="modal">True</property> <property name="modal">True</property>
<property name="window_position">center</property> <property name="window_position">center</property>
<property name="default_width">650</property> <property name="default_width">650</property>
<property name="default_height">520</property> <property name="default_height">550</property>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
@ -1441,6 +1469,46 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="AudioBackendBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Change System Region</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Audio Backend: </property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="_audioBackendSelect">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Change Audio Backend</property>
<property name="margin_left">5</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -2121,32 +2189,4 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkAdjustment" id="_systemTimeDaySpinAdjustment">
<property name="lower">1</property>
<property name="upper">31</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="_systemTimeHourSpinAdjustment">
<property name="upper">23</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="_systemTimeMinuteSpinAdjustment">
<property name="upper">59</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="_systemTimeMonthSpinAdjustment">
<property name="lower">1</property>
<property name="upper">12</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
</object>
<object class="GtkAdjustment" id="_systemTimeYearSpinAdjustment">
<property name="lower">2000</property>
<property name="upper">2060</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
</interface> </interface>

View file

@ -1003,6 +1003,18 @@
3 3
] ]
}, },
"audio_backend": {
"$id": "#/properties/audio_backend",
"type": "string",
"title": "The selected audio backend",
"description": "The selected audio backend",
"default": "OpenAl",
"enum": [
"Dummy",
"SoundIo",
"OpenAl"
]
},
"ignore_missing_services": { "ignore_missing_services": {
"$id": "#/properties/ignore_missing_services", "$id": "#/properties/ignore_missing_services",
"type": "boolean", "type": "boolean",