Signed-off-by: falkTX <falktx@falktx.com>tags/v2.2.0-RC1
@@ -1421,7 +1421,13 @@ typedef enum { | |||||
/*! | /*! | ||||
* Capture console output into debug callbacks. | * Capture console output into debug callbacks. | ||||
*/ | */ | ||||
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33 | |||||
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33, | |||||
/*! | |||||
* A prefix to give to all plugin clients created by Carla. | |||||
* Mostly useful for JACK multi-client mode. | |||||
*/ | |||||
ENGINE_OPTION_CLIENT_NAME_PREFIX = 34 | |||||
} EngineOption; | } EngineOption; | ||||
@@ -58,6 +58,7 @@ struct CarlaHostStandalone : CarlaHostHandleImpl { | |||||
void* fileCallbackPtr; | void* fileCallbackPtr; | ||||
#ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
CarlaString clientNamePrefix; | |||||
EngineOptions engineOptions; | EngineOptions engineOptions; | ||||
CarlaLogThread logThread; | CarlaLogThread logThread; | ||||
bool logThreadEnabled; | bool logThreadEnabled; | ||||
@@ -72,6 +73,7 @@ struct CarlaHostStandalone : CarlaHostHandleImpl { | |||||
fileCallback(nullptr), | fileCallback(nullptr), | ||||
fileCallbackPtr(nullptr), | fileCallbackPtr(nullptr), | ||||
#ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
clientNamePrefix(), | |||||
engineOptions(), | engineOptions(), | ||||
logThread(), | logThread(), | ||||
logThreadEnabled(false), | logThreadEnabled(false), | ||||
@@ -298,7 +298,9 @@ static void carla_engine_init_common(const CarlaHostStandalone& standalone, Carl | |||||
engine->setOption(CB::ENGINE_OPTION_WINE_BASE_RT_PRIO, standalone.engineOptions.wine.baseRtPrio, nullptr); | engine->setOption(CB::ENGINE_OPTION_WINE_BASE_RT_PRIO, standalone.engineOptions.wine.baseRtPrio, nullptr); | ||||
engine->setOption(CB::ENGINE_OPTION_WINE_SERVER_RT_PRIO, standalone.engineOptions.wine.serverRtPrio, nullptr); | engine->setOption(CB::ENGINE_OPTION_WINE_SERVER_RT_PRIO, standalone.engineOptions.wine.serverRtPrio, nullptr); | ||||
# endif | # endif | ||||
#endif | |||||
engine->setOption(CB::ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, standalone.clientNamePrefix); | |||||
#endif // BUILD_BRIDGE | |||||
} | } | ||||
bool carla_engine_init(CarlaHostHandle handle, const char* driverName, const char* clientName) | bool carla_engine_init(CarlaHostHandle handle, const char* driverName, const char* clientName) | ||||
@@ -887,6 +889,10 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va | |||||
case CB::ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: | case CB::ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: | ||||
shandle.logThreadEnabled = (value != 0); | shandle.logThreadEnabled = (value != 0); | ||||
break; | break; | ||||
case CB::ENGINE_OPTION_CLIENT_NAME_PREFIX: | |||||
shandle.clientNamePrefix = valueStr; | |||||
break; | |||||
} | } | ||||
} | } | ||||
@@ -277,6 +277,10 @@ protected: | |||||
CARLA_SAFE_ASSERT_RETURN(fServer != nullptr, 1); | CARLA_SAFE_ASSERT_RETURN(fServer != nullptr, 1); | ||||
carla_stdout("CarlaNSM::handleOpen(\"%s\", \"%s\", \"%s\")", projectPath, displayName, clientNameId); | carla_stdout("CarlaNSM::handleOpen(\"%s\", \"%s\", \"%s\")", projectPath, displayName, clientNameId); | ||||
const CarlaHostHandle handle = (CarlaHostHandle)&gStandalone; | |||||
carla_set_engine_option(handle, CB::ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, clientNameId); | |||||
if (gStandalone.engineCallback != nullptr) | if (gStandalone.engineCallback != nullptr) | ||||
{ | { | ||||
fReadyActionOpen = false; | fReadyActionOpen = false; | ||||
@@ -294,8 +298,6 @@ protected: | |||||
{ | { | ||||
using namespace water; | using namespace water; | ||||
const CarlaHostHandle handle = (CarlaHostHandle)&gStandalone; | |||||
if (carla_is_engine_running(handle)) | if (carla_is_engine_running(handle)) | ||||
carla_engine_close(handle); | carla_engine_close(handle); | ||||
@@ -2032,6 +2032,7 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch | |||||
#endif | #endif | ||||
case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: | case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: | ||||
case ENGINE_OPTION_CLIENT_NAME_PREFIX: | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@@ -1346,6 +1346,7 @@ public: | |||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
fIsRunning(false) | fIsRunning(false) | ||||
#else | #else | ||||
fClientNamePrefix(), | |||||
fTimebaseMaster(false), | fTimebaseMaster(false), | ||||
fTimebaseRolling(false), | fTimebaseRolling(false), | ||||
fTimebaseUsecs(0), | fTimebaseUsecs(0), | ||||
@@ -1891,7 +1892,8 @@ public: | |||||
{ | { | ||||
if (option == ENGINE_OPTION_TRANSPORT_MODE && fClient != nullptr) | if (option == ENGINE_OPTION_TRANSPORT_MODE && fClient != nullptr) | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(value >= ENGINE_TRANSPORT_MODE_DISABLED && value <= ENGINE_TRANSPORT_MODE_JACK,); | |||||
CARLA_SAFE_ASSERT_INT_RETURN(value >= ENGINE_TRANSPORT_MODE_DISABLED && | |||||
value <= ENGINE_TRANSPORT_MODE_JACK, value,); | |||||
if (value == ENGINE_TRANSPORT_MODE_JACK) | if (value == ENGINE_TRANSPORT_MODE_JACK) | ||||
{ | { | ||||
@@ -1911,6 +1913,13 @@ public: | |||||
fTimebaseMaster = false; | fTimebaseMaster = false; | ||||
} | } | ||||
} | } | ||||
else if (option == ENGINE_OPTION_CLIENT_NAME_PREFIX) | |||||
{ | |||||
fClientNamePrefix = valueStr; | |||||
if (fClientNamePrefix.isNotEmpty() && ! fClientNamePrefix.endsWith('/')) | |||||
fClientNamePrefix += "/"; | |||||
} | |||||
CarlaEngine::setOption(option, value, valueStr); | CarlaEngine::setOption(option, value, valueStr); | ||||
} | } | ||||
@@ -1932,7 +1941,16 @@ public: | |||||
else if (pData->options.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | else if (pData->options.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | ||||
#endif | #endif | ||||
{ | { | ||||
client = jackbridge_client_open(plugin->getName(), JackNoStartServer, nullptr); | |||||
#ifndef BUILD_BRIDGE | |||||
if (fClientNamePrefix.isNotEmpty()) | |||||
{ | |||||
client = jackbridge_client_open(fClientNamePrefix + plugin->getName(), JackNoStartServer, nullptr); | |||||
} | |||||
else | |||||
#endif | |||||
{ | |||||
client = jackbridge_client_open(plugin->getName(), JackNoStartServer, nullptr); | |||||
} | |||||
CARLA_CUSTOM_SAFE_ASSERT_RETURN("Failure to open client", client != nullptr, nullptr); | CARLA_CUSTOM_SAFE_ASSERT_RETURN("Failure to open client", client != nullptr, nullptr); | ||||
jackbridge_set_thread_init_callback(client, carla_jack_thread_init_callback, nullptr); | jackbridge_set_thread_init_callback(client, carla_jack_thread_init_callback, nullptr); | ||||
@@ -3461,6 +3479,8 @@ private: | |||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
bool fIsRunning; | bool fIsRunning; | ||||
#else | #else | ||||
CarlaString fClientNamePrefix; | |||||
enum RackPorts { | enum RackPorts { | ||||
kRackPortAudioIn1 = 0, | kRackPortAudioIn1 = 0, | ||||
kRackPortAudioIn2 = 1, | kRackPortAudioIn2 = 1, | ||||
@@ -398,6 +398,8 @@ const char* EngineOption2Str(const EngineOption option) noexcept | |||||
#endif | #endif | ||||
case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: | case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: | ||||
return "ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT"; | return "ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT"; | ||||
case ENGINE_OPTION_CLIENT_NAME_PREFIX: | |||||
return "ENGINE_OPTION_CLIENT_NAME_PREFIX"; | |||||
} | } | ||||
carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option); | carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option); | ||||