summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2020-04-25 22:17:47 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2024-08-07 01:27:12 +0200
commitda4683c71e94bf7182c2c43254a02379f81db4ad (patch)
tree4d2b19ce6f35db9743886ea8769aac047195e066
parenteabeafd8c3d3fb346853eb1c590ae54b8aa4cd14 (diff)
downloadredot-engine-da4683c71e94bf7182c2c43254a02379f81db4ad.tar.gz
Use the Dummy audio driver in the project manager
This prevents Godot from appearing in the list of applications outputting sound in the OS while the user is in the project manager.
-rw-r--r--main/main.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/main/main.cpp b/main/main.cpp
index e42469b51b..e8d2d1ebb5 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2338,7 +2338,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF_RST_NOVAL("audio/driver/driver", AudioDriverManager::get_driver(0)->get_name());
if (audio_driver.is_empty()) { // Specified in project.godot.
- audio_driver = GLOBAL_GET("audio/driver/driver");
+ if (project_manager) {
+ // The project manager doesn't need to play sound (TTS audio output is not emitted by Godot, but by the system itself).
+ // Disable audio output so it doesn't appear in the list of applications outputting sound in the OS.
+ // On macOS, this also prevents the project manager from inhibiting suspend.
+ audio_driver = "Dummy";
+ } else {
+ audio_driver = GLOBAL_GET("audio/driver/driver");
+ }
}
// Make sure that dummy is the last one, which it is assumed to be by design.