Browse Source

Implement a way to set plugins as standalones

tags/v2.3.2
falkTX 3 years ago
parent
commit
1ff775e726
20 changed files with 118 additions and 56 deletions
  1. +11
    -2
      source/backend/CarlaBackend.h
  2. +1
    -0
      source/backend/CarlaEngine.hpp
  3. +0
    -2
      source/backend/CarlaHost.h
  4. +3
    -3
      source/backend/CarlaHostImpl.hpp
  5. +14
    -5
      source/backend/CarlaStandalone.cpp
  6. +10
    -7
      source/backend/engine/CarlaEngine.cpp
  7. +2
    -1
      source/backend/engine/CarlaEngineData.cpp
  8. +1
    -1
      source/backend/plugin/CarlaPluginJuce.cpp
  9. +5
    -4
      source/backend/plugin/CarlaPluginLV2.cpp
  10. +3
    -3
      source/backend/plugin/CarlaPluginVST2.cpp
  11. +2
    -1
      source/bridges-plugin/CarlaBridgePlugin.cpp
  12. +3
    -0
      source/bridges-ui/CarlaBridgeFormat.cpp
  13. +9
    -2
      source/bridges-ui/CarlaBridgeFormat.hpp
  14. +1
    -0
      source/bridges-ui/CarlaBridgeFormatLV2.cpp
  15. +4
    -4
      source/bridges-ui/CarlaBridgeToolkitNative.cpp
  16. +4
    -1
      source/frontend/carla_backend.py
  17. +7
    -1
      source/utils/CarlaBackendUtils.hpp
  18. +19
    -12
      source/utils/CarlaPluginUI.cpp
  19. +9
    -5
      source/utils/CarlaPluginUI.hpp
  20. +10
    -2
      source/utils/JucePluginWindow.hpp

+ 11
- 2
source/backend/CarlaBackend.h View File

@@ -1,6 +1,6 @@
/* /*
* Carla Plugin Host * Carla Plugin Host
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -1368,6 +1368,7 @@ typedef enum {
*/ */
ENGINE_OPTION_AUDIO_DEVICE = 14, ENGINE_OPTION_AUDIO_DEVICE = 14,


#ifndef BUILD_BRIDGE
/*! /*!
* Wherever to enable OSC support in the engine. * Wherever to enable OSC support in the engine.
*/ */
@@ -1389,6 +1390,7 @@ typedef enum {
* @note Valid ports begin at 1024 and end at 32767 (inclusive) * @note Valid ports begin at 1024 and end at 32767 (inclusive)
*/ */
ENGINE_OPTION_OSC_PORT_UDP = 17, ENGINE_OPTION_OSC_PORT_UDP = 17,
#endif


/*! /*!
* Set path used for a specific file type. * Set path used for a specific file type.
@@ -1475,17 +1477,24 @@ typedef enum {
ENGINE_OPTION_WINE_SERVER_RT_PRIO = 32, ENGINE_OPTION_WINE_SERVER_RT_PRIO = 32,
#endif #endif


#ifndef BUILD_BRIDGE
/*! /*!
* Capture console output into debug callbacks. * Capture console output into debug callbacks.
*/ */
ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33, ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33,
#endif


/*! /*!
* A prefix to give to all plugin clients created by Carla. * A prefix to give to all plugin clients created by Carla.
* Mostly useful for JACK multi-client mode. * Mostly useful for JACK multi-client mode.
* @note MUST include at least one "." (dot). * @note MUST include at least one "." (dot).
*/ */
ENGINE_OPTION_CLIENT_NAME_PREFIX = 34
ENGINE_OPTION_CLIENT_NAME_PREFIX = 34,

/*!
* Treat loaded plugins as standalone (that is, there is no host UI to manage them)
*/
ENGINE_OPTION_PLUGINS_ARE_STANDALONE = 35


} EngineOption; } EngineOption;




+ 1
- 0
source/backend/CarlaEngine.hpp View File

