Browse Source

carla-single script is back

tags/1.9.6
falkTX 10 years ago
parent
commit
d99a5f9d6e
6 changed files with 400 additions and 231 deletions
  1. +2
    -2
      Makefile
  2. +272
    -0
      data/carla-single
  3. +0
    -123
      data/todo/carla-single
  4. +118
    -104
      source/backend/CarlaStandalone.cpp
  5. +1
    -1
      source/backend/plugin/CarlaPluginLV2.cpp
  6. +7
    -1
      source/bridges-plugin/CarlaBridgePlugin.cpp

+ 2
- 2
Makefile View File

@@ -407,11 +407,11 @@ install:
data/carla-database \
data/carla-patchbay \
data/carla-rack \
data/carla-single \
data/carla-settings \
$(DESTDIR)$(PREFIX)/bin/

# data/carla-control \
# data/carla-single \

# Install desktop files
install -m 644 data/*.desktop $(DESTDIR)$(PREFIX)/share/applications/
@@ -581,10 +581,10 @@ endif
$(DESTDIR)$(PREFIX)/bin/carla-database \
$(DESTDIR)$(PREFIX)/bin/carla-patchbay \
$(DESTDIR)$(PREFIX)/bin/carla-rack \
$(DESTDIR)$(PREFIX)/bin/carla-single \
$(DESTDIR)$(PREFIX)/bin/carla-settings \
$(DESTDIR)$(PREFIX)/lib/pkgconfig/carla-standalone.pc

# $(DESTDIR)$(PREFIX)/bin/carla-single \
# $(DESTDIR)$(PREFIX)/bin/carla-control \

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


+ 272
- 0
data/carla-single View File

@@ -0,0 +1,272 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Script to start carla plugin bridges
# Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# For a full copy of the GNU General Public License see the doc/GPL.txt file.

# --------------------------------------------------------------------------------------------------------
# Imports

import os
import sys
from signal import signal, SIGINT, SIGTERM
from subprocess import Popen

# --------------------------------------------------------------------------------------------------------
# Setup

INSTALL_PREFIX = "X-PREFIX-X"

CARLA_LIBDIR = os.path.join(INSTALL_PREFIX, "lib", "carla")
CARLA_RESDIR = os.path.join(INSTALL_PREFIX, "share", "carla", "resources")

# --------------------------------------------------------------------------------------------------------
# Check for enough arguments

usageMsg = """\
usage: %s [arch (optional)] [format] [filename/uri] [label (optional)] [uniqueId (optional)]

Possible archs:
- native (default)
- linux32
- linux64
- win32
- win64

Possible formats:
- internal
- ladspa
- dssi
- lv2
- vst|vst2
- vst3
- gig
- sf2
- sfz

Examples:
$ %s internal midisplit
$ %s dssi /usr/lib/dssi/hexter.so hexter
$ %s lv2 http://calf.sourceforge.net/plugins/Compressor
$ %s native vst /usr/lib/vst/TAL-NoiseMaker.so
$ %s win32 vst \"~/.wine/drive_c/Program Files (x86)/VstPlugins/Kontakt 5.dll\"

Format can be skipped for internal and lv2 plugins (auto-detected), like this:
$ %s nekofilter
$ %s http://synthv1.sourceforge.net/lv2""" % ((sys.argv[0],)*8)

def printUsageAndQuit():
print(usageMsg)
sys.exit(0)

if len(sys.argv) < 2:
printUsageAndQuit()

# --------------------------------------------------------------------------------------------------------
# Initialize variables to null

ARCH = "native"
FORMAT = "none"
FILENAME = ""
LABEL = ""
UNIQUEID = 0

# --------------------------------------------------------------------------------------------------------
# Set arch

arg = 1

if sys.argv[arg] in ("native", "posix32", "posix64", "linux32", "linux64", "mac32", "mac64", "win32", "win64"):
ARCH = sys.argv[arg].replace("linux", "posix").replace("mac", "posix")
arg += 1

if len(sys.argv) == arg:
printUsageAndQuit()

# --------------------------------------------------------------------------------------------------------
# Set format

if sys.argv[arg] in ("internal", "ladspa", "dssi", "lv2", "vst", "vst2", "vst3", "au", "audiounit", "gig", "sf2", "sfz"):
FORMAT = sys.argv[arg]
arg += 1

if FORMAT == "vst":
FORMAT = "vst2"
elif FORMAT == "audiounit":
FORMAT = "au"

elif len(sys.argv) == arg+1:
FORMAT = "lv2" if ":" in sys.argv[arg] else "internal"

else:
print("Invalid format")
sys.exit(1)

if len(sys.argv) == arg:
printUsageAndQuit()

# --------------------------------------------------------------------------------------------------------
# Set filename/uri

if FORMAT in ("internal", "lv2"):
LABEL = sys.argv[arg]
arg += 1

else:
FILENAME = os.path.expanduser(sys.argv[arg])
arg += 1

# --------------------------------------------------------------------------------------------------------
# Set label (optional)

if len(sys.argv) > arg:
if FORMAT in ("internal", "lv2"):
print("label/uri already set, ignoring 2nd label")
else:
LABEL = sys.argv[arg]
arg += 1

# --------------------------------------------------------------------------------------------------------
# Set uniqueId (optional)

if len(sys.argv) > arg:
if FORMAT in ("internal", "dssi", "lv2", "au", "gig", "sf2", "sfz"):
print("uniqueId is not used in this format, ignored")
else:
try:
UNIQUEID = int(sys.argv[arg])
except:
print("uniqueId must be a number")
sys.exit(1)
arg += 1

# --------------------------------------------------------------------------------------------------------
# Others?

if len(sys.argv) > arg:
print("Got too many arguments, ignoring past uniqueId")

# --------------------------------------------------------------------------------------------------------
# Set bridge binary

BRIDGE = os.path.join(CARLA_LIBDIR, "carla-bridge-" + ARCH)

if ARCH in ("win32", "win64"):
BRIDGE = BRIDGE + ".exe"

# --------------------------------------------------------------------------------------------------------
# Check for existing carla folder

if not os.path.exists(CARLA_LIBDIR):
print("Carla library folder does not exist, is it installed?")
sys.exit(2)

if not os.path.exists(CARLA_RESDIR):
print("Carla resource folder does not exist, is it installed?")
sys.exit(2)

# --------------------------------------------------------------------------------------------------------
# Check for existing arch binary

if not os.path.exists(BRIDGE):
print("Carla plugin bridge for the requested arch (%s) does not exist" % (ARCH,))
sys.exit(2)

# --------------------------------------------------------------------------------------------------------
# Final checks

if ARCH not in ("native", "posix32", "posix64", "win32", "win64"):
print("Invalid arch")
sys.exit(1)

if FORMAT not in ("internal", "ladspa", "dssi", "lv2", "vst2", "vst3", "gig", "sf2", "sfz"):
print("Invalid format")
sys.exit(1)

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"

LADSPA_PATH = os.getenv("LADSPA_PATH")
DSSI_PATH = os.getenv("DSSI_PATH")
LV2_PATH = os.getenv("LV2_PATH")
VST2_PATH = os.getenv("VST_PATH")
VST3_PATH = os.getenv("VST3_PATH")
AU_PATH = os.getenv("AU_PATH")
GIG_PATH = os.getenv("GIG_PATH")
SF2_PATH = os.getenv("SF2_PATH")
SFZ_PATH = os.getenv("SFZ_PATH")

if LADSPA_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_LADSPA"] = LADSPA_PATH
if DSSI_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_DSSI"] = DSSI_PATH
if LV2_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_LV2"] = LV2_PATH
if VST2_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_VST2"] = VST2_PATH
if VST3_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_VST3"] = VST3_PATH
if AU_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_AU"] = AU_PATH
if GIG_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_GIG"] = GIG_PATH
if SF2_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_SF2"] = SF2_PATH
if SFZ_PATH is not None: os.environ["ENGINE_OPTION_PLUGIN_PATH_SFZ"] = SFZ_PATH

os.environ["ENGINE_OPTION_PATH_BINARIES"] = CARLA_LIBDIR
os.environ["ENGINE_OPTION_PATH_RESOURCES"] = CARLA_RESDIR

# --------------------------------------------------------------------------------------------------------
# Exec

command = []

if ARCH in ("win32", "win64"):
command.append("wine")

command.append(BRIDGE)
command.append(FORMAT)
command.append(FILENAME or "(none)")
command.append(LABEL or "(none)")
command.append(str(UNIQUEID))

print(command)

gProc = Popen(command)
gProc.wait()

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

+ 0
- 123
data/todo/carla-single View File

@@ -1,123 +0,0 @@
#!/bin/bash
# Script to start Carla bridges

INSTALL_PREFIX="X-PREFIX-X"
CARLA_PREFIX="$INSTALL_PREFIX"/lib/carla

# ----------------------------------------------------------------------
# Check for enough arguments

if [ "$3"x == ""x ]; then
echo "usage: $0 [arch] [mode] [filename] [label/uri]

Possible archs:
- \"native\"
- \"posix32\"
- \"posix64\"
- \"win32\"
- \"win64\"

Possible modes:
- \"internal\"
- \"ladspa\"
- \"dssi\"
- \"lv2\"
- \"vst\"
- \"gig\"
- \"sf2\"
- \"sfz\"

Examples:
$0 native internal \"midiSplit\"
$0 native dssi \"/usr/lib/dssi/hexter.so\" \"hexter\"
$0 native lv2 \"/usr/lib/lv2/calf/\" \"http://calf.sourceforge.net/plugins/Compressor\"
$0 native vst \"/usr/lib/vst/TAL-NoiseMaker.so\"
"
exit
fi

# ----------------------------------------------------------------------
# Set client name (from environment)

if [ "$CARLA_CLIENT_NAME"x == ""x ]; then
CARLA_CLIENT_NAME="(none)"
fi

# ----------------------------------------------------------------------
# Set variables

RUN_ARCH="$1"
RUN_MODE="$2"
RUN_FILE="$3"
RUN_LABEL="$4"

# ----------------------------------------------------------------------
# Fix arch for windows bridges

if [ $RUN_ARCH == "win32" ]; then
RUN_ARCH="win32.exe"
fi

if [ $RUN_ARCH == "win64" ]; then
RUN_ARCH="win64.exe"
fi

# ----------------------------------------------------------------------
# Check for existing carla folder

if [ ! -d $CARLA_PREFIX ]; then
echo "$0: Carla folder does not exist, is it installed?"
exit
fi

# ----------------------------------------------------------------------
# Check for existing arch binary

CARLA_EXEC="$CARLA_PREFIX/carla-bridge-$RUN_ARCH"

if [ ! -f $CARLA_EXEC ]; then
echo "$0: Invalid arch (may not be installed)"
exit
fi

# ----------------------------------------------------------------------
# Check mode

if [ "$RUN_MODE"x == "internal"x ]; then
RUN_MODE="INTERNAL"
RUN_LABEL="$RUN_FILE"
elif [ "$RUN_MODE"x == "ladspa"x ]; then
if [ "$RUN_LABEL"x == ""x ]; then
echo "$0: LADSPA needs label"
exit
fi
RUN_MODE="LADSPA"
elif [ "$RUN_MODE"x == "dssi"x ]; then
if [ "$RUN_LABEL"x == ""x ]; then
echo "$0: DSSI needs label"
exit
fi
RUN_MODE="DSSI"
elif [ "$RUN_MODE"x == "lv2"x ]; then
if [ "$RUN_LABEL"x == ""x ]; then
echo "$0: LV2 needs uri"
exit
fi
RUN_MODE="LV2"
elif [ "$RUN_MODE"x == "vst"x ]; then
RUN_MODE="VST"
elif [ "$RUN_MODE"x == "gig"x ]; then
RUN_MODE="GIG"
elif [ "$RUN_MODE"x == "sf2"x ]; then
RUN_MODE="SF2"
elif [ "$RUN_MODE"x == "sfz"x ]; then
RUN_MODE="SFZ"
else
echo "$0: Invalid mode"
exit
fi

# ----------------------------------------------------------------------
# Exec

exec $CARLA_EXEC "null" "$RUN_MODE" "$RUN_FILE" "$CARLA_CLIENT_NAME" "$RUN_LABEL"

+ 118
- 104
source/backend/CarlaStandalone.cpp View File

@@ -412,50 +412,69 @@ CarlaEngine* carla_get_engine()

// -------------------------------------------------------------------------------------------------------------------

bool carla_engine_init(const char* driverName, const char* clientName)
static void carla_engine_init_common()
{
CARLA_SAFE_ASSERT_RETURN(driverName != nullptr && driverName[0] != '\0', false);
CARLA_SAFE_ASSERT_RETURN(clientName != nullptr && clientName[0] != '\0', false);
carla_debug("carla_engine_init(\"%s\", \"%s\")", driverName, clientName);
gStandalone.engine->setCallback(gStandalone.engineCallback, gStandalone.engineCallbackPtr);
gStandalone.engine->setFileCallback(gStandalone.fileCallback, gStandalone.fileCallbackPtr);

if (gStandalone.engine != nullptr)
{
carla_stderr2("Engine is already running");
gStandalone.lastError = "Engine is already running";
return false;
}
#ifdef BUILD_BRIDGE
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);

#ifdef CARLA_OS_WIN
carla_setenv("WINEASIO_CLIENT_NAME", clientName);
#endif
if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_PREFER_PLUGIN_BRIDGES"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);

// TODO: make this an option, put somewhere else
if (std::getenv("WINE_RT") == nullptr)
{
carla_setenv("WINE_RT", "15");
carla_setenv("WINE_SVR_RT", "10");
}
if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_PREFER_UI_BRIDGES"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);

gStandalone.engine = CarlaEngine::newDriverByName(driverName);
if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_UIS_ALWAYS_ON_TOP"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);

if (gStandalone.engine == nullptr)
{
carla_stderr2("The seleted audio driver is not available");
gStandalone.lastError = "The seleted audio driver is not available";
return false;
}
if (const char* const maxParameters = std::getenv("ENGINE_OPTION_MAX_PARAMETERS"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, std::atoi(maxParameters), nullptr);

gStandalone.engine->setCallback(gStandalone.engineCallback, gStandalone.engineCallbackPtr);
gStandalone.engine->setFileCallback(gStandalone.fileCallback, gStandalone.fileCallbackPtr);
if (const char* const uiBridgesTimeout = std::getenv("ENGINE_OPTION_UI_BRIDGES_TIMEOUT"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, std::atoi(uiBridgesTimeout), nullptr);

#ifdef BUILD_BRIDGE
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_JACK, nullptr);
#else
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, static_cast<int>(gStandalone.engineOptions.processMode), nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.engineOptions.transportMode), nullptr);
#endif
if (const char* const pathLADSPA = std::getenv("ENGINE_OPTION_PLUGIN_PATH_LADSPA"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LADSPA, pathLADSPA);

if (const char* const pathDSSI = std::getenv("ENGINE_OPTION_PLUGIN_PATH_DSSI"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_DSSI, pathDSSI);

if (const char* const pathLV2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_LV2"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LV2, pathLV2);

if (const char* const pathVST2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_VST2"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST2, pathVST2);

if (const char* const pathVST3 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_VST3"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST3, pathVST3);

if (const char* const pathAU = std::getenv("ENGINE_OPTION_PLUGIN_PATH_AU"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_AU, pathAU);

if (const char* const pathGIG = std::getenv("ENGINE_OPTION_PLUGIN_PATH_GIG"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_GIG, pathGIG);

if (const char* const pathSF2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_SF2"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SF2, pathSF2);

if (const char* const pathSFZ = std::getenv("ENGINE_OPTION_PLUGIN_PATH_SFZ"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SFZ, pathSFZ);

if (const char* const binaryDir = std::getenv("ENGINE_OPTION_PATH_BINARIES"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, binaryDir);

if (const char* const resourceDir = std::getenv("ENGINE_OPTION_PATH_RESOURCES"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, resourceDir);

if (const char* const preventBadBehaviour = std::getenv("ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, (std::strcmp(preventBadBehaviour, "true") == 0) ? 1 : 0, nullptr);

if (const char* const frontendWinId = std::getenv("ENGINE_OPTION_FRONTEND_WIN_ID"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_FRONTEND_WIN_ID, 0, frontendWinId);
#else
gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, gStandalone.engineOptions.forceStereo ? 1 : 0, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, gStandalone.engineOptions.preferPluginBridges ? 1 : 0, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, gStandalone.engineOptions.preferUiBridges ? 1 : 0, nullptr);
@@ -467,42 +486,42 @@ bool carla_engine_init(const char* driverName, const char* clientName)
gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE, static_cast<int>(gStandalone.engineOptions.audioSampleRate), nullptr);

if (gStandalone.engineOptions.audioDevice != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_DEVICE, 0, gStandalone.engineOptions.audioDevice);
gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_DEVICE, 0, gStandalone.engineOptions.audioDevice);

if (gStandalone.engineOptions.pathLADSPA != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LADSPA, gStandalone.engineOptions.pathLADSPA);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LADSPA, gStandalone.engineOptions.pathLADSPA);

if (gStandalone.engineOptions.pathDSSI != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_DSSI, gStandalone.engineOptions.pathDSSI);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_DSSI, gStandalone.engineOptions.pathDSSI);

if (gStandalone.engineOptions.pathLV2 != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LV2, gStandalone.engineOptions.pathLV2);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LV2, gStandalone.engineOptions.pathLV2);

if (gStandalone.engineOptions.pathVST2 != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST2, gStandalone.engineOptions.pathVST2);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST2, gStandalone.engineOptions.pathVST2);

if (gStandalone.engineOptions.pathVST3 != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST3, gStandalone.engineOptions.pathVST3);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST3, gStandalone.engineOptions.pathVST3);

if (gStandalone.engineOptions.pathAU != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_AU, gStandalone.engineOptions.pathAU);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_AU, gStandalone.engineOptions.pathAU);

if (gStandalone.engineOptions.pathGIG != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_GIG, gStandalone.engineOptions.pathGIG);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_GIG, gStandalone.engineOptions.pathGIG);

if (gStandalone.engineOptions.pathSF2 != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SF2, gStandalone.engineOptions.pathSF2);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SF2, gStandalone.engineOptions.pathSF2);

if (gStandalone.engineOptions.pathSFZ != nullptr)
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SFZ, gStandalone.engineOptions.pathSFZ);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SFZ, gStandalone.engineOptions.pathSFZ);

if (gStandalone.engineOptions.binaryDir != nullptr && gStandalone.engineOptions.binaryDir[0] != '\0')
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, gStandalone.engineOptions.binaryDir);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, gStandalone.engineOptions.binaryDir);

if (gStandalone.engineOptions.resourceDir != nullptr && gStandalone.engineOptions.resourceDir[0] != '\0')
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, gStandalone.engineOptions.resourceDir);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, gStandalone.engineOptions.resourceDir);

gStandalone.engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, gStandalone.engineOptions.preventBadBehaviour ? 1 : 0, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, gStandalone.engineOptions.preventBadBehaviour ? 1 : 0, nullptr);

if (gStandalone.engineOptions.frontendWinId != 0)
{
@@ -513,6 +532,54 @@ bool carla_engine_init(const char* driverName, const char* clientName)
}
else
gStandalone.engine->setOption(CB::ENGINE_OPTION_FRONTEND_WIN_ID, 0, "0");
#endif
}

bool carla_engine_init(const char* driverName, const char* clientName)
{
CARLA_SAFE_ASSERT_RETURN(driverName != nullptr && driverName[0] != '\0', false);
CARLA_SAFE_ASSERT_RETURN(clientName != nullptr && clientName[0] != '\0', false);
carla_debug("carla_engine_init(\"%s\", \"%s\")", driverName, clientName);

if (gStandalone.engine != nullptr)
{
carla_stderr2("Engine is already running");
gStandalone.lastError = "Engine is already running";
return false;
}

#ifdef CARLA_OS_WIN
carla_setenv("WINEASIO_CLIENT_NAME", clientName);
#endif

// TODO: make this an option, put somewhere else
if (std::getenv("WINE_RT") == nullptr)
{
carla_setenv("WINE_RT", "15");
carla_setenv("WINE_SVR_RT", "10");
}

gStandalone.engine = CarlaEngine::newDriverByName(driverName);

if (gStandalone.engine == nullptr)
{
carla_stderr2("The seleted audio driver is not available");
gStandalone.lastError = "The seleted audio driver is not available";
return false;
}

carla_engine_init_common();

#ifdef BUILD_BRIDGE
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_JACK, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, false, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, false, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, false, nullptr);
#else
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, static_cast<int>(gStandalone.engineOptions.processMode), nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.engineOptions.transportMode), nullptr);
#endif

if (gStandalone.engine->init(clientName))
{
@@ -558,63 +625,10 @@ bool carla_engine_init_bridge(const char audioBaseName[6+1], const char rtClient
return false;
}

gStandalone.engine->setCallback(gStandalone.engineCallback, gStandalone.engineCallbackPtr);
gStandalone.engine->setFileCallback(gStandalone.fileCallback, gStandalone.fileCallbackPtr);

// forced options for bridge mode
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_BRIDGE, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_BRIDGE, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, false, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, false, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, false, nullptr);

if (const char* const uisAlwaysOnTop = std::getenv("ENGINE_OPTION_UIS_ALWAYS_ON_TOP"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, (std::strcmp(uisAlwaysOnTop, "true") == 0) ? 1 : 0, nullptr);

if (const char* const maxParameters = std::getenv("ENGINE_OPTION_MAX_PARAMETERS"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, std::atoi(maxParameters), nullptr);

if (const char* const uiBridgesTimeout = std::getenv("ENGINE_OPTION_UI_BRIDGES_TIMEOUT"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, std::atoi(uiBridgesTimeout), nullptr);

if (const char* const pathLADSPA = std::getenv("ENGINE_OPTION_PLUGIN_PATH_LADSPA"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LADSPA, pathLADSPA);

if (const char* const pathDSSI = std::getenv("ENGINE_OPTION_PLUGIN_PATH_DSSI"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_DSSI, pathDSSI);

if (const char* const pathLV2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_LV2"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_LV2, pathLV2);

if (const char* const pathVST2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_VST2"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST2, pathVST2);

if (const char* const pathVST3 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_VST3"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_VST3, pathVST3);

if (const char* const pathAU = std::getenv("ENGINE_OPTION_PLUGIN_PATH_AU"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_AU, pathAU);

if (const char* const pathGIG = std::getenv("ENGINE_OPTION_PLUGIN_PATH_GIG"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_GIG, pathGIG);
carla_engine_init_common();

if (const char* const pathSF2 = std::getenv("ENGINE_OPTION_PLUGIN_PATH_SF2"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SF2, pathSF2);

if (const char* const pathSFZ = std::getenv("ENGINE_OPTION_PLUGIN_PATH_SFZ"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PLUGIN_PATH, CB::PLUGIN_SFZ, pathSFZ);

if (const char* const binaryDir = std::getenv("ENGINE_OPTION_PATH_BINARIES"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BINARIES, 0, binaryDir);

if (const char* const resourceDir = std::getenv("ENGINE_OPTION_PATH_RESOURCES"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, resourceDir);

if (const char* const preventBadBehaviour = std::getenv("ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR, (std::strcmp(preventBadBehaviour, "true") == 0) ? 1 : 0, nullptr);

if (const char* const frontendWinId = std::getenv("ENGINE_OPTION_FRONTEND_WIN_ID"))
gStandalone.engine->setOption(CB::ENGINE_OPTION_FRONTEND_WIN_ID, 0, frontendWinId);
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_BRIDGE, nullptr);
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_BRIDGE, nullptr);

if (gStandalone.engine->init(clientName))
{


+ 1
- 1
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -4665,7 +4665,7 @@ public:

if (fRdfDescriptor == nullptr)
{
pData->engine->setLastError("Failed to find the requested plugin in the LV2 Bundle");
pData->engine->setLastError("Failed to find the requested plugin");
return false;
}



+ 7
- 1
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -299,10 +299,16 @@ int main(int argc, char* argv[])
// Get args

const char* const stype = argv[1];
const char* const filename = argv[2];
const char* filename = argv[2];
const char* label = argv[3];
const int64_t uniqueId = (argc == 5) ? static_cast<int64_t>(std::atoll(argv[4])) : 0;

if (filename[0] == '\0' || std::strcmp(filename, "(none)") == 0)
filename = nullptr;

if (label[0] == '\0' || std::strcmp(label, "(none)") == 0)
label = nullptr;

// ---------------------------------------------------------------------
// Check plugin type



Loading…
Cancel
Save