From 9de958461eb067a583708f1b9fd8c423174e106f Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 6 Jan 2020 15:21:58 +0000 Subject: [PATCH] Add option to clear xrun after project load Signed-off-by: falkTX --- resources/ui/carla_settings.ui | 7 + source/backend/CarlaBackend.h | 51 +-- source/backend/CarlaEngine.hpp | 1 + source/backend/CarlaStandalone.cpp | 41 +- source/backend/engine/CarlaEngine.cpp | 8 + source/backend/engine/CarlaEngineData.cpp | 1 + source/frontend/carla_backend.py | 50 +-- source/frontend/carla_host.cpp | 4 +- source/frontend/carla_host.hpp | 1 + source/frontend/carla_host.py | 2 + source/frontend/carla_settings.cpp | 434 +++++++++++++++++++++- source/frontend/carla_settings.hpp | 2 +- source/frontend/carla_settings.py | 4 + source/frontend/carla_shared.hpp | 2 + source/frontend/carla_shared.py | 2 + source/utils/CarlaBackendUtils.hpp | 2 + 16 files changed, 545 insertions(+), 67 deletions(-) diff --git a/resources/ui/carla_settings.ui b/resources/ui/carla_settings.ui index 8c3ceae00..3686d7eb2 100644 --- a/resources/ui/carla_settings.ui +++ b/resources/ui/carla_settings.ui @@ -985,6 +985,13 @@ + + + + Reset Xrun counter after project load + + + diff --git a/source/backend/CarlaBackend.h b/source/backend/CarlaBackend.h index 6a1be21d1..3cf51f486 100644 --- a/source/backend/CarlaBackend.h +++ b/source/backend/CarlaBackend.h @@ -1260,46 +1260,51 @@ typedef enum { */ ENGINE_OPTION_MAX_PARAMETERS = 7, + /*! + * Reset Xrun counter after project load. + */ + ENGINE_OPTION_RESET_XRUNS = 8, + /*! * Timeout value for how much to wait for UI bridges to respond, in milliseconds. * Default is 4000 (4 seconds). */ - ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8, + ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 9, /*! * Audio buffer size. * Default is 512. */ - ENGINE_OPTION_AUDIO_BUFFER_SIZE = 9, + ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10, /*! * Audio sample rate. * Default is 44100. */ - ENGINE_OPTION_AUDIO_SAMPLE_RATE = 10, + ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11, /*! * Wherever to use 3 audio periods instead of the default 2. * Default is false. */ - ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 11, + ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 12, /*! * Audio driver. * Default depends on platform. */ - ENGINE_OPTION_AUDIO_DRIVER = 12, + ENGINE_OPTION_AUDIO_DRIVER = 13, /*! * Audio device (within a driver). * Default unset. */ - ENGINE_OPTION_AUDIO_DEVICE = 13, + ENGINE_OPTION_AUDIO_DEVICE = 14, /*! * Wherever to enable OSC support in the engine. */ - ENGINE_OPTION_OSC_ENABLED = 14, + ENGINE_OPTION_OSC_ENABLED = 15, /*! * The network TCP port to use for OSC. @@ -1307,7 +1312,7 @@ typedef enum { * A value of < 0 means to not enable the TCP port for OSC. * @note Valid ports begin at 1024 and end at 32767 (inclusive) */ - ENGINE_OPTION_OSC_PORT_TCP = 15, + ENGINE_OPTION_OSC_PORT_TCP = 16, /*! * The network UDP port to use for OSC. @@ -1316,87 +1321,87 @@ typedef enum { * @note Disabling this option prevents DSSI UIs from working! * @note Valid ports begin at 1024 and end at 32767 (inclusive) */ - ENGINE_OPTION_OSC_PORT_UDP = 16, + ENGINE_OPTION_OSC_PORT_UDP = 17, /*! * Set path used for a specific file type. * Uses value as the file format, valueStr as actual path. */ - ENGINE_OPTION_FILE_PATH = 17, + ENGINE_OPTION_FILE_PATH = 18, /*! * Set path used for a specific plugin type. * Uses value as the plugin format, valueStr as actual path. * @see PluginType */ - ENGINE_OPTION_PLUGIN_PATH = 18, + ENGINE_OPTION_PLUGIN_PATH = 19, /*! * Set path to the binary files. * Default unset. * @note Must be set for plugin and UI bridges to work */ - ENGINE_OPTION_PATH_BINARIES = 19, + ENGINE_OPTION_PATH_BINARIES = 20, /*! * Set path to the resource files. * Default unset. * @note Must be set for some internal plugins to work */ - ENGINE_OPTION_PATH_RESOURCES = 20, + ENGINE_OPTION_PATH_RESOURCES = 21, /*! * Prevent bad plugin and UI behaviour. * @note: Linux only */ - ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 21, + ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 22, /*! * Set UI scaling used in frontend, so backend can do the same for plugin UIs. */ - ENGINE_OPTION_FRONTEND_UI_SCALE = 22, + ENGINE_OPTION_FRONTEND_UI_SCALE = 23, /*! * Set frontend winId, used to define as parent window for plugin UIs. */ - ENGINE_OPTION_FRONTEND_WIN_ID = 23, + ENGINE_OPTION_FRONTEND_WIN_ID = 24, #if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN) /*! * Set path to wine executable. */ - ENGINE_OPTION_WINE_EXECUTABLE = 24, + ENGINE_OPTION_WINE_EXECUTABLE = 25, /*! * Enable automatic wineprefix detection. */ - ENGINE_OPTION_WINE_AUTO_PREFIX = 25, + ENGINE_OPTION_WINE_AUTO_PREFIX = 26, /*! * Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set. */ - ENGINE_OPTION_WINE_FALLBACK_PREFIX = 26, + ENGINE_OPTION_WINE_FALLBACK_PREFIX = 27, /*! * Enable realtime priority for Wine application and server threads. */ - ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 27, + ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 28, /*! * Base realtime priority for Wine threads. */ - ENGINE_OPTION_WINE_BASE_RT_PRIO = 28, + ENGINE_OPTION_WINE_BASE_RT_PRIO = 29, /*! * Wine server realtime priority. */ - ENGINE_OPTION_WINE_SERVER_RT_PRIO = 29, + ENGINE_OPTION_WINE_SERVER_RT_PRIO = 30, #endif /*! * Capture console output into debug callbacks. */ - ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 30 + ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 31 } EngineOption; diff --git a/source/backend/CarlaEngine.hpp b/source/backend/CarlaEngine.hpp index 19f4e5925..568ef416c 100644 --- a/source/backend/CarlaEngine.hpp +++ b/source/backend/CarlaEngine.hpp @@ -235,6 +235,7 @@ struct CARLA_API EngineOptions { const char* transportExtra; bool forceStereo; + bool resetXruns; bool preferPluginBridges; bool preferUiBridges; bool uisAlwaysOnTop; diff --git a/source/backend/CarlaStandalone.cpp b/source/backend/CarlaStandalone.cpp index d503ca1ee..10828b80c 100644 --- a/source/backend/CarlaStandalone.cpp +++ b/source/backend/CarlaStandalone.cpp @@ -189,21 +189,24 @@ static void carla_engine_init_common(CarlaEngine* const engine) #ifdef BUILD_BRIDGE /* - if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_FORCE_STEREO")) - engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr); + if (const char* const forceStereo = std::getenv("ENGINE_OPTION_FORCE_STEREO")) + engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, (std::strcmp(forceStereo, "true") == 0) ? 1 : 0, nullptr); - if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_PREFER_PLUGIN_BRIDGES")) - engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr); + if (const char* const preferPluginBridges = std::getenv("ENGINE_OPTION_PREFER_PLUGIN_BRIDGES")) + engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, (std::strcmp(preferPluginBridges, "true") == 0) ? 1 : 0, nullptr); - if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_PREFER_UI_BRIDGES")) - engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr); + if (const char* const preferUiBridges = std::getenv("ENGINE_OPTION_PREFER_UI_BRIDGES")) + engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, (std::strcmp(preferUiBridges, "true") == 0) ? 1 : 0, nullptr); */ if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_UIS_ALWAYS_ON_TOP")) engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr); if (const char* const maxParameters = std::getenv("ENGINE_OPTION_MAX_PARAMETERS")) - engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, std::atoi(maxParameters), nullptr); + engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, std::atoi(maxParameters), nullptr); + + if (const char* const resetXruns = std::getenv("ENGINE_OPTION_RESET_XRUNS")) + engine->setOption(CB::ENGINE_OPTION_RESET_XRUNS, (std::strcmp(resetXruns, "true") == 0) ? 1 : 0, nullptr); if (const char* const uiBridgesTimeout = std::getenv("ENGINE_OPTION_UI_BRIDGES_TIMEOUT")) engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, std::atoi(uiBridgesTimeout), nullptr); @@ -236,14 +239,14 @@ static void carla_engine_init_common(CarlaEngine* const engine) engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SFZ, pathSFZ); if (const char* const binaryDir = std::getenv("ENGINE_OPTION_PATH_BINARIES")) - engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, binaryDir); + engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, binaryDir); else - engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, waterBinaryDir.getFullPathName().toRawUTF8()); + engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, waterBinaryDir.getFullPathName().toRawUTF8()); if (const char* const resourceDir = std::getenv("ENGINE_OPTION_PATH_RESOURCES")) - engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, resourceDir); + engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, resourceDir); else - engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, waterBinaryDir.getChildFile("resources").getFullPathName().toRawUTF8()); + engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, waterBinaryDir.getChildFile("resources").getFullPathName().toRawUTF8()); if (const char* const preventBadBehaviour = std::getenv("ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR")) engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, (std::strcmp(preventBadBehaviour, "true") == 0) ? 1 : 0, nullptr); @@ -256,6 +259,7 @@ static void carla_engine_init_common(CarlaEngine* const engine) engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, gStandalone.engineOptions.preferUiBridges ? 1 : 0, nullptr); engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, gStandalone.engineOptions.uisAlwaysOnTop ? 1 : 0, nullptr); engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, static_cast(gStandalone.engineOptions.maxParameters), nullptr); + engine->setOption(CB::ENGINE_OPTION_RESET_XRUNS, gStandalone.engineOptions.resetXruns ? 1 : 0, nullptr); engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, static_cast(gStandalone.engineOptions.uiBridgesTimeout), nullptr); engine->setOption(CB::ENGINE_OPTION_AUDIO_BUFFER_SIZE, static_cast(gStandalone.engineOptions.audioBufferSize), nullptr); engine->setOption(CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE, static_cast(gStandalone.engineOptions.audioSampleRate), nullptr); @@ -409,15 +413,19 @@ bool carla_engine_init(const char* driverName, const char* clientName) } #ifdef BUILD_BRIDGE -bool carla_engine_init_bridge(const char audioBaseName[6+1], const char rtClientBaseName[6+1], const char nonRtClientBaseName[6+1], - const char nonRtServerBaseName[6+1], const char* clientName) +bool carla_engine_init_bridge(const char audioBaseName[6+1], + const char rtClientBaseName[6+1], + const char nonRtClientBaseName[6+1], + const char nonRtServerBaseName[6+1], + const char* const clientName) { CARLA_SAFE_ASSERT_RETURN(audioBaseName != nullptr && audioBaseName[0] != '\0', false); CARLA_SAFE_ASSERT_RETURN(rtClientBaseName != nullptr && rtClientBaseName[0] != '\0', false); CARLA_SAFE_ASSERT_RETURN(nonRtClientBaseName != nullptr && nonRtClientBaseName[0] != '\0', false); CARLA_SAFE_ASSERT_RETURN(nonRtServerBaseName != nullptr && nonRtServerBaseName[0] != '\0', false); CARLA_SAFE_ASSERT_RETURN(clientName != nullptr && clientName[0] != '\0', false); - carla_debug("carla_engine_init_bridge(\"%s\", \"%s\", \"%s\", \"%s\", \"%s\")", audioBaseName, rtClientBaseName, nonRtClientBaseName, nonRtServerBaseName, clientName); + carla_debug("carla_engine_init_bridge(\"%s\", \"%s\", \"%s\", \"%s\", \"%s\")", + audioBaseName, rtClientBaseName, nonRtClientBaseName, nonRtServerBaseName, clientName); CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(gStandalone.engine == nullptr, "Engine is already initialized", false); @@ -694,6 +702,11 @@ void carla_set_engine_option(EngineOption option, int value, const char* valueSt gStandalone.engineOptions.maxParameters = static_cast(value); break; + case CB::ENGINE_OPTION_RESET_XRUNS: + CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,); + gStandalone.engineOptions.resetXruns = (value != 0); + break; + case CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT: CARLA_SAFE_ASSERT_RETURN(value >= 0,); gStandalone.engineOptions.uiBridgesTimeout = static_cast(value); diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index dc3cfbffa..4edc6d3ed 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1704,6 +1704,11 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch pData->options.maxParameters = static_cast(value); break; + case ENGINE_OPTION_RESET_XRUNS: + CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,); + pData->options.resetXruns = (value != 0); + break; + case ENGINE_OPTION_UI_BRIDGES_TIMEOUT: CARLA_SAFE_ASSERT_RETURN(value >= 0,); pData->options.uiBridgesTimeout = static_cast(value); @@ -2881,6 +2886,9 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) } #endif + if (pData->options.resetXruns) + clearXruns(); + callback(true, true, ENGINE_CALLBACK_PROJECT_LOAD_FINISHED, 0, 0, 0, 0, 0.0f, nullptr); callback(true, true, ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 0, 0, 0, 0.0f, "Loading project"); return true; diff --git a/source/backend/engine/CarlaEngineData.cpp b/source/backend/engine/CarlaEngineData.cpp index 5c63e268b..d44306dce 100644 --- a/source/backend/engine/CarlaEngineData.cpp +++ b/source/backend/engine/CarlaEngineData.cpp @@ -184,6 +184,7 @@ EngineOptions::EngineOptions() noexcept #endif transportExtra(nullptr), forceStereo(false), + resetXruns(false), preferPluginBridges(false), #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) preferUiBridges(false), diff --git a/source/frontend/carla_backend.py b/source/frontend/carla_backend.py index c496ee831..fcc5a6fbd 100644 --- a/source/frontend/carla_backend.py +++ b/source/frontend/carla_backend.py @@ -893,95 +893,98 @@ ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6 # Default is MAX_DEFAULT_PARAMETERS. ENGINE_OPTION_MAX_PARAMETERS = 7 +# Reset Xrun counter after project load. +ENGINE_OPTION_RESET_XRUNS = 8 + # Timeout value for how much to wait for UI bridges to respond, in milliseconds. # Default is 4000 (4 seconds). -ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8 +ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 9 # Audio buffer size. # Default is 512. -ENGINE_OPTION_AUDIO_BUFFER_SIZE = 9 +ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10 # Audio sample rate. # Default is 44100. -ENGINE_OPTION_AUDIO_SAMPLE_RATE = 10 +ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11 # Wherever to use 3 audio periods instead of the default 2. # Default is false. -ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 11 +ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 12 # Audio driver. # Default dppends on platform. -ENGINE_OPTION_AUDIO_DRIVER = 12 +ENGINE_OPTION_AUDIO_DRIVER = 13 # Audio device (within a driver). # Default unset. -ENGINE_OPTION_AUDIO_DEVICE = 13 +ENGINE_OPTION_AUDIO_DEVICE = 14 # Wherever to enable OSC support in the engine. -ENGINE_OPTION_OSC_ENABLED = 14 +ENGINE_OPTION_OSC_ENABLED = 15 # The network TCP port to use for OSC. # A value of 0 means use a random port. # A value of < 0 means to not enable the TCP port for OSC. # @note Valid ports begin at 1024 and end at 32767 (inclusive) -ENGINE_OPTION_OSC_PORT_TCP = 15 +ENGINE_OPTION_OSC_PORT_TCP = 16 # The network UDP port to use for OSC. # A value of 0 means use a random port. # A value of < 0 means to not enable the UDP port for OSC. # @note Disabling this option prevents DSSI UIs from working! # @note Valid ports begin at 1024 and end at 32767 (inclusive) -ENGINE_OPTION_OSC_PORT_UDP = 16 +ENGINE_OPTION_OSC_PORT_UDP = 17 # Set path used for a specific file type. # Uses value as the file format, valueStr as actual path. -ENGINE_OPTION_FILE_PATH = 17 +ENGINE_OPTION_FILE_PATH = 18 # Set path used for a specific plugin type. # Uses value as the plugin format, valueStr as actual path. # @see PluginType -ENGINE_OPTION_PLUGIN_PATH = 18 +ENGINE_OPTION_PLUGIN_PATH = 19 # Set path to the binary files. # Default unset. # @note Must be set for plugin and UI bridges to work -ENGINE_OPTION_PATH_BINARIES = 19 +ENGINE_OPTION_PATH_BINARIES = 20 # Set path to the resource files. # Default unset. # @note Must be set for some internal plugins to work -ENGINE_OPTION_PATH_RESOURCES = 20 +ENGINE_OPTION_PATH_RESOURCES = 21 # Prevent bad plugin and UI behaviour. # @note: Linux only -ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 21 +ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 22 # Set UI scaling used in frontend, so backend can do the same for plugin UIs. -ENGINE_OPTION_FRONTEND_UI_SCALE = 22 +ENGINE_OPTION_FRONTEND_UI_SCALE = 23 # Set frontend winId, used to define as parent window for plugin UIs. -ENGINE_OPTION_FRONTEND_WIN_ID = 23 +ENGINE_OPTION_FRONTEND_WIN_ID = 24 # Set path to wine executable. -ENGINE_OPTION_WINE_EXECUTABLE = 24 +ENGINE_OPTION_WINE_EXECUTABLE = 25 # Enable automatic wineprefix detection. -ENGINE_OPTION_WINE_AUTO_PREFIX = 25 +ENGINE_OPTION_WINE_AUTO_PREFIX = 26 # Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set. -ENGINE_OPTION_WINE_FALLBACK_PREFIX = 26 +ENGINE_OPTION_WINE_FALLBACK_PREFIX = 27 # Enable realtime priority for Wine application and server threads. -ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 27 +ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 28 # Base realtime priority for Wine threads. -ENGINE_OPTION_WINE_BASE_RT_PRIO = 28 +ENGINE_OPTION_WINE_BASE_RT_PRIO = 29 # Wine server realtime priority. -ENGINE_OPTION_WINE_SERVER_RT_PRIO = 29 +ENGINE_OPTION_WINE_SERVER_RT_PRIO = 30 # Capture console output into debug callbacks -ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 30 +ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 31 # ------------------------------------------------------------------------------------------------------------ # Engine Process Mode @@ -1498,6 +1501,7 @@ class CarlaHostMeta(object): self.forceStereo = False self.manageUIs = False self.maxParameters = 0 + self.resetXruns = False self.preferPluginBridges = False self.preferUIBridges = False self.preventBadBehaviour = False diff --git a/source/frontend/carla_host.cpp b/source/frontend/carla_host.cpp index 791a04948..137dbe4fb 100644 --- a/source/frontend/carla_host.cpp +++ b/source/frontend/carla_host.cpp @@ -99,7 +99,8 @@ CarlaHost::CarlaHost() exportLV2(false), forceStereo(false), manageUIs(false), - maxParameters(false), + maxParameters(0), + resetXruns(false), preferPluginBridges(false), preferUIBridges(false), preventBadBehaviour(false), @@ -2549,6 +2550,7 @@ void loadHostSettings(CarlaHost& host) host.exportLV2 = settings.valueBool(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT); host.manageUIs = settings.valueBool(CARLA_KEY_ENGINE_MANAGE_UIS, CARLA_DEFAULT_MANAGE_UIS); host.maxParameters = settings.valueUInt(CARLA_KEY_ENGINE_MAX_PARAMETERS, CARLA_DEFAULT_MAX_PARAMETERS); + host.resetXruns = settings.valueBool(CARLA_KEY_ENGINE_RESET_XRUNS, CARLA_DEFAULT_RESET_XRUNS); host.forceStereo = settings.valueBool(CARLA_KEY_ENGINE_FORCE_STEREO, CARLA_DEFAULT_FORCE_STEREO); host.preferPluginBridges = settings.valueBool(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES); host.preferUIBridges = settings.valueBool(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, CARLA_DEFAULT_PREFER_UI_BRIDGES); diff --git a/source/frontend/carla_host.hpp b/source/frontend/carla_host.hpp index 92ec29192..e61794a7e 100644 --- a/source/frontend/carla_host.hpp +++ b/source/frontend/carla_host.hpp @@ -72,6 +72,7 @@ public: bool forceStereo; bool manageUIs; uint maxParameters; + bool resetXruns; bool preferPluginBridges; bool preferUIBridges; bool preventBadBehaviour; diff --git a/source/frontend/carla_host.py b/source/frontend/carla_host.py index cc6fba348..0f5eb717f 100644 --- a/source/frontend/carla_host.py +++ b/source/frontend/carla_host.py @@ -2955,6 +2955,7 @@ def loadHostSettings(host): host.exportLV2 = settings.value(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT, bool) host.manageUIs = settings.value(CARLA_KEY_ENGINE_MANAGE_UIS, CARLA_DEFAULT_MANAGE_UIS, bool) host.maxParameters = settings.value(CARLA_KEY_ENGINE_MAX_PARAMETERS, CARLA_DEFAULT_MAX_PARAMETERS, int) + host.resetXruns = settings.value(CARLA_KEY_ENGINE_RESET_XRUNS, CARLA_DEFAULT_RESET_XRUNS, bool) host.forceStereo = settings.value(CARLA_KEY_ENGINE_FORCE_STEREO, CARLA_DEFAULT_FORCE_STEREO, bool) host.preferPluginBridges = settings.value(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES, bool) host.preferUIBridges = settings.value(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, CARLA_DEFAULT_PREFER_UI_BRIDGES, bool) @@ -3008,6 +3009,7 @@ def setHostSettings(host): host.set_engine_option(ENGINE_OPTION_FORCE_STEREO, host.forceStereo, "") host.set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, host.maxParameters, "") + host.set_engine_option(ENGINE_OPTION_RESET_XRUNS, host.resetXruns, "") host.set_engine_option(ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, host.preferPluginBridges, "") host.set_engine_option(ENGINE_OPTION_PREFER_UI_BRIDGES, host.preferUIBridges, "") host.set_engine_option(ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, host.preventBadBehaviour, "") diff --git a/source/frontend/carla_settings.cpp b/source/frontend/carla_settings.cpp index 49d89108f..da79c6320 100644 --- a/source/frontend/carla_settings.cpp +++ b/source/frontend/carla_settings.cpp @@ -435,9 +435,9 @@ enum PluginPathIndexes { struct CarlaSettingsW::PrivateData { Ui::CarlaSettingsW ui; - const CarlaHost& host; + CarlaHost& host; - PrivateData(CarlaSettingsW* const self, const CarlaHost& h) + PrivateData(CarlaSettingsW* const self, CarlaHost& h) : ui(), host(h) { @@ -578,6 +578,7 @@ struct CarlaSettingsW::PrivateData { ui.cb_engine_process_mode_other->setCurrentIndex(0); ui.sb_engine_max_params->setValue(static_cast(host.maxParameters)); + ui.cb_engine_reset_xruns->setChecked(host.resetXruns); ui.ch_engine_manage_uis->setChecked(host.manageUIs); ui.ch_engine_prefer_ui_bridges->setChecked(host.preferUIBridges); ui.sb_engine_ui_bridges_timeout->setValue(host.uiBridgesTimeout); @@ -746,6 +747,429 @@ struct CarlaSettingsW::PrivateData { CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR)); } + void saveSettings() + { + { + QSafeSettings settings; + + host.experimental = ui.ch_main_experimental->isChecked(); + + if (! host.experimental) + resetExperimentalSettings(); + + // -------------------------------------------------------------------------------------------------------- + // Main + + settings.setValue(CARLA_KEY_MAIN_PROJECT_FOLDER, ui.le_main_proj_folder->text()); + settings.setValue(CARLA_KEY_MAIN_CONFIRM_EXIT, ui.ch_main_confirm_exit->isChecked()); + settings.setValue(CARLA_KEY_MAIN_USE_PRO_THEME, ui.ch_main_theme_pro->isChecked()); + settings.setValue(CARLA_KEY_MAIN_PRO_THEME_COLOR, ui.cb_main_theme_color->currentText()); + settings.setValue(CARLA_KEY_MAIN_REFRESH_INTERVAL, ui.sb_main_refresh_interval->value()); + + // -------------------------------------------------------------------------------------------------------- + // Canvas + + settings.setValue(CARLA_KEY_CANVAS_THEME, ui.cb_canvas_theme->currentText()); + settings.setValue(CARLA_KEY_CANVAS_SIZE, ui.cb_canvas_size->currentText()); + settings.setValue(CARLA_KEY_CANVAS_USE_BEZIER_LINES, ui.cb_canvas_bezier_lines->isChecked()); + settings.setValue(CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, ui.cb_canvas_hide_groups->isChecked()); + settings.setValue(CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, ui.cb_canvas_auto_select->isChecked()); + settings.setValue(CARLA_KEY_CANVAS_EYE_CANDY, ui.cb_canvas_eyecandy->isChecked()); + settings.setValue(CARLA_KEY_CANVAS_FANCY_EYE_CANDY, ui.cb_canvas_fancy_eyecandy->isChecked()); + settings.setValue(CARLA_KEY_CANVAS_USE_OPENGL, ui.cb_canvas_use_opengl->isChecked()); + settings.setValue(CARLA_KEY_CANVAS_HQ_ANTIALIASING, ui.cb_canvas_render_hq_aa->isChecked()); + settings.setValue(CARLA_KEY_CANVAS_ANTIALIASING, ui.cb_canvas_render_aa->checkState()); // 0, 1, 2 match their enum variants + settings.setValue(CARLA_KEY_CANVAS_FULL_REPAINTS, ui.cb_canvas_full_repaints->isChecked()); + settings.setValue(CARLA_KEY_CANVAS_INLINE_DISPLAYS, ui.cb_canvas_inline_displays->isChecked()); + } + + // ------------------------------------------------------------------------------------------------------------ + + QSafeSettings settings("falkTX", "Carla2"); + + // ------------------------------------------------------------------------------------------------------------ + // Main + + settings.setValue(CARLA_KEY_MAIN_EXPERIMENTAL, host.experimental); + + // ------------------------------------------------------------------------------------------------------------ + // Engine + + const QCarlaString audioDriver = ui.cb_engine_audio_driver->currentText(); + + if (audioDriver.isNotEmpty() && host.audioDriverForced.isEmpty() && ! host.isPlugin) + settings.setValue(CARLA_KEY_ENGINE_AUDIO_DRIVER, audioDriver); + + if (! host.processModeForced) + { + // engine sends callback if processMode really changes + if (audioDriver == "JACK") + host.nextProcessMode = static_cast(ui.cb_engine_process_mode_jack->currentIndex()); + else + host.nextProcessMode = static_cast(ui.cb_engine_process_mode_other->currentIndex() + PROCESS_MODE_NON_JACK_PADDING); + + settings.setValue(CARLA_KEY_ENGINE_PROCESS_MODE, host.nextProcessMode); + } + + host.exportLV2 = ui.ch_exp_export_lv2->isChecked(); + host.forceStereo = ui.ch_engine_force_stereo->isChecked(); + host.resetXruns = ui.cb_engine_reset_xruns->isChecked(); + host.maxParameters = static_cast(std::max(0, ui.sb_engine_max_params->value())); + host.manageUIs = ui.ch_engine_manage_uis->isChecked(); + host.preferPluginBridges = ui.ch_engine_prefer_plugin_bridges->isChecked(); + host.preferUIBridges = ui.ch_engine_prefer_ui_bridges->isChecked(); + host.showLogs = ui.ch_main_show_logs->isChecked(); + host.showPluginBridges = ui.cb_exp_plugin_bridges->isChecked(); + host.showWineBridges = ui.ch_exp_wine_bridges->isChecked(); + host.uiBridgesTimeout = ui.sb_engine_ui_bridges_timeout->value(); + host.uisAlwaysOnTop = ui.ch_engine_uis_always_on_top->isChecked(); + + if (ui.ch_engine_force_stereo->isEnabled()) + settings.setValue(CARLA_KEY_ENGINE_FORCE_STEREO, host.forceStereo); + + settings.setValue(CARLA_KEY_MAIN_SHOW_LOGS, host.showLogs); + settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, host.maxParameters); + settings.setValue(CARLA_KEY_ENGINE_RESET_XRUNS, host.resetXruns); + settings.setValue(CARLA_KEY_ENGINE_MANAGE_UIS, host.manageUIs); + settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, host.preferPluginBridges); + settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, host.preferUIBridges); + settings.setValue(CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, host.uiBridgesTimeout); + settings.setValue(CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, host.uisAlwaysOnTop); + settings.setValue(CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, host.exportLV2); + settings.setValue(CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES, host.showPluginBridges); + settings.setValue(CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES, host.showWineBridges); + + // ------------------------------------------------------------------------------------------------------------ + // OSC + + settings.setValue(CARLA_KEY_OSC_ENABLED, ui.ch_osc_enable->isChecked()); + settings.setValue(CARLA_KEY_OSC_TCP_PORT_ENABLED, ui.group_osc_tcp_port->isChecked()); + settings.setValue(CARLA_KEY_OSC_UDP_PORT_ENABLED, ui.group_osc_udp_port->isChecked()); + settings.setValue(CARLA_KEY_OSC_TCP_PORT_RANDOM, ui.rb_osc_tcp_port_random->isChecked()); + settings.setValue(CARLA_KEY_OSC_UDP_PORT_RANDOM, ui.rb_osc_udp_port_random->isChecked()); + settings.setValue(CARLA_KEY_OSC_TCP_PORT_NUMBER, ui.sb_osc_tcp_port_number->value()); + settings.setValue(CARLA_KEY_OSC_UDP_PORT_NUMBER, ui.sb_osc_udp_port_number->value()); + + // ------------------------------------------------------------------------------------------------------------ + // File Paths + + QStringList audioPaths; + QStringList midiPaths; + + for (int i=0; i < ui.lw_files_audio->count(); ++i) + audioPaths.append(ui.lw_files_audio->item(i)->text()); + + for (int i=0; i < ui.lw_files_midi->count(); ++i) + midiPaths.append(ui.lw_files_midi->item(i)->text()); + + /* TODO + host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_AUDIO, splitter.join(audioPaths)); + host.set_engine_option(ENGINE_OPTION_FILE_PATH, FILE_MIDI, splitter.join(midiPaths)); + */ + + settings.setValue(CARLA_KEY_PATHS_AUDIO, audioPaths); + settings.setValue(CARLA_KEY_PATHS_MIDI, midiPaths); + + // ------------------------------------------------------------------------------------------------------------ + // Plugin Paths + + QStringList ladspas; + QStringList dssis; + QStringList lv2s; + QStringList vst2s; + QStringList vst3s; + QStringList sf2s; + QStringList sfzs; + + for (int i=0; i < ui.lw_ladspa->count(); ++i) + ladspas.append(ui.lw_ladspa->item(i)->text()); + + for (int i=0; i < ui.lw_dssi->count(); ++i) + dssis.append(ui.lw_dssi->item(i)->text()); + + for (int i=0; i < ui.lw_lv2->count(); ++i) + lv2s.append(ui.lw_lv2->item(i)->text()); + + for (int i=0; i < ui.lw_vst->count(); ++i) + vst2s.append(ui.lw_vst->item(i)->text()); + + for (int i=0; i < ui.lw_vst3->count(); ++i) + vst3s.append(ui.lw_vst3->item(i)->text()); + + for (int i=0; i < ui.lw_sf2->count(); ++i) + sf2s.append(ui.lw_sf2->item(i)->text()); + + for (int i=0; i < ui.lw_sfz->count(); ++i) + sfzs.append(ui.lw_sfz->item(i)->text()); + + /* TODO + host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LADSPA, splitter.join(ladspas)); + host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_DSSI, splitter.join(dssis)); + host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, splitter.join(lv2s)); + host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST2, splitter.join(vst2s)); + host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_VST3, splitter.join(vst3s)); + host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SF2, splitter.join(sf2s)); + host.set_engine_option(ENGINE_OPTION_PLUGIN_PATH, PLUGIN_SFZ, splitter.join(sfzs)); + */ + + settings.setValue(CARLA_KEY_PATHS_LADSPA, ladspas); + settings.setValue(CARLA_KEY_PATHS_DSSI, dssis); + settings.setValue(CARLA_KEY_PATHS_LV2, lv2s); + settings.setValue(CARLA_KEY_PATHS_VST2, vst2s); + settings.setValue(CARLA_KEY_PATHS_VST3, vst3s); + settings.setValue(CARLA_KEY_PATHS_SF2, sf2s); + settings.setValue(CARLA_KEY_PATHS_SFZ, sfzs); + + // ------------------------------------------------------------------------------------------------------------ + // Wine + + settings.setValue(CARLA_KEY_WINE_EXECUTABLE, ui.le_wine_exec->text()); + settings.setValue(CARLA_KEY_WINE_AUTO_PREFIX, ui.cb_wine_prefix_detect->isChecked()); + settings.setValue(CARLA_KEY_WINE_FALLBACK_PREFIX, ui.le_wine_prefix_fallback->text()); + settings.setValue(CARLA_KEY_WINE_RT_PRIO_ENABLED, ui.group_wine_realtime->isChecked()); + settings.setValue(CARLA_KEY_WINE_BASE_RT_PRIO, ui.sb_wine_base_prio->value()); + settings.setValue(CARLA_KEY_WINE_SERVER_RT_PRIO, ui.sb_wine_server_prio->value()); + + // ------------------------------------------------------------------------------------------------------------ + // Experimental + + settings.setValue(CARLA_KEY_EXPERIMENTAL_JACK_APPS, ui.ch_exp_jack_apps->isChecked()); + settings.setValue(CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, ui.ch_exp_load_lib_global->isChecked()); + settings.setValue(CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, ui.ch_exp_prevent_bad_behaviour->isChecked()); + } + + void resetSettings() + { + switch (ui.lw_page->currentRow()) + { + // ------------------------------------------------------------------------------------------------------------ + // Main + + case TAB_INDEX_MAIN: + ui.le_main_proj_folder->setText(CARLA_DEFAULT_MAIN_PROJECT_FOLDER); + ui.ch_main_theme_pro->setChecked(CARLA_DEFAULT_MAIN_USE_PRO_THEME && ui.group_main_theme->isEnabled()); + ui.cb_main_theme_color->setCurrentIndex(ui.cb_main_theme_color->findText(CARLA_DEFAULT_MAIN_PRO_THEME_COLOR)); + ui.sb_main_refresh_interval->setValue(CARLA_DEFAULT_MAIN_REFRESH_INTERVAL); + ui.ch_main_confirm_exit->setChecked(CARLA_DEFAULT_MAIN_CONFIRM_EXIT); + ui.ch_main_show_logs->setChecked(CARLA_DEFAULT_MAIN_SHOW_LOGS); + break; + + // ------------------------------------------------------------------------------------------------------------ + // Canvas + + case TAB_INDEX_CANVAS: + ui.cb_canvas_theme->setCurrentIndex(ui.cb_canvas_theme->findText(CARLA_DEFAULT_CANVAS_THEME)); + ui.cb_canvas_size->setCurrentIndex(ui.cb_canvas_size->findText(CARLA_DEFAULT_CANVAS_SIZE)); + ui.cb_canvas_bezier_lines->setChecked(CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES); + ui.cb_canvas_hide_groups->setChecked(CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS); + ui.cb_canvas_auto_select->setChecked(CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS); + ui.cb_canvas_eyecandy->setChecked(CARLA_DEFAULT_CANVAS_EYE_CANDY); + ui.cb_canvas_render_aa->setCheckState(Qt::PartiallyChecked); // CARLA_DEFAULT_CANVAS_ANTIALIASING + ui.cb_canvas_full_repaints->setChecked(CARLA_DEFAULT_CANVAS_FULL_REPAINTS); + break; + + // ------------------------------------------------------------------------------------------------------------ + // Engine + + case TAB_INDEX_ENGINE: + if (! host.isPlugin) + ui.cb_engine_audio_driver->setCurrentIndex(0); + + if (! host.processModeForced) + { + if (ui.cb_engine_audio_driver->currentText() == "JACK") + { + ui.cb_engine_process_mode_jack->setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE); + ui.sw_engine_process_mode->setCurrentIndex(0); // show all modes + } + else + { + ui.cb_engine_process_mode_other->setCurrentIndex(CARLA_DEFAULT_PROCESS_MODE-PROCESS_MODE_NON_JACK_PADDING); + ui.sw_engine_process_mode->setCurrentIndex(1); // hide single+multi client modes + } + } + + ui.sb_engine_max_params->setValue(CARLA_DEFAULT_MAX_PARAMETERS); + ui.cb_engine_reset_xruns->setChecked(CARLA_DEFAULT_RESET_XRUNS); + ui.ch_engine_uis_always_on_top->setChecked(CARLA_DEFAULT_UIS_ALWAYS_ON_TOP); + ui.ch_engine_prefer_ui_bridges->setChecked(CARLA_DEFAULT_PREFER_UI_BRIDGES); + ui.sb_engine_ui_bridges_timeout->setValue(CARLA_DEFAULT_UI_BRIDGES_TIMEOUT); + ui.ch_engine_manage_uis->setChecked(CARLA_DEFAULT_MANAGE_UIS); + break; + + // ------------------------------------------------------------------------------------------------------------ + // OSC + + case TAB_INDEX_OSC: + ui.ch_osc_enable->setChecked(CARLA_DEFAULT_OSC_ENABLED); + ui.group_osc_tcp_port->setChecked(CARLA_DEFAULT_OSC_TCP_PORT_ENABLED); + ui.group_osc_udp_port->setChecked(CARLA_DEFAULT_OSC_UDP_PORT_ENABLED); + ui.sb_osc_tcp_port_number->setValue(CARLA_DEFAULT_OSC_TCP_PORT_NUMBER); + ui.sb_osc_udp_port_number->setValue(CARLA_DEFAULT_OSC_UDP_PORT_NUMBER); + + if (CARLA_DEFAULT_OSC_TCP_PORT_RANDOM) + { + ui.rb_osc_tcp_port_specific->setChecked(false); + ui.rb_osc_tcp_port_random->setChecked(true); + } + else + { + ui.rb_osc_tcp_port_random->setChecked(false); + ui.rb_osc_tcp_port_specific->setChecked(true); + } + + if (CARLA_DEFAULT_OSC_UDP_PORT_RANDOM) + { + ui.rb_osc_udp_port_specific->setChecked(false); + ui.rb_osc_udp_port_random->setChecked(true); + } + else + { + ui.rb_osc_udp_port_random->setChecked(false); + ui.rb_osc_udp_port_specific->setChecked(true); + } + break; + + // ------------------------------------------------------------------------------------------------------------ + // Plugin Paths + + case TAB_INDEX_FILEPATHS: + switch (ui.tw_filepaths->currentIndex()) + { + case FILEPATH_INDEX_AUDIO: + ui.lw_files_audio->clear(); + break; + case FILEPATH_INDEX_MIDI: + ui.lw_files_midi->clear(); + break; + } + break; + + // ------------------------------------------------------------------------------------------------------------ + // Plugin Paths + + case TAB_INDEX_PLUGINPATHS: + { + QStringList paths; + + switch (ui.tw_paths->currentIndex()) + { + case PLUGINPATH_INDEX_LADSPA: + paths = CARLA_DEFAULT_LADSPA_PATH; + paths.sort(); + ui.lw_ladspa->clear(); + + for (const auto& path : paths) + { + if (path.isEmpty()) + continue; + ui.lw_ladspa->addItem(path); + } + break; + + case PLUGINPATH_INDEX_DSSI: + paths = CARLA_DEFAULT_DSSI_PATH; + paths.sort(); + ui.lw_dssi->clear(); + + for (const auto& path : paths) + { + if (path.isEmpty()) + continue; + ui.lw_dssi->addItem(path); + } + break; + + case PLUGINPATH_INDEX_LV2: + paths = CARLA_DEFAULT_LV2_PATH; + paths.sort(); + ui.lw_lv2->clear(); + + for (const auto& path : paths) + { + if (path.isEmpty()) + continue; + ui.lw_lv2->addItem(path); + } + break; + + case PLUGINPATH_INDEX_VST2: + paths = CARLA_DEFAULT_VST2_PATH; + paths.sort(); + ui.lw_vst->clear(); + + for (const auto& path : paths) + { + if (path.isEmpty()) + continue; + ui.lw_vst->addItem(path); + } + break; + + case PLUGINPATH_INDEX_VST3: + paths = CARLA_DEFAULT_VST3_PATH; + paths.sort(); + ui.lw_vst3->clear(); + + for (const auto& path : paths) + { + if (path.isEmpty()) + continue; + ui.lw_vst3->addItem(path); + } + break; + + case PLUGINPATH_INDEX_SF2: + paths = CARLA_DEFAULT_SF2_PATH; + paths.sort(); + ui.lw_sf2->clear(); + + for (const auto& path : paths) + { + if (path.isEmpty()) + continue; + ui.lw_sf2->addItem(path); + } + break; + + case PLUGINPATH_INDEX_SFZ: + paths = CARLA_DEFAULT_SFZ_PATH; + paths.sort(); + ui.lw_sfz->clear(); + + for (const auto& path : paths) + { + if (path.isEmpty()) + continue; + ui.lw_sfz->addItem(path); + } + break; + } + break; + } + + // ------------------------------------------------------------------------------------------------------------ + // Wine + + case TAB_INDEX_WINE: + ui.le_wine_exec->setText(CARLA_DEFAULT_WINE_EXECUTABLE); + ui.cb_wine_prefix_detect->setChecked(CARLA_DEFAULT_WINE_AUTO_PREFIX); + ui.le_wine_prefix_fallback->setText(CARLA_DEFAULT_WINE_FALLBACK_PREFIX); + ui.group_wine_realtime->setChecked(CARLA_DEFAULT_WINE_RT_PRIO_ENABLED); + ui.sb_wine_base_prio->setValue(CARLA_DEFAULT_WINE_BASE_RT_PRIO); + ui.sb_wine_server_prio->setValue(CARLA_DEFAULT_WINE_SERVER_RT_PRIO); + break; + + // ------------------------------------------------------------------------------------------------------------ + // Experimental + + case TAB_INDEX_EXPERIMENTAL: + resetExperimentalSettings(); + break; + } + + } + void resetExperimentalSettings() { // Forever experimental @@ -766,7 +1190,7 @@ struct CarlaSettingsW::PrivateData { } }; -CarlaSettingsW::CarlaSettingsW(QWidget* const parent, const CarlaHost& host, const bool hasCanvas, const bool hasCanvasGL) +CarlaSettingsW::CarlaSettingsW(QWidget* const parent, CarlaHost& host, const bool hasCanvas, const bool hasCanvasGL) : QDialog(parent), self(new PrivateData(this, host)) { @@ -929,12 +1353,12 @@ CarlaSettingsW::~CarlaSettingsW() void CarlaSettingsW::slot_saveSettings() { - // TODO + self->saveSettings(); } void CarlaSettingsW::slot_resetSettings() { - // TODO + self->resetSettings(); } // -------------------------------------------------------------------------------------------------------------------- diff --git a/source/frontend/carla_settings.hpp b/source/frontend/carla_settings.hpp index baa058ade..2e7a2bae4 100644 --- a/source/frontend/carla_settings.hpp +++ b/source/frontend/carla_settings.hpp @@ -93,7 +93,7 @@ class CarlaSettingsW : public QDialog Q_OBJECT public: - CarlaSettingsW(QWidget* parent, const CarlaHost& host, bool hasCanvas, bool hasCanvasGL); + CarlaSettingsW(QWidget* parent, CarlaHost& host, bool hasCanvas, bool hasCanvasGL); ~CarlaSettingsW() override; private: diff --git a/source/frontend/carla_settings.py b/source/frontend/carla_settings.py index 9f0593c4e..80e80bd9e 100755 --- a/source/frontend/carla_settings.py +++ b/source/frontend/carla_settings.py @@ -574,6 +574,7 @@ class CarlaSettingsW(QDialog): self.ui.cb_engine_process_mode_other.setCurrentIndex(0) self.ui.sb_engine_max_params.setValue(self.host.maxParameters) + self.ui.cb_engine_reset_xruns.setChecked(self.host.resetXruns) self.ui.ch_engine_manage_uis.setChecked(self.host.manageUIs) self.ui.ch_engine_prefer_ui_bridges.setChecked(self.host.preferUIBridges) self.ui.sb_engine_ui_bridges_timeout.setValue(self.host.uiBridgesTimeout) @@ -794,6 +795,7 @@ class CarlaSettingsW(QDialog): self.host.exportLV2 = self.ui.ch_exp_export_lv2.isChecked() self.host.forceStereo = self.ui.ch_engine_force_stereo.isChecked() + self.host.resetXruns = self.ui.cb_engine_reset_xruns.isChecked() self.host.maxParameters = self.ui.sb_engine_max_params.value() self.host.manageUIs = self.ui.ch_engine_manage_uis.isChecked() self.host.preferPluginBridges = self.ui.ch_engine_prefer_plugin_bridges.isChecked() @@ -809,6 +811,7 @@ class CarlaSettingsW(QDialog): settings.setValue(CARLA_KEY_MAIN_SHOW_LOGS, self.host.showLogs) settings.setValue(CARLA_KEY_ENGINE_MAX_PARAMETERS, self.host.maxParameters) + settings.setValue(CARLA_KEY_ENGINE_RESET_XRUNS, self.host.resetXruns) settings.setValue(CARLA_KEY_ENGINE_MANAGE_UIS, self.host.manageUIs) settings.setValue(CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, self.host.preferPluginBridges) settings.setValue(CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, self.host.preferUIBridges) @@ -958,6 +961,7 @@ class CarlaSettingsW(QDialog): self.ui.sw_engine_process_mode.setCurrentIndex(1) # hide single+multi client modes self.ui.sb_engine_max_params.setValue(CARLA_DEFAULT_MAX_PARAMETERS) + self.ui.cb_engine_reset_xruns.setChecked(CARLA_DEFAULT_RESET_XRUNS) self.ui.ch_engine_uis_always_on_top.setChecked(CARLA_DEFAULT_UIS_ALWAYS_ON_TOP) self.ui.ch_engine_prefer_ui_bridges.setChecked(CARLA_DEFAULT_PREFER_UI_BRIDGES) self.ui.sb_engine_ui_bridges_timeout.setValue(CARLA_DEFAULT_UI_BRIDGES_TIMEOUT) diff --git a/source/frontend/carla_shared.hpp b/source/frontend/carla_shared.hpp index 6bbf8e21f..c283782f0 100644 --- a/source/frontend/carla_shared.hpp +++ b/source/frontend/carla_shared.hpp @@ -151,6 +151,7 @@ static const char* const* const MIDI_CC_LIST = { #define CARLA_KEY_ENGINE_MANAGE_UIS "Engine/ManageUIs" /* bool */ #define CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP "Engine/UIsAlwaysOnTop" /* bool */ #define CARLA_KEY_ENGINE_MAX_PARAMETERS "Engine/MaxParameters" /* int */ +#define CARLA_KEY_ENGINE_RESET_XRUNS "Engine/ResetXruns" /* bool */ #define CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT "Engine/UiBridgesTimeout" /* int */ #define CARLA_KEY_OSC_ENABLED "OSC/Enabled" @@ -228,6 +229,7 @@ static const char* const* const MIDI_CC_LIST = { #define CARLA_DEFAULT_MANAGE_UIS true #define CARLA_DEFAULT_UIS_ALWAYS_ON_TOP false #define CARLA_DEFAULT_MAX_PARAMETERS MAX_DEFAULT_PARAMETERS +#define CARLA_DEFAULT_RESET_XRUNS false #define CARLA_DEFAULT_UI_BRIDGES_TIMEOUT 4000 #define CARLA_DEFAULT_AUDIO_BUFFER_SIZE 512 diff --git a/source/frontend/carla_shared.py b/source/frontend/carla_shared.py index b894a394f..0b58c3d44 100644 --- a/source/frontend/carla_shared.py +++ b/source/frontend/carla_shared.py @@ -212,6 +212,7 @@ CARLA_KEY_ENGINE_PREFER_UI_BRIDGES = "Engine/PreferUiBridges" # bool CARLA_KEY_ENGINE_MANAGE_UIS = "Engine/ManageUIs" # bool CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP = "Engine/UIsAlwaysOnTop" # bool CARLA_KEY_ENGINE_MAX_PARAMETERS = "Engine/MaxParameters" # int +CARLA_KEY_ENGINE_RESET_XRUNS = "Engine/ResetXruns" # bool CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT = "Engine/UiBridgesTimeout" # int CARLA_KEY_OSC_ENABLED = "OSC/Enabled" @@ -285,6 +286,7 @@ CARLA_DEFAULT_PREFER_UI_BRIDGES = True CARLA_DEFAULT_MANAGE_UIS = True CARLA_DEFAULT_UIS_ALWAYS_ON_TOP = False CARLA_DEFAULT_MAX_PARAMETERS = MAX_DEFAULT_PARAMETERS +CARLA_DEFAULT_RESET_XRUNS = False CARLA_DEFAULT_UI_BRIDGES_TIMEOUT = 4000 CARLA_DEFAULT_AUDIO_BUFFER_SIZE = 512 diff --git a/source/utils/CarlaBackendUtils.hpp b/source/utils/CarlaBackendUtils.hpp index 9be61bb7f..69810ae71 100644 --- a/source/utils/CarlaBackendUtils.hpp +++ b/source/utils/CarlaBackendUtils.hpp @@ -342,6 +342,8 @@ const char* EngineOption2Str(const EngineOption option) noexcept return "ENGINE_OPTION_UIS_ALWAYS_ON_TOP"; case ENGINE_OPTION_MAX_PARAMETERS: return "ENGINE_OPTION_MAX_PARAMETERS"; + case ENGINE_OPTION_RESET_XRUNS: + return "ENGINE_OPTION_RESET_XRUNS"; case ENGINE_OPTION_UI_BRIDGES_TIMEOUT: return "ENGINE_OPTION_UI_BRIDGES_TIMEOUT"; case ENGINE_OPTION_AUDIO_BUFFER_SIZE: