From da59d56e20dc50808402c4baf324cb95d7403641 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 5 Jan 2015 14:30:39 +0000 Subject: [PATCH] Fix carla-single under ladish, closes #184 --- data/carla-single | 39 ++++++++++-------------------- source/backend/CarlaStandalone.cpp | 10 ++++---- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/data/carla-single b/data/carla-single index 649eadfcd..e3d872481 100755 --- a/data/carla-single +++ b/data/carla-single @@ -21,8 +21,6 @@ import os import sys -from signal import signal, SIGINT, SIGTERM -from subprocess import Popen # -------------------------------------------------------------------------------------------------------- # Setup @@ -199,30 +197,9 @@ if FILENAME and not os.path.exists(FILENAME): print("Requested filename does not exist") sys.exit(1) -# ------------------------------------------------------------------------------------------------------------ -# Signal handler - -global gProc -gProc = None - -def signalHandler(sig, frame): - global gProc - - if gProc is None: - return - - if sig in (SIGINT, SIGTERM): - gProc.kill() - gProc = None - -signal(SIGINT, signalHandler) -signal(SIGTERM, signalHandler) - # -------------------------------------------------------------------------------------------------------- # Setup environment -#CARLA_CLIENT_NAME = os.getenv("CARLA_CLIENT_NAME", "(none)") - #os.environ["ENGINE_OPTION_UIS_ALWAYS_ON_TOP"] = "false" #os.environ["ENGINE_OPTION_MAX_PARAMETERS"] = "200" #os.environ["ENGINE_OPTION_UI_BRIDGES_TIMEOUT"] = "3000" @@ -250,6 +227,18 @@ if SFZ_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_SFZ"] = SFZ os.environ["ENGINE_OPTION_PATH_BINARIES"] = CARLA_LIBDIR os.environ["ENGINE_OPTION_PATH_RESOURCES"] = CARLA_RESDIR +# -------------------------------------------------------------------------------------------------------- + +CARLA_CLIENT_NAME = os.getenv("CARLA_CLIENT_NAME") +LADISH_APP_NAME = os.getenv("LADISH_APP_NAME") + +if CARLA_CLIENT_NAME is not None: + os.environ["CARLA_CLIENT_NAME"] = CARLA_CLIENT_NAME +elif CARLA_CLIENT_NAME is not None: + os.environ["CARLA_CLIENT_NAME"] = LADISH_APP_NAME +else: + os.environ["CARLA_CLIENT_NAME"] = "(none)" + # -------------------------------------------------------------------------------------------------------- # Exec @@ -265,8 +254,6 @@ command.append(LABEL or "(none)") command.append(str(UNIQUEID)) print(command) - -gProc = Popen(command) -gProc.wait() +os.execvp(command[0], command) # -------------------------------------------------------------------------------------------------------- diff --git a/source/backend/CarlaStandalone.cpp b/source/backend/CarlaStandalone.cpp index fbe8de1cc..6a268e217 100644 --- a/source/backend/CarlaStandalone.cpp +++ b/source/backend/CarlaStandalone.cpp @@ -70,11 +70,6 @@ struct CarlaBackendStandalone { engineOptions.forceStereo = false; engineOptions.preferPluginBridges = false; engineOptions.preferUiBridges = false; - - using juce::File; - File binaryDir(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory()); - engineOptions.binaryDir = carla_strdup_safe(binaryDir.getFullPathName().toRawUTF8()); - engineOptions.resourceDir = carla_strdup_safe(binaryDir.getChildFile("resources").getFullPathName().toRawUTF8()); #endif } @@ -418,6 +413,11 @@ static void carla_engine_init_common() gStandalone.engine->setFileCallback(gStandalone.fileCallback, gStandalone.fileCallbackPtr); #ifdef BUILD_BRIDGE + using juce::File; + File binaryDir(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory()); + gStandalone.engineOptions.binaryDir = carla_strdup_safe(binaryDir.getFullPathName().toRawUTF8()); + gStandalone.engineOptions.resourceDir = carla_strdup_safe(binaryDir.getChildFile("resources").getFullPathName().toRawUTF8()); + if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_FORCE_STEREO")) gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);