From c56b242c464c8f9a67a757663a65f3c78bb9d8e2 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Tue, 10 Dec 2024 03:38:22 +0200 Subject: [PATCH] Change the audio driver to Dummy from the Preferences for performance reasons --- src/Autoload/Global.gd | 9 +++++++++ src/Preferences/PreferencesDialog.gd | 7 +++++++ src/Preferences/PreferencesDialog.tscn | 16 ++++++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index 00e17c014..edbab1ab7 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -490,6 +490,11 @@ var window_transparency := false: return window_transparency = value _save_to_override_file() +var dummy_audio_driver := false: + set(value): + if value != dummy_audio_driver: + dummy_audio_driver = value + _save_to_override_file() ## Found in Preferences. The time (in minutes) after which backup is created (if enabled). var autosave_interval := 1.0: @@ -726,6 +731,7 @@ func _init() -> void: window_transparency = ProjectSettings.get_setting( "display/window/per_pixel_transparency/allowed" ) + dummy_audio_driver = ProjectSettings.get_setting("audio/driver/driver") == "Dummy" func _ready() -> void: @@ -1187,3 +1193,6 @@ func _save_to_override_file() -> void: file.store_line("[display]\n") file.store_line("window/subwindows/embed_subwindows=%s" % single_window_mode) file.store_line("window/per_pixel_transparency/allowed=%s" % window_transparency) + file.store_line("[audio]\n") + if dummy_audio_driver: + file.store_line('driver/driver="Dummy"') diff --git a/src/Preferences/PreferencesDialog.gd b/src/Preferences/PreferencesDialog.gd index 86085fb54..e3fa87af5 100644 --- a/src/Preferences/PreferencesDialog.gd +++ b/src/Preferences/PreferencesDialog.gd @@ -181,6 +181,13 @@ var preferences: Array[Preference] = [ false, true ), + Preference.new( + "dummy_audio_driver", + "Performance/PerformanceContainer/DummyAudioDriver", + "button_pressed", + false, + true + ), Preference.new("tablet_driver", "Drivers/DriversContainer/TabletDriver", "selected", 0) ] diff --git a/src/Preferences/PreferencesDialog.tscn b/src/Preferences/PreferencesDialog.tscn index 7b79c020e..bdc767232 100644 --- a/src/Preferences/PreferencesDialog.tscn +++ b/src/Preferences/PreferencesDialog.tscn @@ -1142,13 +1142,25 @@ mouse_default_cursor_shape = 2 button_pressed = true text = "On" -[node name="WindowTransparencyLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"] +[node name="WindowTransparencyLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer" groups=["DesktopOnly"]] layout_mode = 2 tooltip_text = "If enabled, the application window can become transparent. This affects performance, so keep it off if you don't need it." mouse_filter = 0 text = "Enable window transparency" -[node name="WindowTransparency" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"] +[node name="WindowTransparency" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer" groups=["DesktopOnly"]] +layout_mode = 2 +tooltip_text = "If enabled, the application window can become transparent. This affects performance, so keep it off if you don't need it." +mouse_default_cursor_shape = 2 +text = "On" + +[node name="DummyAudioDriverLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer" groups=["DesktopOnly"]] +layout_mode = 2 +tooltip_text = "If enabled, the application window can become transparent. This affects performance, so keep it off if you don't need it." +mouse_filter = 0 +text = "Use dummy audio driver" + +[node name="DummyAudioDriver" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer" groups=["DesktopOnly"]] layout_mode = 2 tooltip_text = "If enabled, the application window can become transparent. This affects performance, so keep it off if you don't need it." mouse_default_cursor_shape = 2