Skip to content

Commit

Permalink
Use the Dummy audio driver in the project manager
Browse files Browse the repository at this point in the history
This prevents Godot from appearing in the list of applications
outputting sound in the OS while the user is in the project manager.
  • Loading branch information
Calinou committed Aug 6, 2024
1 parent eabeafd commit da4683c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit da4683c

Please sign in to comment.