Browse Source

Allow to set custom prefix for jack clients, use it under NSM

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 5 years ago
parent
commit
3d767f9be8
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
7 changed files with 45 additions and 6 deletions
  1. +7
    -1
      source/backend/CarlaBackend.h
  2. +2
    -0
      source/backend/CarlaHostImpl.hpp
  3. +7
    -1
      source/backend/CarlaStandalone.cpp
  4. +4
    -2
      source/backend/CarlaStandaloneNSM.cpp
  5. +1
    -0
      source/backend/engine/CarlaEngine.cpp
  6. +22
    -2
      source/backend/engine/CarlaEngineJack.cpp
  7. +2
    -0
      source/utils/CarlaBackendUtils.hpp

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

@@ -1421,7 +1421,13 @@ typedef enum {
/*!
* 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;



+ 2
- 0
source/backend/CarlaHostImpl.hpp View File

@@ -58,6 +58,7 @@ struct CarlaHostStandalone : CarlaHostHandleImpl {
void* fileCallbackPtr;

#ifndef BUILD_BRIDGE
CarlaString clientNamePrefix;
EngineOptions engineOptions;
CarlaLogThread logThread;
bool logThreadEnabled;
@@ -72,6 +73,7 @@ struct CarlaHostStandalone : CarlaHostHandleImpl {
fileCallback(nullptr),
fileCallbackPtr(nullptr),
#ifndef BUILD_BRIDGE
clientNamePrefix(),
engineOptions(),
logThread(),
logThreadEnabled(false),


+ 7
- 1
source/backend/CarlaStandalone.cpp View File

@@ -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_SERVER_RT_PRIO, standalone.engineOptions.wine.serverRtPrio, nullptr);
# 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)
@@ -887,6 +889,10 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
case CB::ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
shandle.logThreadEnabled = (value != 0);
break;

case CB::ENGINE_OPTION_CLIENT_NAME_PREFIX:
shandle.clientNamePrefix = valueStr;
break;
}
}



+ 4
- 2
source/backend/CarlaStandaloneNSM.cpp View File

@@ -277,6 +277,10 @@ protected:
CARLA_SAFE_ASSERT_RETURN(fServer != nullptr, 1);
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)
{
fReadyActionOpen = false;
@@ -294,8 +298,6 @@ protected:
{
using namespace water;

const CarlaHostHandle handle = (CarlaHostHandle)&gStandalone;

if (carla_is_engine_running(handle))
carla_engine_close(handle);



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

@@ -2032,6 +2032,7 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
#endif

case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
case ENGINE_OPTION_CLIENT_NAME_PREFIX:
break;
}
}


+ 22
- 2
source/backend/engine/CarlaEngineJack.cpp View File

@@ -1346,6 +1346,7 @@ public:
#ifdef BUILD_BRIDGE
fIsRunning(false)
#else
fClientNamePrefix(),
fTimebaseMaster(false),
fTimebaseRolling(false),
fTimebaseUsecs(0),
@@ -1891,7 +1892,8 @@ public:
{
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)
{
@@ -1911,6 +1913,13 @@ public:
fTimebaseMaster = false;
}
}
else if (option == ENGINE_OPTION_CLIENT_NAME_PREFIX)
{
fClientNamePrefix = valueStr;

if (fClientNamePrefix.isNotEmpty() && ! fClientNamePrefix.endsWith('/'))
fClientNamePrefix += "/";
}

CarlaEngine::setOption(option, value, valueStr);
}
@@ -1932,7 +1941,16 @@ public:
else if (pData->options.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS)
#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);

jackbridge_set_thread_init_callback(client, carla_jack_thread_init_callback, nullptr);
@@ -3461,6 +3479,8 @@ private:
#ifdef BUILD_BRIDGE
bool fIsRunning;
#else
CarlaString fClientNamePrefix;

enum RackPorts {
kRackPortAudioIn1 = 0,
kRackPortAudioIn2 = 1,


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

@@ -398,6 +398,8 @@ const char* EngineOption2Str(const EngineOption option) noexcept
#endif
case 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);


Loading…
Cancel
Save