@@ -242,6 +242,7 @@ struct CARLA_API EngineOptions {
bool preferPluginBridges; bool preferPluginBridges;
bool preferUiBridges; bool preferUiBridges;
bool uisAlwaysOnTop; bool uisAlwaysOnTop;
bool pluginsAreStandalone;
uint bgColor; uint bgColor;
uint fgColor; uint fgColor;
float uiScale; float uiScale;


+ 0
- 2
source/backend/CarlaHost.h View File

@@ -489,7 +489,6 @@ CARLA_EXPORT bool carla_set_engine_about_to_close(CarlaHostHandle handle);
*/ */
CARLA_EXPORT void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func, void* ptr); CARLA_EXPORT void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func, void* ptr);


#ifndef BUILD_BRIDGE
/*! /*!
* Set an engine option. * Set an engine option.
* @param option Option * @param option Option
@@ -497,7 +496,6 @@ CARLA_EXPORT void carla_set_engine_callback(CarlaHostHandle handle, EngineCallba
* @param valueStr Value as string * @param valueStr Value as string
*/ */
CARLA_EXPORT void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int value, const char* valueStr); CARLA_EXPORT void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int value, const char* valueStr);
#endif


/*! /*!
* Set the file callback function. * Set the file callback function.


+ 3
- 3
source/backend/CarlaHostImpl.hpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Plugin Host * Carla Plugin Host
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -57,8 +57,8 @@ struct CarlaHostStandalone : CarlaHostHandleImpl {
FileCallbackFunc fileCallback; FileCallbackFunc fileCallback;
void* fileCallbackPtr; void* fileCallbackPtr;


#ifndef BUILD_BRIDGE
EngineOptions engineOptions; EngineOptions engineOptions;
#ifndef BUILD_BRIDGE
CarlaLogThread logThread; CarlaLogThread logThread;
bool logThreadEnabled; bool logThreadEnabled;
#endif #endif
@@ -71,8 +71,8 @@ struct CarlaHostStandalone : CarlaHostHandleImpl {
engineCallbackPtr(nullptr), engineCallbackPtr(nullptr),
fileCallback(nullptr), fileCallback(nullptr),
fileCallbackPtr(nullptr), fileCallbackPtr(nullptr),
#ifndef BUILD_BRIDGE
engineOptions(), engineOptions(),
#ifndef BUILD_BRIDGE
logThread(), logThread(),
logThreadEnabled(false), logThreadEnabled(false),
#endif #endif


+ 14
- 5
source/backend/CarlaStandalone.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Standalone * Carla Standalone
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -388,6 +388,8 @@ static void carla_engine_init_common(const CarlaHostStandalone& standalone, Carl
# endif # endif


engine->setOption(CB::ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, standalone.engineOptions.clientNamePrefix); engine->setOption(CB::ENGINE_OPTION_CLIENT_NAME_PREFIX, 0, standalone.engineOptions.clientNamePrefix);

engine->setOption(CB::ENGINE_OPTION_PLUGINS_ARE_STANDALONE, standalone.engineOptions.pluginsAreStandalone, nullptr);
#endif // BUILD_BRIDGE #endif // BUILD_BRIDGE
} }


@@ -694,7 +696,6 @@ void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func,
handle->engine->setCallback(func, ptr); handle->engine->setCallback(func, ptr);
} }


#ifndef BUILD_BRIDGE
void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int value, const char* valueStr) void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int value, const char* valueStr)
{ {
carla_debug("carla_set_engine_option(%p, %i:%s, %i, \"%s\")", carla_debug("carla_set_engine_option(%p, %i:%s, %i, \"%s\")",
@@ -811,6 +812,7 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
shandle.engineOptions.audioDevice = carla_strdup_safe(valueStr); shandle.engineOptions.audioDevice = carla_strdup_safe(valueStr);
break; break;


#ifndef BUILD_BRIDGE
case CB::ENGINE_OPTION_OSC_ENABLED: case CB::ENGINE_OPTION_OSC_ENABLED:
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,); CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
shandle.engineOptions.oscEnabled = (value != 0); shandle.engineOptions.oscEnabled = (value != 0);
@@ -825,6 +827,7 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
CARLA_SAFE_ASSERT_RETURN(value <= 0 || value >= 1024,); CARLA_SAFE_ASSERT_RETURN(value <= 0 || value >= 1024,);
shandle.engineOptions.oscPortUDP = value; shandle.engineOptions.oscPortUDP = value;
break; break;
#endif


case CB::ENGINE_OPTION_FILE_PATH: case CB::ENGINE_OPTION_FILE_PATH:
CARLA_SAFE_ASSERT_RETURN(value > CB::FILE_NONE,); CARLA_SAFE_ASSERT_RETURN(value > CB::FILE_NONE,);
@@ -934,7 +937,7 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
shandle.engineOptions.frontendWinId = static_cast<uintptr_t>(winId); shandle.engineOptions.frontendWinId = static_cast<uintptr_t>(winId);
} break; } break;


# ifndef CARLA_OS_WIN
#if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
case CB::ENGINE_OPTION_WINE_EXECUTABLE: case CB::ENGINE_OPTION_WINE_EXECUTABLE:
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',);


@@ -972,11 +975,13 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
CARLA_SAFE_ASSERT_RETURN(value >= 1 && value <= 99,); CARLA_SAFE_ASSERT_RETURN(value >= 1 && value <= 99,);
shandle.engineOptions.wine.serverRtPrio = value; shandle.engineOptions.wine.serverRtPrio = value;
break; break;
# endif // CARLA_OS_WIN
#endif


#ifndef BUILD_BRIDGE
case CB::ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: case CB::ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
shandle.logThreadEnabled = (value != 0); shandle.logThreadEnabled = (value != 0);
break; break;
#endif


case CB::ENGINE_OPTION_CLIENT_NAME_PREFIX: case CB::ENGINE_OPTION_CLIENT_NAME_PREFIX:
if (shandle.engineOptions.clientNamePrefix != nullptr) if (shandle.engineOptions.clientNamePrefix != nullptr)
@@ -986,13 +991,17 @@ void carla_set_engine_option(CarlaHostHandle handle, EngineOption option, int va
? carla_strdup_safe(valueStr) ? carla_strdup_safe(valueStr)
: nullptr; : nullptr;
break; break;

case CB::ENGINE_OPTION_PLUGINS_ARE_STANDALONE:
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
shandle.engineOptions.pluginsAreStandalone = (value != 0);
break;
} }
} }


if (handle->engine != nullptr) if (handle->engine != nullptr)
handle->engine->setOption(option, value, valueStr); handle->engine->setOption(option, value, valueStr);
} }
#endif // BUILD_BRIDGE


void carla_set_file_callback(CarlaHostHandle handle, FileCallbackFunc func, void* ptr) void carla_set_file_callback(CarlaHostHandle handle, FileCallbackFunc func, void* ptr)
{ {


+ 10
- 7
source/backend/engine/CarlaEngine.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Plugin Host * Carla Plugin Host
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -1902,26 +1902,22 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
pData->options.audioDevice = carla_strdup_safe(valueStr); pData->options.audioDevice = carla_strdup_safe(valueStr);
break; break;


#ifndef BUILD_BRIDGE
case ENGINE_OPTION_OSC_ENABLED: case ENGINE_OPTION_OSC_ENABLED:
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,); CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
#ifndef BUILD_BRIDGE
pData->options.oscEnabled = (value != 0); pData->options.oscEnabled = (value != 0);
#endif
break; break;


case ENGINE_OPTION_OSC_PORT_TCP: case ENGINE_OPTION_OSC_PORT_TCP:
CARLA_SAFE_ASSERT_RETURN(value <= 0 || value >= 1024,); CARLA_SAFE_ASSERT_RETURN(value <= 0 || value >= 1024,);
#ifndef BUILD_BRIDGE
pData->options.oscPortTCP = value; pData->options.oscPortTCP = value;
#endif
break; break;


case ENGINE_OPTION_OSC_PORT_UDP: case ENGINE_OPTION_OSC_PORT_UDP:
CARLA_SAFE_ASSERT_RETURN(value <= 0 || value >= 1024,); CARLA_SAFE_ASSERT_RETURN(value <= 0 || value >= 1024,);
#ifndef BUILD_BRIDGE
pData->options.oscPortUDP = value; pData->options.oscPortUDP = value;
#endif
break; break;
#endif


case ENGINE_OPTION_FILE_PATH: case ENGINE_OPTION_FILE_PATH:
CARLA_SAFE_ASSERT_RETURN(value > FILE_NONE,); CARLA_SAFE_ASSERT_RETURN(value > FILE_NONE,);
@@ -2116,8 +2112,10 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
break; break;
#endif #endif


#ifndef BUILD_BRIDGE
case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
break; break;
#endif


case ENGINE_OPTION_CLIENT_NAME_PREFIX: case ENGINE_OPTION_CLIENT_NAME_PREFIX:
if (pData->options.clientNamePrefix != nullptr) if (pData->options.clientNamePrefix != nullptr)
@@ -2127,6 +2125,11 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
? carla_strdup_safe(valueStr) ? carla_strdup_safe(valueStr)
: nullptr; : nullptr;
break; break;

case ENGINE_OPTION_PLUGINS_ARE_STANDALONE:
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,);
pData->options.pluginsAreStandalone = (value != 0);
break;
} }
} }




+ 2
- 1
source/backend/engine/CarlaEngineData.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Plugin Host * Carla Plugin Host
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -209,6 +209,7 @@ EngineOptions::EngineOptions() noexcept
preferUiBridges(true), preferUiBridges(true),
#endif #endif
uisAlwaysOnTop(true), uisAlwaysOnTop(true),
pluginsAreStandalone(false),
bgColor(0x000000ff), bgColor(0x000000ff),
fgColor(0xffffffff), fgColor(0xffffffff),
uiScale(1.0f), uiScale(1.0f),


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

@@ -494,7 +494,7 @@ public:
uiName += " (GUI)"; uiName += " (GUI)";
} }


fWindow = new JucePluginWindow(opts.frontendWinId);
fWindow = new JucePluginWindow(opts.frontendWinId, opts.pluginsAreStandalone);
fWindow->setName(uiName); fWindow->setName(uiName);
} }




+ 5
- 4
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla LV2 Plugin * Carla LV2 Plugin
* Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -1892,6 +1892,7 @@ public:
if (fUI.type == UI::TYPE_EMBED && fUI.rdfDescriptor->Type != LV2_UI_NONE && fUI.window == nullptr) if (fUI.type == UI::TYPE_EMBED && fUI.rdfDescriptor->Type != LV2_UI_NONE && fUI.window == nullptr)
{ {
const char* msg = nullptr; const char* msg = nullptr;
const bool isStandalone = pData->engine->getOptions().pluginsAreStandalone;


switch (fUI.rdfDescriptor->Type) switch (fUI.rdfDescriptor->Type)
{ {
@@ -1906,7 +1907,7 @@ public:


case LV2_UI_COCOA: case LV2_UI_COCOA:
# ifdef CARLA_OS_MAC # ifdef CARLA_OS_MAC
fUI.window = CarlaPluginUI::newCocoa(this, frontendWinId, isUiResizable());
fUI.window = CarlaPluginUI::newCocoa(this, frontendWinId, isStandalone, isUiResizable());
# else # else
msg = "UI is for MacOS only"; msg = "UI is for MacOS only";
# endif # endif
@@ -1914,7 +1915,7 @@ public:


case LV2_UI_WINDOWS: case LV2_UI_WINDOWS:
# ifdef CARLA_OS_WIN # ifdef CARLA_OS_WIN
fUI.window = CarlaPluginUI::newWindows(this, frontendWinId, isUiResizable());
fUI.window = CarlaPluginUI::newWindows(this, frontendWinId, isStandalone, isUiResizable());
# else # else
msg = "UI is for Windows only"; msg = "UI is for Windows only";
# endif # endif
@@ -1922,7 +1923,7 @@ public:


case LV2_UI_X11: case LV2_UI_X11:
# ifdef HAVE_X11 # ifdef HAVE_X11
fUI.window = CarlaPluginUI::newX11(this, frontendWinId, isUiResizable(), true);
fUI.window = CarlaPluginUI::newX11(this, frontendWinId, isStandalone, isUiResizable(), true);
# else # else
msg = "UI is only for systems with X11"; msg = "UI is only for systems with X11";
# endif # endif


+ 3
- 3
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -546,11 +546,11 @@ public:
const EngineOptions& opts(pData->engine->getOptions()); const EngineOptions& opts(pData->engine->getOptions());


#if defined(CARLA_OS_MAC) #if defined(CARLA_OS_MAC)
fUI.window = CarlaPluginUI::newCocoa(this, opts.frontendWinId, false);
fUI.window = CarlaPluginUI::newCocoa(this, opts.frontendWinId, opts.pluginsAreStandalone, false);
#elif defined(CARLA_OS_WIN) #elif defined(CARLA_OS_WIN)
fUI.window = CarlaPluginUI::newWindows(this, opts.frontendWinId, false);
fUI.window = CarlaPluginUI::newWindows(this, opts.frontendWinId, opts.pluginsAreStandalone, false);
#elif defined(HAVE_X11) #elif defined(HAVE_X11)
fUI.window = CarlaPluginUI::newX11(this, opts.frontendWinId, false, false);
fUI.window = CarlaPluginUI::newX11(this, opts.frontendWinId, opts.pluginsAreStandalone, false, false);
#else #else
msg = "Unsupported UI type"; msg = "Unsupported UI type";
#endif #endif


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

@@ -1,6 +1,6 @@
/* /*
* Carla Bridge Plugin * Carla Bridge Plugin
* Copyright (C) 2012-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -661,6 +661,7 @@ int main(int argc, char* argv[])
if (! useBridge) if (! useBridge)
{ {
carla_set_active(gHostHandle, 0, true); carla_set_active(gHostHandle, 0, true);
carla_set_engine_option(gHostHandle, CarlaBackend::ENGINE_OPTION_PLUGINS_ARE_STANDALONE, 1, nullptr);


if (const CarlaPluginInfo* const pluginInfo = carla_get_plugin_info(gHostHandle, 0)) if (const CarlaPluginInfo* const pluginInfo = carla_get_plugin_info(gHostHandle, 0))
{ {


+ 3
- 0
source/bridges-ui/CarlaBridgeFormat.cpp View File

@@ -253,6 +253,9 @@ bool CarlaBridgeFormat::msgReceived(const char* const msg) noexcept
CARLA_SAFE_ASSERT_RETURN(readNextLineAsULong(transientWindowId), true); CARLA_SAFE_ASSERT_RETURN(readNextLineAsULong(transientWindowId), true);
opts.transientWindowId = transientWindowId; opts.transientWindowId = transientWindowId;


// we can assume we are not standalone if we got options from controller side
opts.isStandalone = true;

fGotOptions = true; fGotOptions = true;
uiOptionsChanged(opts); uiOptionsChanged(opts);




+ 9
- 2
source/bridges-ui/CarlaBridgeFormat.hpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Bridge UI * Carla Bridge UI
* Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -77,6 +77,7 @@ protected:
uint32_t bgColor; uint32_t bgColor;
uint32_t fgColor; uint32_t fgColor;
float uiScale; float uiScale;
bool isStandalone;
bool useTheme; bool useTheme;
bool useThemeColors; bool useThemeColors;
const char* windowTitle; const char* windowTitle;
@@ -111,6 +112,11 @@ public:
* Options. * Options.
*/ */
struct Options { struct Options {
/*!
* UI is standalone, not controlled by another application.
*/
bool isStandalone;

/*! /*!
* UI is resizable by the user. * UI is resizable by the user.
* The UI can still sometimes resize itself internally if this is false. * The UI can still sometimes resize itself internally if this is false.
@@ -142,7 +148,8 @@ public:
* Constructor for default options. * Constructor for default options.
*/ */
Options() noexcept Options() noexcept
: isResizable(true),
: isStandalone(true),
isResizable(true),
useTheme(true), useTheme(true),
useThemeColors(true), useThemeColors(true),
windowTitle("TestUI"), windowTitle("TestUI"),


+ 1
- 0
source/bridges-ui/CarlaBridgeFormatLV2.cpp View File

@@ -826,6 +826,7 @@ public:
// ------------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------------
// other // other


fUiOptions.isStandalone = opts.isStandalone;
fUiOptions.useTheme = opts.useTheme; fUiOptions.useTheme = opts.useTheme;
fUiOptions.useThemeColors = opts.useThemeColors; fUiOptions.useThemeColors = opts.useThemeColors;
} }


+ 4
- 4
source/bridges-ui/CarlaBridgeToolkitNative.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Bridge UI * Carla Bridge UI
* Copyright (C) 2014-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2014-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -57,12 +57,12 @@ public:
const CarlaBridgeFormat::Options& options(fPlugin->getOptions()); const CarlaBridgeFormat::Options& options(fPlugin->getOptions());


#if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA) #if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA)
fHostUI = CarlaPluginUI::newCocoa(this, 0, options.isResizable);
fHostUI = CarlaPluginUI::newCocoa(this, 0, options.isStandalone, options.isResizable);
#elif defined(CARLA_OS_WIN) && defined(BRIDGE_HWND) #elif defined(CARLA_OS_WIN) && defined(BRIDGE_HWND)
fHostUI = CarlaPluginUI::newWindows(this, 0, options.isResizable);
fHostUI = CarlaPluginUI::newWindows(this, 0, options.isStandalone, options.isResizable);
#elif defined(HAVE_X11) && defined(BRIDGE_X11) #elif defined(HAVE_X11) && defined(BRIDGE_X11)
XInitThreads(); XInitThreads();
fHostUI = CarlaPluginUI::newX11(this, 0, options.isResizable, true /* assumes LV2 */);
fHostUI = CarlaPluginUI::newX11(this, 0, options.isStandalone, options.isResizable, true);
#endif #endif
CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr, false); CARLA_SAFE_ASSERT_RETURN(fHostUI != nullptr, false);




