diff --git a/resources/ui/carla_settings.ui b/resources/ui/carla_settings.ui index 4bf63a846..e347aff0d 100644 --- a/resources/ui/carla_settings.ui +++ b/resources/ui/carla_settings.ui @@ -267,7 +267,7 @@ Interface - + ms @@ -283,7 +283,7 @@ - + Qt::Horizontal @@ -299,7 +299,7 @@ - + Interface refresh interval: @@ -316,13 +316,20 @@ - + Use custom plugin slot skins + + + + Show console output in Logs tab (needs engine restart) + + + diff --git a/source/backend/CarlaBackend.h b/source/backend/CarlaBackend.h index ab04f8229..21e5f6a2e 100644 --- a/source/backend/CarlaBackend.h +++ b/source/backend/CarlaBackend.h @@ -1073,7 +1073,12 @@ typedef enum { /*! * Set frontend winId, used to define as parent window for plugin UIs. */ - ENGINE_OPTION_FRONTEND_WIN_ID = 17 + ENGINE_OPTION_FRONTEND_WIN_ID = 17, + + /*! + * Capture console output into debug callbacks. + */ + ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 18 } EngineOption; diff --git a/source/backend/CarlaStandalone.cpp b/source/backend/CarlaStandalone.cpp index 2b9c8c73a..c974f9c42 100644 --- a/source/backend/CarlaStandalone.cpp +++ b/source/backend/CarlaStandalone.cpp @@ -54,6 +54,7 @@ struct CarlaBackendStandalone { #ifndef BUILD_BRIDGE EngineOptions engineOptions; CarlaLogThread logThread; + bool logThreadEnabled; #endif FileCallbackFunc fileCallback; @@ -68,6 +69,7 @@ struct CarlaBackendStandalone { #ifndef BUILD_BRIDGE engineOptions(), logThread(), + logThreadEnabled(false), #endif fileCallback(nullptr), fileCallbackPtr(nullptr), @@ -320,7 +322,7 @@ bool carla_engine_init(const char* driverName, const char* clientName) { #ifndef BUILD_BRIDGE juce::initialiseJuce_GUI(); - if (std::getenv("CARLA_LOGS_DISABLED") == nullptr) + if (gStandalone.logThreadEnabled && std::getenv("CARLA_LOGS_DISABLED") == nullptr) gStandalone.logThread.init(); #endif gStandalone.lastError = "No error"; @@ -601,11 +603,15 @@ void carla_set_engine_option(EngineOption option, int value, const char* valueSt gStandalone.engineOptions.preventBadBehaviour = (value != 0); break; - case CB::ENGINE_OPTION_FRONTEND_WIN_ID: + case CB::ENGINE_OPTION_FRONTEND_WIN_ID: { CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); const long long winId(std::strtoll(valueStr, nullptr, 16)); CARLA_SAFE_ASSERT_RETURN(winId >= 0,); gStandalone.engineOptions.frontendWinId = static_cast(winId); + } break; + + case CB::ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: + gStandalone.logThreadEnabled = (value != 0); break; } diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index c2644d656..be2bcdc2d 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1573,11 +1573,14 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch #endif break; - case ENGINE_OPTION_FRONTEND_WIN_ID: + case ENGINE_OPTION_FRONTEND_WIN_ID: { CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); const long long winId(std::strtoll(valueStr, nullptr, 16)); CARLA_SAFE_ASSERT_RETURN(winId >= 0,); pData->options.frontendWinId = static_cast(winId); + } break; + + case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: break; } } diff --git a/source/carla_backend.py b/source/carla_backend.py index 9fd6b72d1..3f3747679 100644 --- a/source/carla_backend.py +++ b/source/carla_backend.py @@ -781,6 +781,9 @@ ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 16 # Set frontend winId, used to define as parent window for plugin UIs. ENGINE_OPTION_FRONTEND_WIN_ID = 17 +# Capture console output into debug callbacks +ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 18 + # ------------------------------------------------------------------------------------------------------------ # Engine Process Mode # Engine process mode. @@ -1216,6 +1219,7 @@ class CarlaHostMeta(object): self.preferUIBridges = False self.preventBadBehaviour = False self.manageUIs = False + self.showLogs = False self.uisAlwaysOnTop = False self.maxParameters = 0 self.uiBridgesTimeout = 0 diff --git a/source/carla_host.py b/source/carla_host.py index b7107ec9a..6a015c633 100644 --- a/source/carla_host.py +++ b/source/carla_host.py @@ -2284,6 +2284,11 @@ def loadHostSettings(host): except: host.manageUIs = CARLA_DEFAULT_MAIN_MANAGE_UIS + try: + host.showLogs = settings.value(CARLA_KEY_MAIN_SHOW_LOGS, CARLA_DEFAULT_MAIN_SHOW_LOGS, type=bool) + except: + host.showLogs = CARLA_DEFAULT_MAIN_SHOW_LOGS + try: host.uisAlwaysOnTop = settings.value(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, CARLA_DEFAULT_UIS_ALWAYS_ON_TOP, type=bool) except: @@ -2354,7 +2359,6 @@ def setHostSettings(host): # TEST #host.preventBadBehaviour = True - host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, host.forceStereo, "") host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, host.preferPluginBridges, "") host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, host.preferUIBridges, "") @@ -2362,6 +2366,7 @@ def setHostSettings(host): host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, host.maxParameters, "") host.set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, host.uiBridgesTimeout, "") host.set_engine_option(ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, host.preventBadBehaviour, "") + host.set_engine_option(ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT, host.showLogs, "") if host.isPlugin: return diff --git a/source/carla_settings.py b/source/carla_settings.py index a374d8a81..58846602b 100755 --- a/source/carla_settings.py +++ b/source/carla_settings.py @@ -325,6 +325,7 @@ class CarlaSettingsW(QDialog): # Main self.ui.ch_main_manage_uis.setChecked(self.host.manageUIs) + self.ui.ch_main_show_logs.setChecked(self.host.showLogs) self.ui.ch_engine_uis_always_on_top.setChecked(self.host.uisAlwaysOnTop) self.ui.le_main_proj_folder.setText(settings.value(CARLA_KEY_MAIN_PROJECT_FOLDER, CARLA_DEFAULT_MAIN_PROJECT_FOLDER, type=str)) @@ -449,6 +450,7 @@ class CarlaSettingsW(QDialog): # Main self.host.manageUIs = self.ui.ch_main_manage_uis.isChecked() + self.host.showLogs = self.ui.ch_main_show_logs.isChecked() self.host.uisAlwaysOnTop = self.ui.ch_engine_uis_always_on_top.isChecked() settings.setValue(CARLA_KEY_MAIN_PROJECT_FOLDER, self.ui.le_main_proj_folder.text()) @@ -458,6 +460,7 @@ class CarlaSettingsW(QDialog): settings.setValue(CARLA_KEY_MAIN_USE_CUSTOM_SKINS, self.ui.ch_main_use_custom_skins.isChecked()) settings.setValue(CARLA_KEY_MAIN_MANAGE_UIS, self.host.manageUIs) + settings.setValue(CARLA_KEY_MAIN_SHOW_LOGS, self.host.showLogs) settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, self.host.uisAlwaysOnTop) # ---------------------------------------------------------------------------------------------------- @@ -584,6 +587,7 @@ class CarlaSettingsW(QDialog): self.ui.sb_main_refresh_interval.setValue(CARLA_DEFAULT_MAIN_REFRESH_INTERVAL) self.ui.ch_main_use_custom_skins.setChecked(CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS) self.ui.ch_main_manage_uis.setChecked(CARLA_DEFAULT_MAIN_MANAGE_UIS) + self.ui.ch_main_show_logs.setChecked(CARLA_DEFAULT_MAIN_SHOW_LOGS) # ---------------------------------------------------------------------------------------------------- # Canvas diff --git a/source/carla_shared.py b/source/carla_shared.py index 22c3a9c6a..359cc9c41 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -193,6 +193,7 @@ CARLA_KEY_MAIN_PRO_THEME_COLOR = "Main/ProThemeColor" # str CARLA_KEY_MAIN_REFRESH_INTERVAL = "Main/RefreshInterval" # int CARLA_KEY_MAIN_USE_CUSTOM_SKINS = "Main/UseCustomSkins" # bool CARLA_KEY_MAIN_MANAGE_UIS = "Main/ManageUIs" # bool +CARLA_KEY_MAIN_SHOW_LOGS = "Main/ShowLogs" # bool CARLA_KEY_CANVAS_THEME = "Canvas/Theme" # str CARLA_KEY_CANVAS_SIZE = "Canvas/Size" # str "NxN" @@ -237,6 +238,7 @@ CARLA_DEFAULT_MAIN_PRO_THEME_COLOR = "Black" CARLA_DEFAULT_MAIN_REFRESH_INTERVAL = 20 CARLA_DEFAULT_MAIN_USE_CUSTOM_SKINS = True CARLA_DEFAULT_MAIN_MANAGE_UIS = True +CARLA_DEFAULT_MAIN_SHOW_LOGS = True # Canvas CARLA_DEFAULT_CANVAS_THEME = "Modern Dark" diff --git a/source/utils/CarlaBackendUtils.hpp b/source/utils/CarlaBackendUtils.hpp index b1927ccdc..bfa98820d 100644 --- a/source/utils/CarlaBackendUtils.hpp +++ b/source/utils/CarlaBackendUtils.hpp @@ -327,6 +327,8 @@ const char* EngineOption2Str(const EngineOption option) noexcept return "ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR"; case ENGINE_OPTION_FRONTEND_WIN_ID: return "ENGINE_OPTION_FRONTEND_WIN_ID"; + case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: + return "ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT"; } carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option);