Browse Source

Add option to enable console output to logs tab

Closes #441
tags/1.9.7
falkTX 7 years ago
parent
commit
e6d9aa45d6
9 changed files with 47 additions and 9 deletions
  1. +11
    -4
      resources/ui/carla_settings.ui
  2. +6
    -1
      source/backend/CarlaBackend.h
  3. +8
    -2
      source/backend/CarlaStandalone.cpp
  4. +4
    -1
      source/backend/engine/CarlaEngine.cpp
  5. +4
    -0
      source/carla_backend.py
  6. +6
    -1
      source/carla_host.py
  7. +4
    -0
      source/carla_settings.py
  8. +2
    -0
      source/carla_shared.py
  9. +2
    -0
      source/utils/CarlaBackendUtils.hpp

+ 11
- 4
resources/ui/carla_settings.ui View File

@@ -267,7 +267,7 @@
<string>Interface</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="3" column="1">
<item row="4" column="1">
<widget class="QSpinBox" name="sb_main_refresh_interval">
<property name="suffix">
<string> ms</string>
@@ -283,7 +283,7 @@
</property>
</widget>
</item>
<item row="3" column="2">
<item row="4" column="2">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -299,7 +299,7 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="label_main_refresh_interval">
<property name="text">
<string>Interface refresh interval:</string>
@@ -316,13 +316,20 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="ch_main_use_custom_skins">
<property name="text">
<string>Use custom plugin slot skins</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="ch_main_show_logs">
<property name="text">
<string>Show console output in Logs tab (needs engine restart)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>


+ 6
- 1
source/backend/CarlaBackend.h View File

@@ -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;



+ 8
- 2
source/backend/CarlaStandalone.cpp View File

@@ -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<uintptr_t>(winId);
} break;

case CB::ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
gStandalone.logThreadEnabled = (value != 0);
break;
}



+ 4
- 1
source/backend/engine/CarlaEngine.cpp View File

@@ -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<uintptr_t>(winId);
} break;

case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
break;
}
}


+ 4
- 0
source/carla_backend.py View File

@@ -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


+ 6
- 1
source/carla_host.py View File

@@ -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


+ 4
- 0
source/carla_settings.py View File

@@ -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


+ 2
- 0
source/carla_shared.py View File

@@ -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"


+ 2
- 0
source/utils/CarlaBackendUtils.hpp View File

@@ -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);


Loading…
Cancel
Save