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

This commit is contained in:
falkTX 2020-12-24 15:34:10 +00:00
parent 899d277cfc
commit e211b3afc4
No known key found for this signature in database
GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 29 additions and 14 deletions

View File

@ -1,5 +1,7 @@
#!/bin/bash
set -e
PYTHON=$(which python3 2>/dev/null)
if [ ! -f ${PYTHON} ]; then
@ -25,8 +27,8 @@ fi
if lsof -i:21337 > /dev/null; then
echo "NOTICE: Backend already running"
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
exec ${PYTHON} "${INSTALL_FRONTENDDIR}/carla-control" ${INSTALL_ARGS} osc.tcp://127.0.0.1:21337/Carla "$@"

View File

@ -3125,12 +3125,13 @@ def initHost(initName, libPrefix, isControl, isPlugin, failError, HostClass = No
# --------------------------------------------------------------------------------------------------------
# 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
@ -3418,9 +3419,10 @@ def runHostWithoutUI(host):
if not gCarla.nogui:
return
projectFile = getInitialProjectFile(True)
if not isinstance(gCarla.nogui, int):
oscPort = None
projectFile = getInitialProjectFile(True)
if not projectFile:
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())
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())
host.engine_close()
sys.exit(1)

View File

@ -666,13 +666,18 @@ def handleInitialCommandLineArguments(file):
print(" and OPTION can be one or more of the following:")
print("")
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(" -v,--version \t Print version information and exit.")
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)
elif arg in ("-v", "--v", "-version", "--version"):
@ -685,12 +690,18 @@ def handleInitialCommandLineArguments(file):
print(" Binary dir: %s" % pathBinaries)
print(" Resources dir: %s" % pathResources)
sys.exit(0)
sys.exit(1 if gCarla.nogui else 0)
elif readPrefixNext:
readPrefixNext = False
gCarla.cnprefix = arg
if gCarla.nogui and isinstance(gCarla.nogui, int):
if os.fork():
os._exit(0)
else:
os.setsid()
return (initName, libPrefix)
# ------------------------------------------------------------------------------------------------------------