Browse Source

Clear up situation with nogui and carla-osc-gui script

tags/v2.3.0-RC1
falkTX 4 years ago
parent
commit
e211b3afc4
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 29 additions and 14 deletions
  1. +4
    -2
      data/carla-osc-gui
  2. +10
    -8
      source/frontend/carla_host.py
  3. +15
    -4
      source/frontend/carla_shared.py

+ 4
- 2
data/carla-osc-gui View File

@@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash


set -e

PYTHON=$(which python3 2>/dev/null) PYTHON=$(which python3 2>/dev/null)


if [ ! -f ${PYTHON} ]; then if [ ! -f ${PYTHON} ]; then
@@ -25,8 +27,8 @@ fi
if lsof -i:21337 > /dev/null; then if lsof -i:21337 > /dev/null; then
echo "NOTICE: Backend already running" echo "NOTICE: Backend already running"
else else
echo "NOTICE: Backend not running yet, starting it now"
${PYTHON} "${INSTALL_FRONTENDDIR}/carla" ${INSTALL_ARGS} --osc-gui=21337 "$@" &
${PYTHON} "${INSTALL_FRONTENDDIR}/carla" ${INSTALL_ARGS} --osc-gui=21337 "$@" --with-appname="carla-osc-dsp"
echo "NOTICE: Backend was not running yet, start was triggered now"
fi fi


exec ${PYTHON} "${INSTALL_FRONTENDDIR}/carla-control" ${INSTALL_ARGS} osc.tcp://127.0.0.1:21337/Carla "$@" exec ${PYTHON} "${INSTALL_FRONTENDDIR}/carla-control" ${INSTALL_ARGS} osc.tcp://127.0.0.1:21337/Carla "$@"

+ 10
- 8
source/frontend/carla_host.py View File

@@ -3125,12 +3125,13 @@ def initHost(initName, libPrefix, isControl, isPlugin, failError, HostClass = No
# -------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------
# Print info # Print info


print("Carla %s started, status:" % VERSION)
print(" Python version: %s" % sys.version.split(" ",1)[0])
print(" Qt version: %s" % QT_VERSION_STR)
print(" PyQt version: %s" % PYQT_VERSION_STR)
print(" Binary dir: %s" % pathBinaries)
print(" Resources dir: %s" % pathResources)
if not (gCarla.nogui and isinstance(gCarla.nogui, int)):
print("Carla %s started, status:" % VERSION)
print(" Python version: %s" % sys.version.split(" ",1)[0])
print(" Qt version: %s" % QT_VERSION_STR)
print(" PyQt version: %s" % PYQT_VERSION_STR)
print(" Binary dir: %s" % pathBinaries)
print(" Resources dir: %s" % pathResources)


# -------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------
# Init host # Init host
@@ -3418,9 +3419,10 @@ def runHostWithoutUI(host):
if not gCarla.nogui: if not gCarla.nogui:
return return


projectFile = getInitialProjectFile(True)

if not isinstance(gCarla.nogui, int): if not isinstance(gCarla.nogui, int):
oscPort = None oscPort = None
projectFile = getInitialProjectFile(True)


if not projectFile: if not projectFile:
print("Carla no-gui mode can only be used together with a project file.") print("Carla no-gui mode can only be used together with a project file.")
@@ -3442,7 +3444,7 @@ def runHostWithoutUI(host):
print("Engine failed to initialize, possible reasons:\n%s" % host.get_last_error()) print("Engine failed to initialize, possible reasons:\n%s" % host.get_last_error())
sys.exit(1) sys.exit(1)


if oscPort is None and not host.load_project(projectFile):
if projectFile and not host.load_project(projectFile):
print("Failed to load selected project file, possible reasons:\n%s" % host.get_last_error()) print("Failed to load selected project file, possible reasons:\n%s" % host.get_last_error())
host.engine_close() host.engine_close()
sys.exit(1) sys.exit(1)


+ 15
- 4
source/frontend/carla_shared.py View File

@@ -666,13 +666,18 @@ def handleInitialCommandLineArguments(file):
print(" and OPTION can be one or more of the following:") print(" and OPTION can be one or more of the following:")
print("") print("")
print(" --cnprefix\t Set a prefix for client names in multi-client mode.") print(" --cnprefix\t Set a prefix for client names in multi-client mode.")
print(" --gdb \t Run Carla inside gdb.")
print(" -n,--no-gui \t Run Carla headless, don't show UI.")
print("")
if not isinstance(gCarla.nogui, int):
print(" --gdb \t Run Carla inside gdb.")
print(" -n,--no-gui \t Run Carla headless, don't show UI.")
print("")
print(" -h,--help \t Print this help text and exit.") print(" -h,--help \t Print this help text and exit.")
print(" -v,--version \t Print version information and exit.") print(" -v,--version \t Print version information and exit.")
print("") print("")


if isinstance(gCarla.nogui, int):
print("NOTE: when using %s the FILE is only valid the first time the backend is started" % initName)
sys.exit(1)

sys.exit(0) sys.exit(0)


elif arg in ("-v", "--v", "-version", "--version"): elif arg in ("-v", "--v", "-version", "--version"):
@@ -685,12 +690,18 @@ def handleInitialCommandLineArguments(file):
print(" Binary dir: %s" % pathBinaries) print(" Binary dir: %s" % pathBinaries)
print(" Resources dir: %s" % pathResources) print(" Resources dir: %s" % pathResources)


sys.exit(0)
sys.exit(1 if gCarla.nogui else 0)


elif readPrefixNext: elif readPrefixNext:
readPrefixNext = False readPrefixNext = False
gCarla.cnprefix = arg gCarla.cnprefix = arg


if gCarla.nogui and isinstance(gCarla.nogui, int):
if os.fork():
os._exit(0)
else:
os.setsid()

return (initName, libPrefix) return (initName, libPrefix)


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------


Loading…
Cancel
Save