| @@ -28,7 +28,7 @@ all: BIN RES UI WIDGETS | |||
| # -------------------------------------------------------------- | |||
| # Binaries (native) | |||
| BIN: libs backend bridges discovery plugin theme | |||
| BIN: libs backend bridges-plugin bridges-ui discovery plugin theme | |||
| # -------------------------------------------------------------- | |||
| @@ -105,13 +105,18 @@ bin/libcarla_standalone2$(LIB_EXT): libs .FORCE | |||
| # -------------------------------------------------------------- | |||
| bridges: bin/carla-bridge-native$(APP_EXT) | |||
| bridges-plugin: bin/carla-bridge-native$(APP_EXT) | |||
| bin/carla-bridge-native$(APP_EXT): libs .FORCE | |||
| $(MAKE) -C source/bridges-plugin | |||
| # -------------------------------------------------------------- | |||
| bridges-ui: libs .FORCE | |||
| $(MAKE) -C source/bridges-ui | |||
| # -------------------------------------------------------------- | |||
| discovery: bin/carla-discovery-native$(APP_EXT) | |||
| bin/carla-discovery-native$(APP_EXT): libs .FORCE | |||
| @@ -124,7 +129,7 @@ plugin: bin/carla-native.lv2/manifest.ttl | |||
| bin/carla-native.lv2/carla-native$(LIB_EXT): backend .FORCE | |||
| $(MAKE) -C source/plugin ../../$@ | |||
| bin/carla-native.lv2/manifest.ttl: bin/carla-native-lv2-export$(APP_EXT) bridges discovery .FORCE | |||
| bin/carla-native.lv2/manifest.ttl: bin/carla-native-lv2-export$(APP_EXT) bridges-plugin discovery .FORCE | |||
| cd bin && ./carla-native-lv2-export$(APP_EXT); cd .. | |||
| cd bin/carla-native.lv2 && $(LINK) ../*bridge-* ../carla-discovery-* .; cd .. | |||
| @@ -1385,7 +1385,7 @@ void CarlaPlugin::idle() | |||
| CarlaString uiTitle(pData->name); | |||
| uiTitle += " (GUI)"; | |||
| if (CarlaPluginUi::tryTransientWinIdMatch(pData->osc.data.target != nullptr ? pData->osc.thread.getPid() : 0, uiTitle, pData->engine->getOptions().frontendWinId)) | |||
| if (CarlaPluginUI::tryTransientWinIdMatch(pData->osc.data.target != nullptr ? pData->osc.thread.getPid() : 0, uiTitle, pData->engine->getOptions().frontendWinId)) | |||
| pData->transientTryCounter = 0; | |||
| } | |||
| @@ -379,7 +379,7 @@ struct Lv2PluginOptions { | |||
| // ----------------------------------------------------- | |||
| class Lv2Plugin : public CarlaPlugin, | |||
| CarlaPluginUi::CloseCallback | |||
| CarlaPluginUI::CloseCallback | |||
| { | |||
| public: | |||
| Lv2Plugin(CarlaEngine* const engine, const uint id) | |||
| @@ -1175,7 +1175,7 @@ public: | |||
| case LV2_UI_COCOA: | |||
| # ifdef CARLA_OS_MAC | |||
| fUi.window = CarlaPluginUi::newCocoa(this, frontendWinId); | |||
| fUi.window = CarlaPluginUI::newCocoa(this, frontendWinId); | |||
| # else | |||
| msg = "UI is for MacOS only"; | |||
| # endif | |||
| @@ -1183,7 +1183,7 @@ public: | |||
| case LV2_UI_WINDOWS: | |||
| # ifdef CARLA_OS_WIN | |||
| fUi.window = CarlaPluginUi::newWindows(this, frontendWinId); | |||
| fUi.window = CarlaPluginUI::newWindows(this, frontendWinId); | |||
| # else | |||
| msg = "UI is for Windows only"; | |||
| # endif | |||
| @@ -1191,7 +1191,7 @@ public: | |||
| case LV2_UI_X11: | |||
| # ifdef HAVE_X11 | |||
| fUi.window = CarlaPluginUi::newX11(this, frontendWinId); | |||
| fUi.window = CarlaPluginUI::newX11(this, frontendWinId); | |||
| # else | |||
| msg = "UI is only for systems with X11"; | |||
| # endif | |||
| @@ -3879,38 +3879,32 @@ public: | |||
| if (bridgeBinary.isEmpty()) | |||
| return nullptr; | |||
| #ifdef CARLA_OS_LINUX | |||
| // test for local build | |||
| if (bridgeBinary.endsWith("/source/backend/")) | |||
| bridgeBinary += "../bridges/"; | |||
| #endif | |||
| switch (type) | |||
| { | |||
| case LV2_UI_GTK2: | |||
| bridgeBinary += "carla-bridge-lv2-gtk2"; | |||
| bridgeBinary += OS_SEP_STR "carla-bridge-lv2-gtk2"; | |||
| break; | |||
| case LV2_UI_GTK3: | |||
| bridgeBinary += "carla-bridge-lv2-gtk3"; | |||
| bridgeBinary += OS_SEP_STR "carla-bridge-lv2-gtk3"; | |||
| break; | |||
| case LV2_UI_QT4: | |||
| bridgeBinary += "carla-bridge-lv2-qt4"; | |||
| bridgeBinary += OS_SEP_STR "carla-bridge-lv2-qt4"; | |||
| break; | |||
| case LV2_UI_QT5: | |||
| bridgeBinary += "carla-bridge-lv2-qt5"; | |||
| bridgeBinary += OS_SEP_STR "carla-bridge-lv2-qt5"; | |||
| break; | |||
| case LV2_UI_COCOA: | |||
| bridgeBinary += "carla-bridge-lv2-cocoa"; | |||
| bridgeBinary += OS_SEP_STR "carla-bridge-lv2-cocoa"; | |||
| break; | |||
| case LV2_UI_WINDOWS: | |||
| bridgeBinary += "carla-bridge-lv2-windows"; | |||
| bridgeBinary += OS_SEP_STR "carla-bridge-lv2-windows"; | |||
| break; | |||
| case LV2_UI_X11: | |||
| bridgeBinary += "carla-bridge-lv2-x11"; | |||
| bridgeBinary += OS_SEP_STR "carla-bridge-lv2-x11"; | |||
| break; | |||
| case LV2_UI_EXTERNAL: | |||
| case LV2_UI_OLD_EXTERNAL: | |||
| bridgeBinary += "carla-bridge-lv2-external"; | |||
| bridgeBinary += OS_SEP_STR "carla-bridge-lv2-external"; | |||
| break; | |||
| default: | |||
| return nullptr; | |||
| @@ -4235,10 +4229,10 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| void handleExternalUiClosed() | |||
| void handleExternalUIClosed() | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUi.type == UI::TYPE_EXTERNAL,); | |||
| carla_debug("Lv2Plugin::handleExternalUiClosed()"); | |||
| carla_debug("Lv2Plugin::handleExternalUIClosed()"); | |||
| if (fUi.handle != nullptr && fUi.descriptor != nullptr && fUi.descriptor->cleanup != nullptr) | |||
| fUi.descriptor->cleanup(fUi.handle); | |||
| @@ -4248,11 +4242,11 @@ public: | |||
| pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
| } | |||
| void handlePluginUiClosed() override | |||
| void handlePluginUIClosed() override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUi.type == UI::TYPE_EMBED,); | |||
| CARLA_SAFE_ASSERT_RETURN(fUi.window != nullptr,); | |||
| carla_debug("Lv2Plugin::handlePluginUiClosed()"); | |||
| carla_debug("Lv2Plugin::handlePluginUIClosed()"); | |||
| fUi.window->hide(); | |||
| @@ -4266,10 +4260,10 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| uint32_t handleUiPortMap(const char* const symbol) const noexcept | |||
| uint32_t handleUIPortMap(const char* const symbol) const noexcept | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(symbol != nullptr && symbol[0] != '\0', LV2UI_INVALID_PORT_INDEX); | |||
| carla_debug("Lv2Plugin::handleUiPortMap(\"%s\")", symbol); | |||
| carla_debug("Lv2Plugin::handleUIPortMap(\"%s\")", symbol); | |||
| for (uint32_t i=0; i < fRdfDescriptor->PortCount; ++i) | |||
| { | |||
| @@ -4280,23 +4274,23 @@ public: | |||
| return LV2UI_INVALID_PORT_INDEX; | |||
| } | |||
| int handleUiResize(const int width, const int height) | |||
| int handleUIResize(const int width, const int height) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUi.window != nullptr, 1); | |||
| CARLA_SAFE_ASSERT_RETURN(width > 0, 1); | |||
| CARLA_SAFE_ASSERT_RETURN(height > 0, 1); | |||
| carla_debug("Lv2Plugin::handleUiResize(%i, %i)", width, height); | |||
| carla_debug("Lv2Plugin::handleUIResize(%i, %i)", width, height); | |||
| fUi.window->setSize(static_cast<uint>(width), static_cast<uint>(height), true); | |||
| return 0; | |||
| } | |||
| void handleUiWrite(const uint32_t rindex, const uint32_t bufferSize, const uint32_t format, const void* const buffer) | |||
| void handleUIWrite(const uint32_t rindex, const uint32_t bufferSize, const uint32_t format, const void* const buffer) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(buffer != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(bufferSize > 0,); | |||
| carla_debug("Lv2Plugin::handleUiWrite(%i, %i, %i, %p)", rindex, bufferSize, format, buffer); | |||
| carla_debug("Lv2Plugin::handleUIWrite(%i, %i, %i, %p)", rindex, bufferSize, format, buffer); | |||
| uint32_t index = LV2UI_INVALID_PORT_INDEX; | |||
| @@ -4350,7 +4344,7 @@ public: | |||
| } break; | |||
| default: | |||
| carla_stdout("Lv2Plugin::handleUiWrite(%i, %i, %i:\"%s\", %p) - unknown format", rindex, bufferSize, format, carla_lv2_urid_unmap(this, format), buffer); | |||
| carla_stdout("Lv2Plugin::handleUIWrite(%i, %i, %i:\"%s\", %p) - unknown format", rindex, bufferSize, format, carla_lv2_urid_unmap(this, format), buffer); | |||
| break; | |||
| } | |||
| } | |||
| @@ -5282,7 +5276,7 @@ private: | |||
| const LV2UI_Descriptor* descriptor; | |||
| const LV2_RDF_UI* rdfDescriptor; | |||
| CarlaPluginUi* window; | |||
| CarlaPluginUI* window; | |||
| UI() | |||
| : type(TYPE_NULL), | |||
| @@ -5724,7 +5718,7 @@ private: | |||
| CARLA_SAFE_ASSERT_RETURN(controller != nullptr,); | |||
| carla_debug("carla_lv2_external_ui_closed(%p)", controller); | |||
| ((Lv2Plugin*)controller)->handleExternalUiClosed(); | |||
| ((Lv2Plugin*)controller)->handleExternalUIClosed(); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -5735,7 +5729,7 @@ private: | |||
| CARLA_SAFE_ASSERT_RETURN(handle != nullptr, LV2UI_INVALID_PORT_INDEX); | |||
| carla_debug("carla_lv2_ui_port_map(%p, \"%s\")", handle, symbol); | |||
| return ((Lv2Plugin*)handle)->handleUiPortMap(symbol); | |||
| return ((Lv2Plugin*)handle)->handleUIPortMap(symbol); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -5746,7 +5740,7 @@ private: | |||
| CARLA_SAFE_ASSERT_RETURN(handle != nullptr, 1); | |||
| carla_debug("carla_lv2_ui_resize(%p, %i, %i)", handle, width, height); | |||
| return ((Lv2Plugin*)handle)->handleUiResize(width, height); | |||
| return ((Lv2Plugin*)handle)->handleUIResize(width, height); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -5757,7 +5751,7 @@ private: | |||
| CARLA_SAFE_ASSERT_RETURN(controller != nullptr,); | |||
| carla_debug("carla_lv2_ui_write_function(%p, %i, %i, %i, %p)", controller, port_index, buffer_size, format, buffer); | |||
| ((Lv2Plugin*)controller)->handleUiWrite(port_index, buffer_size, format, buffer); | |||
| ((Lv2Plugin*)controller)->handleUIWrite(port_index, buffer_size, format, buffer); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -51,7 +51,7 @@ const uint PLUGIN_WANTS_MIDI_INPUT = 0x8000; | |||
| // ----------------------------------------------------- | |||
| class VstPlugin : public CarlaPlugin, | |||
| CarlaPluginUi::CloseCallback | |||
| CarlaPluginUI::CloseCallback | |||
| { | |||
| public: | |||
| VstPlugin(CarlaEngine* const engine, const uint id) | |||
| @@ -437,16 +437,16 @@ public: | |||
| #if defined(CARLA_OS_LINUX) | |||
| # ifdef HAVE_X11 | |||
| fUi.window = CarlaPluginUi::newX11(this, frontendWinId); | |||
| fUi.window = CarlaPluginUI::newX11(this, frontendWinId); | |||
| # else | |||
| msg = "UI is only for systems with X11"; | |||
| # endif | |||
| #elif defined(CARLA_OS_MAC) | |||
| # ifdef __LP64__ | |||
| fUi.window = CarlaPluginUi::newCocoa(this, frontendWinId); | |||
| fUi.window = CarlaPluginUI::newCocoa(this, frontendWinId); | |||
| # endif | |||
| #elif defined(CARLA_OS_WIN) | |||
| fUi.window = CarlaPluginUi::newWindows(this, frontendWinId); | |||
| fUi.window = CarlaPluginUI::newWindows(this, frontendWinId); | |||
| #else | |||
| msg = "Unknown UI type"; | |||
| #endif | |||
| @@ -1760,11 +1760,11 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| protected: | |||
| void handlePluginUiClosed() override | |||
| void handlePluginUIClosed() override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUi.type == UI::UI_EMBED || fUi.type == UI::UI_EXTERNAL,); | |||
| CARLA_SAFE_ASSERT_RETURN(fUi.window != nullptr,); | |||
| carla_debug("VstPlugin::handlePluginUiClosed()"); | |||
| carla_debug("VstPlugin::handlePluginUIClosed()"); | |||
| showCustomUI(false); | |||
| pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
| @@ -2041,7 +2041,7 @@ protected: | |||
| if (index == 0xedcd && value == 0 && ptr != nullptr && std::strcmp((const char*)ptr, "EditorClosed") == 0) | |||
| { | |||
| CARLA_SAFE_ASSERT_BREAK(fUi.type == UI::UI_EXTERNAL); | |||
| handlePluginUiClosed(); | |||
| handlePluginUIClosed(); | |||
| break; | |||
| } | |||
| // TODO - cockos extensions | |||
| @@ -2295,13 +2295,7 @@ public: | |||
| CarlaString bridgeBinary(pData->engine->getOptions().binaryDir); | |||
| #if defined(CARLA_OS_LINUX) | |||
| bridgeBinary += "carla-bridge-vst-x11"; | |||
| #elif defined(CARLA_OS_MAC) | |||
| bridgeBinary += "carla-bridge-vst-mac"; | |||
| #elif defined(CARLA_OS_WIN) | |||
| bridgeBinary += "carla-bridge-vst-hwnd.exe"; | |||
| #else | |||
| bridgeBinary.clear(); | |||
| bridgeBinary += OS_SEP_STR "carla-bridge-vst-x11"; | |||
| #endif | |||
| if (bridgeBinary.isNotEmpty() && File(bridgeBinary.buffer()).existsAsFile()) | |||
| @@ -2377,7 +2371,7 @@ private: | |||
| } type; | |||
| bool isVisible; // not used in OSC mode | |||
| CarlaPluginUi* window; | |||
| CarlaPluginUI* window; | |||
| UI() | |||
| : type(UI_NULL), | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * Carla Bridge Client | |||
| * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2011-2014 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 | |||
| @@ -213,6 +213,12 @@ void* CarlaBridgeClient::getContainerId() | |||
| return fUI.toolkit->getContainerId(); | |||
| } | |||
| void* CarlaBridgeClient::getContainerId2() | |||
| { | |||
| carla_debug("CarlaBridgeClient::getContainerId2()"); | |||
| return fUI.toolkit->getContainerId2(); | |||
| } | |||
| bool CarlaBridgeClient::uiLibOpen(const char* const filename) | |||
| { | |||
| CARLA_ASSERT(fUI.lib == nullptr); | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * Carla Bridge Client | |||
| * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2011-2014 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 | |||
| @@ -43,7 +43,6 @@ public: | |||
| virtual void* getWidget() const = 0; | |||
| virtual bool isResizable() const = 0; | |||
| virtual bool needsReparent() const = 0; | |||
| // --------------------------------------------------------------------- | |||
| // ui processing | |||
| @@ -91,6 +90,7 @@ protected: | |||
| // --------------------------------------------------------------------- | |||
| void* getContainerId(); | |||
| void* getContainerId2(); | |||
| bool uiLibOpen(const char* const filename); | |||
| bool uiLibClose(); | |||
| void* uiLibSymbol(const char* const symbol); | |||
| @@ -38,7 +38,8 @@ public: | |||
| virtual void hide() = 0; | |||
| virtual void resize(const int width, const int height) = 0; | |||
| virtual void* getContainerId() const { return nullptr; } | |||
| virtual void* getContainerId() const { return nullptr; } | |||
| virtual void* getContainerId2() const { return nullptr; } | |||
| static CarlaBridgeToolkit* createNew(CarlaBridgeClient* const client, const char* const uiTitle); | |||
| @@ -81,19 +81,19 @@ public: | |||
| gtk_container_add(GTK_CONTAINER(fWindow), widget); | |||
| gtk_window_set_resizable(GTK_WINDOW(fWindow), kClient->isResizable()); | |||
| gtk_window_set_title(GTK_WINDOW(fWindow), kUiTitle); | |||
| gtk_window_set_title(GTK_WINDOW(fWindow), kWindowTitle); | |||
| #if 0 | |||
| { | |||
| QSettings settings("falkTX", appName); | |||
| if (settings.contains(QString("%1/pos_x").arg(kUiTitle))) | |||
| if (settings.contains(QString("%1/pos_x").arg(kWindowTitle))) | |||
| { | |||
| gtk_window_get_position(GTK_WINDOW(fWindow), &fLastX, &fLastY); | |||
| bool hasX, hasY; | |||
| fLastX = settings.value(QString("%1/pos_x").arg(kUiTitle), fLastX).toInt(&hasX); | |||
| fLastY = settings.value(QString("%1/pos_y").arg(kUiTitle), fLastY).toInt(&hasY); | |||
| fLastX = settings.value(QString("%1/pos_x").arg(kWindowTitle), fLastX).toInt(&hasX); | |||
| fLastY = settings.value(QString("%1/pos_y").arg(kWindowTitle), fLastY).toInt(&hasY); | |||
| if (hasX && hasY) | |||
| gtk_window_move(GTK_WINDOW(fWindow), fLastX, fLastY); | |||
| @@ -103,8 +103,8 @@ public: | |||
| gtk_window_get_size(GTK_WINDOW(fWindow), &fLastWidth, &fLastHeight); | |||
| bool hasWidth, hasHeight; | |||
| fLastWidth = settings.value(QString("%1/width").arg(kUiTitle), fLastWidth).toInt(&hasWidth); | |||
| fLastHeight = settings.value(QString("%1/height").arg(kUiTitle), fLastHeight).toInt(&hasHeight); | |||
| fLastWidth = settings.value(QString("%1/width").arg(kWindowTitle), fLastWidth).toInt(&hasWidth); | |||
| fLastHeight = settings.value(QString("%1/height").arg(kWindowTitle), fLastHeight).toInt(&hasHeight); | |||
| if (hasWidth && hasHeight) | |||
| gtk_window_resize(GTK_WINDOW(fWindow), fLastWidth, fLastHeight); | |||
| @@ -194,10 +194,10 @@ protected: | |||
| #if 0 | |||
| QSettings settings("falkTX", appName); | |||
| settings.setValue(QString("%1/pos_x").arg(kUiTitle), fLastX); | |||
| settings.setValue(QString("%1/pos_y").arg(kUiTitle), fLastY); | |||
| settings.setValue(QString("%1/width").arg(kUiTitle), fLastWidth); | |||
| settings.setValue(QString("%1/height").arg(kUiTitle), fLastHeight); | |||
| settings.setValue(QString("%1/pos_x").arg(kWindowTitle), fLastX); | |||
| settings.setValue(QString("%1/pos_y").arg(kWindowTitle), fLastY); | |||
| settings.setValue(QString("%1/width").arg(kWindowTitle), fLastWidth); | |||
| settings.setValue(QString("%1/height").arg(kWindowTitle), fLastHeight); | |||
| #endif | |||
| } | |||
| @@ -24,10 +24,135 @@ CARLA_BRIDGE_START_NAMESPACE | |||
| // ------------------------------------------------------------------------- | |||
| class CarlaBridgeToolkitPlugin : public CarlaBridgeToolkit, | |||
| private CarlaPluginUI::CloseCallback | |||
| { | |||
| public: | |||
| CarlaBridgeToolkitPlugin(CarlaBridgeClient* const client, const char* const uiTitle) | |||
| : CarlaBridgeToolkit(client, uiTitle), | |||
| fUI(nullptr), | |||
| fIdling(false) | |||
| { | |||
| carla_debug("CarlaBridgeToolkitPlugin::CarlaBridgeToolkitPlugin(%p, \"%s\")", client, uiTitle); | |||
| } | |||
| ~CarlaBridgeToolkitPlugin() override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUI == nullptr,); | |||
| carla_debug("CarlaBridgeToolkitPlugin::~CarlaBridgeToolkitPlugin()"); | |||
| } | |||
| void init() override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUI == nullptr,); | |||
| carla_debug("CarlaBridgeToolkitPlugin::init()"); | |||
| #if defined(CARLA_OS_MAC) && defined(BRIDGE_COCOA) | |||
| fUI = CarlaPluginUI::newCocoa(this, 0); | |||
| #elif defined(CARLA_OS_WIN) && defined(BRIDGE_HWND) | |||
| fUI = CarlaPluginUI::newWindows(this, 0); | |||
| #elif defined(HAVE_X11) && defined(BRIDGE_X11) | |||
| fUI = CarlaPluginUI::newX11(this, 0); | |||
| #endif | |||
| CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,); | |||
| fUI->setTitle(kWindowTitle); | |||
| } | |||
| void exec(const bool showUI) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(kClient != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,); | |||
| carla_debug("CarlaBridgeToolkitPlugin::exec(%s)", bool2str(showUI)); | |||
| if (showUI) | |||
| fUI->show(); | |||
| fIdling = true; | |||
| for (; fIdling;) | |||
| { | |||
| fUI->idle(); | |||
| kClient->uiIdle(); | |||
| if (! kClient->oscIdle()) | |||
| break; | |||
| carla_msleep(20); | |||
| } | |||
| } | |||
| void quit() override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,); | |||
| carla_debug("CarlaBridgeToolkitPlugin::quit()"); | |||
| fIdling = false; | |||
| delete fUI; | |||
| fUI = nullptr; | |||
| } | |||
| void show() override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,); | |||
| carla_debug("CarlaBridgeToolkitPlugin::show()"); | |||
| fUI->show(); | |||
| } | |||
| void hide() override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,); | |||
| carla_debug("CarlaBridgeToolkitPlugin::hide()"); | |||
| fUI->hide(); | |||
| } | |||
| void resize(int width, int height) override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUI != nullptr,); | |||
| carla_debug("CarlaBridgeToolkitPlugin::resize(%i, %i)", width, height); | |||
| fUI->setSize(width, height, false); | |||
| } | |||
| void* getContainerId() const override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUI != nullptr, nullptr); | |||
| return fUI->getPtr(); | |||
| } | |||
| #ifdef HAVE_X11 | |||
| void* getContainerId2() const override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fUI != nullptr, nullptr); | |||
| return fUI->getDisplay(); | |||
| } | |||
| #endif | |||
| // --------------------------------------------------------------------- | |||
| protected: | |||
| void handlePluginUIClosed() override | |||
| { | |||
| fIdling = false; | |||
| } | |||
| // --------------------------------------------------------------------- | |||
| private: | |||
| CarlaPluginUI* fUI; | |||
| bool fIdling; | |||
| }; | |||
| // ------------------------------------------------------------------------- | |||
| CarlaBridgeToolkit* CarlaBridgeToolkit::createNew(CarlaBridgeClient* const client, const char* const uiTitle) | |||
| { | |||
| return nullptr; | |||
| (void)client; (void)uiTitle; | |||
| return new CarlaBridgeToolkitPlugin(client, uiTitle); | |||
| } | |||
| // ------------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * Carla Bridge Toolkit, Qt version | |||
| * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2011-2014 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 | |||
| @@ -470,14 +470,13 @@ public: | |||
| void uiClose() override | |||
| { | |||
| CarlaBridgeClient::uiClose(); | |||
| if (fHandle != nullptr && fDescriptor != nullptr && fDescriptor->cleanup != nullptr) | |||
| { | |||
| fDescriptor->cleanup(fHandle); | |||
| fHandle = nullptr; | |||
| } | |||
| CarlaBridgeClient::uiClose(); | |||
| uiLibClose(); | |||
| } | |||
| @@ -494,15 +493,6 @@ public: | |||
| return fIsResizable; | |||
| } | |||
| bool needsReparent() const override | |||
| { | |||
| #if defined(BRIDGE_COCOA) || defined(BRIDGE_HWND) || defined(BRIDGE_X11) | |||
| return true; | |||
| #else | |||
| return false; | |||
| #endif | |||
| } | |||
| // --------------------------------------------------------------------- | |||
| // ui processing | |||
| @@ -1154,14 +1144,14 @@ private: | |||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaLv2Client) | |||
| }; | |||
| #define lv2ClientPtr ((CarlaLv2Client*)fClient) | |||
| #define lv2ClientPtr ((CarlaLv2Client*)kClient) | |||
| int CarlaBridgeOsc::handleMsgLv2UiAtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| int CarlaBridgeOsc::handleMsgLv2AtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| { | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "is"); | |||
| carla_debug("CarlaBridgeOsc::handleMsgLv2AtomTransfer()"); | |||
| if (fClient == nullptr) | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| const int32_t portIndex = argv[0]->i; | |||
| @@ -1178,12 +1168,12 @@ int CarlaBridgeOsc::handleMsgLv2UiAtomTransfer(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| return 0; | |||
| } | |||
| int CarlaBridgeOsc::handleMsgLv2UiUridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| int CarlaBridgeOsc::handleMsgLv2UridMap(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||
| { | |||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "is"); | |||
| carla_debug("CarlaBridgeOsc::handleMsgLv2UridMap()"); | |||
| if (fClient == nullptr) | |||
| if (kClient == nullptr) | |||
| return 1; | |||
| const int32_t urid = argv[0]->i; | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * Carla Bridge UI, VST version | |||
| * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2011-2014 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 | |||
| @@ -20,13 +20,6 @@ | |||
| #include "CarlaVstUtils.hpp" | |||
| #include "CarlaMIDI.h" | |||
| #include <QtCore/QObject> // FIXME | |||
| #include <QtCore/QTimerEvent> | |||
| #if defined(Q_WS_X11) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) | |||
| # include <QtGui/QX11Info> | |||
| #endif | |||
| CARLA_BRIDGE_START_NAMESPACE | |||
| // ------------------------------------------------------------------------- | |||
| @@ -35,17 +28,13 @@ CARLA_BRIDGE_START_NAMESPACE | |||
| uint32_t bufferSize = 512; | |||
| double sampleRate = 44100.0; | |||
| class CarlaVstClient : public QObject, | |||
| public CarlaBridgeClient | |||
| class CarlaVstClient : public CarlaBridgeClient | |||
| { | |||
| public: | |||
| CarlaVstClient(const char* const uiTitle) | |||
| : QObject(nullptr), | |||
| CarlaBridgeClient(uiTitle) | |||
| : CarlaBridgeClient(uiTitle) | |||
| { | |||
| effect = nullptr; | |||
| idleTimer = 0; | |||
| needIdle = false; | |||
| // make client valid | |||
| @@ -108,9 +97,9 @@ public: | |||
| effect->resvd1 = ToVstPtr(this); | |||
| #endif | |||
| int32_t value = 0; | |||
| #if defined(Q_WS_X11) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) | |||
| value = (int64_t)QX11Info::display(); | |||
| intptr_t value = 0; | |||
| #if defined(HAVE_X11) && defined(BRIDGE_X11) | |||
| value = (intptr_t)getContainerId2(); | |||
| #endif | |||
| effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f); | |||
| @@ -145,20 +134,18 @@ public: | |||
| toolkitResize(width, height); | |||
| } | |||
| idleTimer = startTimer(50); | |||
| return true; | |||
| } | |||
| void uiIdle() override | |||
| { | |||
| // TODO | |||
| if (needIdle) | |||
| effect->dispatcher(effect, effIdle, 0, 0, nullptr, 0.0f); | |||
| effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | |||
| } | |||
| void uiClose() override | |||
| { | |||
| CarlaBridgeClient::uiClose(); | |||
| if (effect != nullptr) | |||
| { | |||
| effect->dispatcher(effect, effEditClose, 0, 0, nullptr, 0.0f); | |||
| @@ -166,6 +153,7 @@ public: | |||
| effect = nullptr; | |||
| } | |||
| CarlaBridgeClient::uiClose(); | |||
| uiLibClose(); | |||
| } | |||
| @@ -182,11 +170,6 @@ public: | |||
| return false; | |||
| } | |||
| bool needsReparent() const override | |||
| { | |||
| return true; | |||
| } | |||
| // --------------------------------------------------------------------- | |||
| // ui processing | |||
| @@ -241,7 +224,7 @@ public: | |||
| intptr_t handleAudioMasterGetTime() | |||
| { | |||
| memset(&vstTimeInfo, 0, sizeof(VstTimeInfo_R)); | |||
| memset(&vstTimeInfo, 0, sizeof(VstTimeInfo)); | |||
| vstTimeInfo.sampleRate = sampleRate; | |||
| @@ -420,8 +403,8 @@ public: | |||
| break; | |||
| case audioMasterGetTime: | |||
| static VstTimeInfo_R timeInfo; | |||
| memset(&timeInfo, 0, sizeof(VstTimeInfo_R)); | |||
| static VstTimeInfo timeInfo; | |||
| memset(&timeInfo, 0, sizeof(VstTimeInfo)); | |||
| timeInfo.sampleRate = sampleRate; | |||
| // Tempo | |||
| @@ -507,27 +490,12 @@ public: | |||
| return ret; | |||
| } | |||
| protected: | |||
| void timerEvent(QTimerEvent* const event) | |||
| { | |||
| if (event->timerId() == idleTimer && effect) | |||
| { | |||
| if (needIdle) | |||
| effect->dispatcher(effect, effIdle, 0, 0, nullptr, 0.0f); | |||
| effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | |||
| } | |||
| QObject::timerEvent(event); | |||
| } | |||
| private: | |||
| int unique1; | |||
| AEffect* effect; | |||
| VstTimeInfo_R vstTimeInfo; | |||
| VstTimeInfo vstTimeInfo; | |||
| int idleTimer; | |||
| bool needIdle; | |||
| static CarlaVstClient* lastVstPlugin; | |||
| @@ -19,8 +19,8 @@ ifeq ($(CARLA_VESTIGE_HEADER),true) | |||
| BUILD_VST_FLAGS += -DVESTIGE_HEADER | |||
| endif | |||
| LINK_FLAGS += $(LIBLO_LIBS) | |||
| LINK_FLAGS += $(JUCE_CORE_LIBS) | |||
| LINK_FLAGS += $(LIBLO_LIBS) | |||
| # -------------------------------------------------------------- | |||
| @@ -36,8 +36,8 @@ LINK_LV2_QT4_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs QtCore QtGui) | |||
| BUILD_LV2_QT5_FLAGS = $(BUILD_LV2_FLAGS) -DBRIDGE_QT5 -DBRIDGE_LV2_QT5 $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | |||
| LINK_LV2_QT5_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets) -ldl | |||
| BUILD_LV2_X11_FLAGS = $(BUILD_LV2_FLAGS) -DBRIDGE_X11 -DBRIDGE_LV2_X11 | |||
| LINK_LV2_X11_FLAGS = $(LINK_FLAGS) -ldl | |||
| BUILD_LV2_X11_FLAGS = $(BUILD_LV2_FLAGS) -DBRIDGE_X11 -DBRIDGE_LV2_X11 $(X11_FLAGS) | |||
| LINK_LV2_X11_FLAGS = $(LINK_FLAGS) $(X11_LIBS) -ldl | |||
| BUILD_LV2_COCOA_FLAGS = $(BUILD_LV2_FLAGS) -DBRIDGE_COCOA -DBRIDGE_LV2_COCOA | |||
| LINK_LV2_COCOA_FLAGS = $(LINK_FLAGS) -ldl | |||
| @@ -45,25 +45,25 @@ LINK_LV2_COCOA_FLAGS = $(LINK_FLAGS) -ldl | |||
| BUILD_LV2_WINDOWS_FLAGS = $(BUILD_LV2_FLAGS) -DBRIDGE_HWND -DBRIDGE_LV2_HWND | |||
| LINK_LV2_WINDOWS_FLAGS = $(LINK_FLAGS) -static -mwindows | |||
| BUILD_VST_X11_FLAGS = $(BUILD_VST_FLAGS) -DBRIDGE_X11 -DBRIDGE_VST_X11 | |||
| LINK_VST_X11_FLAGS = $(LINK_FLAGS) -ldl | |||
| BUILD_VST_X11_FLAGS = $(BUILD_VST_FLAGS) -DBRIDGE_X11 -DBRIDGE_VST_X11 $(X11_FLAGS) | |||
| LINK_VST_X11_FLAGS = $(LINK_FLAGS) $(X11_LIBS) -ldl | |||
| # -------------------------------------------------------------- | |||
| ifeq ($(HAVE_GTK2),true) | |||
| TARGETS += ui_lv2-gtk2 | |||
| # TARGETS += ui_lv2-gtk2 | |||
| endif | |||
| ifeq ($(HAVE_GTK3),true) | |||
| TARGETS += ui_lv2-gtk3 | |||
| # TARGETS += ui_lv2-gtk3 | |||
| endif | |||
| ifeq ($(HAVE_QT4),true) | |||
| TARGETS += ui_lv2-qt4 | |||
| # TARGETS += ui_lv2-qt4 | |||
| endif | |||
| ifeq ($(HAVE_QT5),true) | |||
| TARGETS += ui_lv2-qt5 | |||
| # TARGETS += ui_lv2-qt5 | |||
| endif | |||
| ifeq ($(HAVE_X11),true) | |||
| @@ -81,10 +81,7 @@ endif | |||
| # -------------------------------------------------------------- | |||
| # all: $(TARGETS) | |||
| # TODO | |||
| all: | |||
| all: $(TARGETS) | |||
| ui_lv2-gtk2: ../../bin/carla-bridge-lv2-gtk2 | |||
| ui_lv2-gtk3: ../../bin/carla-bridge-lv2-gtk3 | |||
| @@ -237,7 +234,7 @@ OBJS_VST_X11 = \ | |||
| CarlaBridgeToolkitPlugin__vst-x11.o \ | |||
| CarlaBridgeUI-VST__vst-x11.o \ | |||
| ../../bin/carla-bridge-vst-x11: $(OBJS_VST_X11) $(OBJS_VST_LIBS) ../modules/theme.a | |||
| ../../bin/carla-bridge-vst-x11: $(OBJS_VST_X11) $(OBJS_VST_LIBS) | |||
| $(CXX) $^ $(LINK_VST_X11_FLAGS) -o $@ | |||
| %__vst-x11.o: %.cpp | |||
| @@ -41,11 +41,11 @@ static int temporaryErrorHandler(Display*, XErrorEvent*) | |||
| return 0; | |||
| } | |||
| class X11PluginUi : public CarlaPluginUi | |||
| class X11PluginUi : public CarlaPluginUI | |||
| { | |||
| public: | |||
| X11PluginUi(CloseCallback* const cb, const uintptr_t parentId) noexcept | |||
| : CarlaPluginUi(cb), | |||
| : CarlaPluginUI(cb), | |||
| fDisplay(nullptr), | |||
| fWindow(0), | |||
| fIsVisible(false), | |||
| @@ -184,7 +184,7 @@ public: | |||
| { | |||
| fIsVisible = false; | |||
| CARLA_SAFE_ASSERT_CONTINUE(fCallback != nullptr); | |||
| fCallback->handlePluginUiClosed(); | |||
| fCallback->handlePluginUIClosed(); | |||
| } | |||
| break; | |||
| @@ -193,7 +193,7 @@ public: | |||
| { | |||
| fIsVisible = false; | |||
| CARLA_SAFE_ASSERT_CONTINUE(fCallback != nullptr); | |||
| fCallback->handlePluginUiClosed(); | |||
| fCallback->handlePluginUIClosed(); | |||
| } | |||
| break; | |||
| } | |||
| @@ -298,7 +298,7 @@ private: | |||
| // ----------------------------------------------------- | |||
| bool CarlaPluginUi::tryTransientWinIdMatch(const uintptr_t pid, const char* const uiTitle, const uintptr_t winId) | |||
| bool CarlaPluginUI::tryTransientWinIdMatch(const uintptr_t pid, const char* const uiTitle, const uintptr_t winId) | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(uiTitle != nullptr && uiTitle[0] != '\0', true); | |||
| CARLA_SAFE_ASSERT_RETURN(winId != 0, true); | |||
| @@ -456,7 +456,7 @@ bool CarlaPluginUi::tryTransientWinIdMatch(const uintptr_t pid, const char* cons | |||
| // ----------------------------------------------------- | |||
| #ifdef CARLA_OS_MAC | |||
| CarlaPluginUi* CarlaPluginUi::newCocoa(CloseCallback*, uintptr_t) | |||
| CarlaPluginUI* CarlaPluginUI::newCocoa(CloseCallback*, uintptr_t) | |||
| { | |||
| //return new CocoaPluginUi(cb, parentId); | |||
| return nullptr; | |||
| @@ -464,7 +464,7 @@ CarlaPluginUi* CarlaPluginUi::newCocoa(CloseCallback*, uintptr_t) | |||
| #endif | |||
| #ifdef CARLA_OS_WIN | |||
| CarlaPluginUi* CarlaPluginUi::newWindows(CloseCallback*, uintptr_t) | |||
| CarlaPluginUI* CarlaPluginUI::newWindows(CloseCallback*, uintptr_t) | |||
| { | |||
| //return new WindowsPluginUi(cb, parentId); | |||
| return nullptr; | |||
| @@ -472,7 +472,7 @@ CarlaPluginUi* CarlaPluginUi::newWindows(CloseCallback*, uintptr_t) | |||
| #endif | |||
| #ifdef HAVE_X11 | |||
| CarlaPluginUi* CarlaPluginUi::newX11(CloseCallback* cb, uintptr_t parentId) | |||
| CarlaPluginUI* CarlaPluginUI::newX11(CloseCallback* cb, uintptr_t parentId) | |||
| { | |||
| return new X11PluginUi(cb, parentId); | |||
| } | |||
| @@ -22,16 +22,16 @@ | |||
| // ----------------------------------------------------- | |||
| class CarlaPluginUi | |||
| class CarlaPluginUI | |||
| { | |||
| public: | |||
| class CloseCallback { | |||
| public: | |||
| virtual ~CloseCallback() {} | |||
| virtual void handlePluginUiClosed() = 0; | |||
| virtual void handlePluginUIClosed() = 0; | |||
| }; | |||
| virtual ~CarlaPluginUi() {} | |||
| virtual ~CarlaPluginUI() {} | |||
| virtual void show() = 0; | |||
| virtual void hide() = 0; | |||
| virtual void focus() = 0; | |||
| @@ -47,19 +47,19 @@ public: | |||
| static bool tryTransientWinIdMatch(const uintptr_t pid, const char* const uiTitle, const uintptr_t winId); | |||
| #ifdef CARLA_OS_MAC | |||
| static CarlaPluginUi* newCocoa(CloseCallback*, uintptr_t); | |||
| static CarlaPluginUI* newCocoa(CloseCallback*, uintptr_t); | |||
| #endif | |||
| #ifdef CARLA_OS_WIN | |||
| static CarlaPluginUi* newWindows(CloseCallback*, uintptr_t); | |||
| static CarlaPluginUI* newWindows(CloseCallback*, uintptr_t); | |||
| #endif | |||
| #ifdef HAVE_X11 | |||
| static CarlaPluginUi* newX11(CloseCallback*, uintptr_t); | |||
| static CarlaPluginUI* newX11(CloseCallback*, uintptr_t); | |||
| #endif | |||
| protected: | |||
| bool fIsIdling; | |||
| CloseCallback* fCallback; | |||
| CarlaPluginUi(CloseCallback* const cb) noexcept : fIsIdling(false), fCallback(cb) {} | |||
| CarlaPluginUI(CloseCallback* const cb) noexcept : fIsIdling(false), fCallback(cb) {} | |||
| }; | |||
| // ----------------------------------------------------- | |||