+ 4
- 1
source/frontend/carla_backend.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Carla Backend code # Carla Backend code
# Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as # modify it under the terms of the GNU General Public License as
@@ -1045,6 +1045,9 @@ ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33
# @note MUST include at least one "." (dot). # @note MUST include at least one "." (dot).
ENGINE_OPTION_CLIENT_NAME_PREFIX = 34 ENGINE_OPTION_CLIENT_NAME_PREFIX = 34


# Treat loaded plugins as standalone (that is, there is no host UI to manage them)
ENGINE_OPTION_PLUGINS_ARE_STANDALONE = 35

# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# Engine Process Mode # Engine Process Mode
# Engine process mode. # Engine process mode.


+ 7
- 1
source/utils/CarlaBackendUtils.hpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Backend utils * Carla Backend utils
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -360,12 +360,14 @@ const char* EngineOption2Str(const EngineOption option) noexcept
return "ENGINE_OPTION_AUDIO_DRIVER"; return "ENGINE_OPTION_AUDIO_DRIVER";
case ENGINE_OPTION_AUDIO_DEVICE: case ENGINE_OPTION_AUDIO_DEVICE:
return "ENGINE_OPTION_AUDIO_DEVICE"; return "ENGINE_OPTION_AUDIO_DEVICE";
#ifndef BUILD_BRIDGE
case ENGINE_OPTION_OSC_ENABLED: case ENGINE_OPTION_OSC_ENABLED:
return "ENGINE_OPTION_OSC_ENABLED"; return "ENGINE_OPTION_OSC_ENABLED";
case ENGINE_OPTION_OSC_PORT_UDP: case ENGINE_OPTION_OSC_PORT_UDP:
return "ENGINE_OPTION_OSC_PORT_UDP"; return "ENGINE_OPTION_OSC_PORT_UDP";
case ENGINE_OPTION_OSC_PORT_TCP: case ENGINE_OPTION_OSC_PORT_TCP:
return "ENGINE_OPTION_OSC_PORT_TCP"; return "ENGINE_OPTION_OSC_PORT_TCP";
#endif
case ENGINE_OPTION_FILE_PATH: case ENGINE_OPTION_FILE_PATH:
return "ENGINE_OPTION_FILE_PATH"; return "ENGINE_OPTION_FILE_PATH";
case ENGINE_OPTION_PLUGIN_PATH: case ENGINE_OPTION_PLUGIN_PATH:
@@ -398,10 +400,14 @@ const char* EngineOption2Str(const EngineOption option) noexcept
case ENGINE_OPTION_WINE_SERVER_RT_PRIO: case ENGINE_OPTION_WINE_SERVER_RT_PRIO:
return "ENGINE_OPTION_WINE_SERVER_RT_PRIO"; return "ENGINE_OPTION_WINE_SERVER_RT_PRIO";
#endif #endif
#ifndef BUILD_BRIDGE
case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT: case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT:
return "ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT"; return "ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT";
#endif
case ENGINE_OPTION_CLIENT_NAME_PREFIX: case ENGINE_OPTION_CLIENT_NAME_PREFIX:
return "ENGINE_OPTION_CLIENT_NAME_PREFIX"; return "ENGINE_OPTION_CLIENT_NAME_PREFIX";
case ENGINE_OPTION_PLUGINS_ARE_STANDALONE:
return "ENGINE_OPTION_PLUGINS_ARE_STANDALONE";
} }


carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option); carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option);


+ 19
- 12
source/utils/CarlaPluginUI.cpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Plugin UI * Carla Plugin UI
* Copyright (C) 2014-2020 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2014-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -59,8 +59,8 @@ class X11PluginUI : public CarlaPluginUI
{ {
public: public:
X11PluginUI(Callback* const cb, const uintptr_t parentId, X11PluginUI(Callback* const cb, const uintptr_t parentId,
const bool isResizable, const bool canMonitorChildren) noexcept
: CarlaPluginUI(cb, isResizable),
const bool isStandalone, const bool isResizable, const bool canMonitorChildren) noexcept
: CarlaPluginUI(cb, isStandalone, isResizable),
fDisplay(nullptr), fDisplay(nullptr),
fHostWindow(0), fHostWindow(0),
fChildWindow(0), fChildWindow(0),
@@ -571,8 +571,8 @@ private:
class CocoaPluginUI : public CarlaPluginUI class CocoaPluginUI : public CarlaPluginUI
{ {
public: public:
CocoaPluginUI(Callback* const callback, const uintptr_t parentId, const bool isResizable) noexcept
: CarlaPluginUI(callback, isResizable),
CocoaPluginUI(Callback* const callback, const uintptr_t parentId, const bool isStandalone, const bool isResizable) noexcept
: CarlaPluginUI(callback, isStandalone, isResizable),
fView(nullptr), fView(nullptr),
fParentWindow(nullptr), fParentWindow(nullptr),
fWindow(nullptr) fWindow(nullptr)
@@ -792,8 +792,8 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
class WindowsPluginUI : public CarlaPluginUI class WindowsPluginUI : public CarlaPluginUI
{ {
public: public:
WindowsPluginUI(Callback* const cb, const uintptr_t parentId, const bool isResizable) noexcept
: CarlaPluginUI(cb, isResizable),
WindowsPluginUI(Callback* const cb, const uintptr_t parentId, const bool isStandalone, const bool isResizable) noexcept
: CarlaPluginUI(cb, isStandalone, isResizable),
fWindow(nullptr), fWindow(nullptr),
fChildWindow(nullptr), fChildWindow(nullptr),
fParentWindow(nullptr), fParentWindow(nullptr),
@@ -1392,24 +1392,31 @@ bool CarlaPluginUI::tryTransientWinIdMatch(const uintptr_t pid, const char* cons
#ifdef HAVE_X11 #ifdef HAVE_X11
CarlaPluginUI* CarlaPluginUI::newX11(Callback* const cb, CarlaPluginUI* CarlaPluginUI::newX11(Callback* const cb,
const uintptr_t parentId, const uintptr_t parentId,
const bool isStandalone,
const bool isResizable, const bool isResizable,
const bool isLV2) const bool isLV2)
{ {
return new X11PluginUI(cb, parentId, isResizable, isLV2);
return new X11PluginUI(cb, parentId, isStandalone, isResizable, isLV2);
} }
#endif #endif


#ifdef CARLA_OS_MAC #ifdef CARLA_OS_MAC
CarlaPluginUI* CarlaPluginUI::newCocoa(Callback* const cb, const uintptr_t parentId, const bool isResizable)
CarlaPluginUI* CarlaPluginUI::newCocoa(Callback* const cb,
const uintptr_t parentId,
const bool isStandalone,
const bool isResizable)
{ {
return new CocoaPluginUI(cb, parentId, isResizable);
return new CocoaPluginUI(cb, parentId, isStandalone, isResizable);
} }
#endif #endif


#ifdef CARLA_OS_WIN #ifdef CARLA_OS_WIN
CarlaPluginUI* CarlaPluginUI::newWindows(Callback* const cb, const uintptr_t parentId, const bool isResizable)
CarlaPluginUI* CarlaPluginUI::newWindows(Callback* const cb,
const uintptr_t parentId,
const bool isStandalone,
const bool isResizable)
{ {
return new WindowsPluginUI(cb, parentId, isResizable);
return new WindowsPluginUI(cb, parentId, isStandalone, isResizable);
} }
#endif #endif




+ 9
- 5
source/utils/CarlaPluginUI.hpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Plugin UI * Carla Plugin UI
* Copyright (C) 2014-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2014-2021 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
@@ -51,22 +51,26 @@ public:
#endif #endif


#ifdef CARLA_OS_MAC #ifdef CARLA_OS_MAC
static CarlaPluginUI* newCocoa(Callback*, uintptr_t, bool isResizable);
static CarlaPluginUI* newCocoa(Callback*, uintptr_t, bool isStandalone, bool isResizable);
#endif #endif
#ifdef CARLA_OS_WIN #ifdef CARLA_OS_WIN
static CarlaPluginUI* newWindows(Callback*, uintptr_t, bool isResizable);
static CarlaPluginUI* newWindows(Callback*, uintptr_t, bool isStandalone, bool isResizable);
#endif #endif
#ifdef HAVE_X11 #ifdef HAVE_X11
static CarlaPluginUI* newX11(Callback*, uintptr_t, bool isResizable, bool canMonitorChildren);
static CarlaPluginUI* newX11(Callback*, uintptr_t, bool isStandalone, bool isResizable, bool canMonitorChildren);
#endif #endif


protected: protected:
bool fIsIdling; bool fIsIdling;
bool fIsStandalone;
bool fIsResizable; bool fIsResizable;
Callback* fCallback; Callback* fCallback;


CarlaPluginUI(Callback* const cb, const bool isResizable) noexcept
CarlaPluginUI(Callback* const cb,
const bool isStandalone,
const bool isResizable) noexcept
: fIsIdling(false), : fIsIdling(false),
fIsStandalone(isStandalone),
fIsResizable(isResizable), fIsResizable(isResizable),
fCallback(cb) {} fCallback(cb) {}




+ 10
- 2
source/utils/JucePluginWindow.hpp View File

@@ -42,8 +42,9 @@ namespace juce {
class JucePluginWindow : public DialogWindow class JucePluginWindow : public DialogWindow
{ {
public: public:
JucePluginWindow(const uintptr_t parentId)
JucePluginWindow(const uintptr_t parentId, const bool isStandalone)
: DialogWindow("JucePluginWindow", Colour(50, 50, 200), true, false), : DialogWindow("JucePluginWindow", Colour(50, 50, 200), true, false),
fIsStandalone(isStandalone),
fClosed(false), fClosed(false),
fShown(false), fShown(false),
fTransientId(parentId) fTransientId(parentId)
@@ -106,7 +107,13 @@ protected:


int getDesktopWindowStyleFlags() const override int getDesktopWindowStyleFlags() const override
{ {
return ComponentPeer::windowHasDropShadow | ComponentPeer::windowHasTitleBar | ComponentPeer::windowHasCloseButton;
int flags = 0;
flags |= ComponentPeer::windowHasCloseButton;
flags |= ComponentPeer::windowHasDropShadow;
flags |= ComponentPeer::windowHasTitleBar;
if (fIsStandalone)
flags |= ComponentPeer::windowAppearsOnTaskbar;
return flags;
} }


#ifndef CARLA_OS_LINUX #ifndef CARLA_OS_LINUX
@@ -123,6 +130,7 @@ protected:
#endif #endif


private: private:
const bool fIsStandalone;
volatile bool fClosed; volatile bool fClosed;
bool fShown; bool fShown;
const uintptr_t fTransientId; const uintptr_t fTransientId;


Loading…
Cancel
Save