@@ -54,6 +54,8 @@ BUILD_CXX_FLAGS += -DVESTIGE_HEADER | |||
# -------------------------------------------------------------- | |||
HAVE_QT5 = $(shell pkg-config --atleast-version 5 QtCore && echo true) | |||
HAVE_JACK = $(shell pkg-config --exists jack && echo true) | |||
# HAVE_JACKSESSION = $(shell pkg-config --atleast-version=0.121.0 jack && echo true) | |||
@@ -17,13 +17,21 @@ ifeq ($(CARLA_PLUGIN_SUPPORT),true) | |||
BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST | |||
endif | |||
ifeq ($(HAVE_QT5), true) | |||
QT_UI_FLAGS = $(shell pkg-config --cflags QtWidgets) | |||
QT_UI_LIBS = $(shell pkg-config --libs QtWidgets) | |||
else | |||
QT_UI_FLAGS = $(shell pkg-config --cflags QtGui) | |||
QT_UI_LIBS = $(shell pkg-config --libs QtGui) | |||
endif | |||
# -------------------------------------------------------------- | |||
# Plugin bridges | |||
BUILD_PLUGIN_FLAGS = $(BUILD_CXX_FLAGS) | |||
BUILD_PLUGIN_FLAGS += -DBUILD_BRIDGE_PLUGIN | |||
BUILD_PLUGIN_FLAGS += -DCARLA_ENGINE_JACK -I../carla-backend -I../carla-engine -I../carla-jackbridge -I../carla-plugin | |||
BUILD_PLUGIN_FLAGS += $(shell pkg-config --cflags jack QtGui) | |||
BUILD_PLUGIN_FLAGS += $(shell pkg-config --cflags jack) $(QT_UI_FLAGS) | |||
LINK_PLUGIN_FLAGS = $(LINK_FLAGS) | |||
LINK_PLUGIN_FLAGS += $(shell pkg-config --libs QtGui) | |||
@@ -47,26 +55,29 @@ LINK_UI_FLAGS = $(LINK_FLAGS) -ldl | |||
BUILD_UI_LV2_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_LV2 | |||
BUILD_UI_VST_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_VST | |||
BUILD_UI_LV2_GTK2_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_LV2_GTK2 $(shell pkg-config --cflags gtk+-2.0) | |||
BUILD_UI_LV2_GTK2_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_GTK2 -DBRIDGE_LV2_GTK2 $(shell pkg-config --cflags gtk+-2.0) | |||
LINK_UI_LV2_GTK2_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-2.0) | |||
BUILD_UI_LV2_GTK3_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_LV2_GTK3 $(shell pkg-config --cflags gtk+-3.0) | |||
BUILD_UI_LV2_GTK3_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_GTK3 -DBRIDGE_LV2_GTK3 $(shell pkg-config --cflags gtk+-3.0) | |||
LINK_UI_LV2_GTK3_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-3.0) | |||
BUILD_UI_LV2_QT4_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_LV2_QT4 $(shell pkg-config --cflags QtGui) | |||
BUILD_UI_LV2_QT4_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_QT4 -DBRIDGE_LV2_QT4 $(shell pkg-config --cflags QtGui) | |||
LINK_UI_LV2_QT4_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) | |||
BUILD_UI_LV2_QT5_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_LV2_QT5 $(shell pkg-config --cflags QtWidgets) | |||
BUILD_UI_LV2_QT5_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_QT5 -DBRIDGE_LV2_QT5 $(shell pkg-config --cflags QtWidgets) | |||
LINK_UI_LV2_QT5_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtWidgets) | |||
BUILD_UI_LV2_X11_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_LV2_X11 $(shell pkg-config --cflags QtGui) | |||
LINK_UI_LV2_X11_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) | |||
BUILD_UI_LV2_HWND_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_HWND -DBRIDGE_LV2_HWND $(QT_UI_FLAGS) | |||
LINK_UI_LV2_HWND_FLAGS = $(LINK_FLAGS) $(QT_UI_LIBS) -mwindows -static | |||
BUILD_UI_LV2_X11_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_X11 -DBRIDGE_LV2_X11 $(QT_UI_FLAGS) | |||
LINK_UI_LV2_X11_FLAGS = $(LINK_UI_FLAGS) $(QT_UI_LIBS) | |||
BUILD_UI_VST_HWND_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_VST_HWND $(shell pkg-config --cflags QtGui) | |||
LINK_UI_VST_HWND_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs QtGui) -mwindows -static | |||
BUILD_UI_VST_HWND_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_HWND -DBRIDGE_VST_HWND $(QT_UI_FLAGS) | |||
LINK_UI_VST_HWND_FLAGS = $(LINK_FLAGS) $(QT_UI_LIBS) -mwindows -static | |||
BUILD_UI_VST_X11_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_VST_X11 $(shell pkg-config --cflags QtGui) | |||
LINK_UI_VST_X11_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) | |||
BUILD_UI_VST_X11_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_X11 -DBRIDGE_VST_X11 $(QT_UI_FLAGS) | |||
LINK_UI_VST_X11_FLAGS = $(LINK_UI_FLAGS) $(QT_UI_LIBS) | |||
# -------------------------------------------------------------- | |||
@@ -207,32 +218,48 @@ carla_bridge_osc__lv2-x11.o: carla_bridge_osc.cpp | |||
# ui_vst-hwnd | |||
OBJS_UI_VST_HWND = \ | |||
carla_bridge_ui-vst__vst-hwnd.o carla_bridge_toolkit-qt__vst-hwnd.o carla_bridge_osc__vst.o | |||
carla_bridge_client__vst-hwnd.o carla_bridge_osc__vst.o \ | |||
carla_bridge_toolkit__vst-hwnd.o carla_bridge_toolkit-qt__vst-hwnd.o \ | |||
carla_bridge_ui-vst__vst-hwnd.o | |||
carla-bridge-vst-hwnd.exe: $(OBJS_UI_VST_HWND) | |||
$(CXX) $^ $(LINK_UI_VST_HWND_FLAGS) -o $@ && $(STRIP) $@ | |||
carla_bridge_ui-vst__vst-hwnd.o: carla_bridge_ui-vst.cpp | |||
carla_bridge_client__vst-hwnd.o: carla_bridge_client.cpp | |||
$(CXX) $< $(BUILD_UI_VST_HWND_FLAGS) -c -o $@ | |||
carla_bridge_toolkit__vst-hwnd.o: carla_bridge_toolkit.cpp | |||
$(CXX) $< $(BUILD_UI_VST_HWND_FLAGS) -c -o $@ | |||
carla_bridge_toolkit-qt__vst-hwnd.o: carla_bridge_toolkit-qt.cpp | |||
$(CXX) $< $(BUILD_UI_VST_HWND_FLAGS) -c -o $@ | |||
carla_bridge_ui-vst__vst-hwnd.o: carla_bridge_ui-vst.cpp | |||
$(CXX) $< $(BUILD_UI_VST_HWND_FLAGS) -c -o $@ | |||
# -------------------------------------------------------------- | |||
# ui_vst-x11 | |||
OBJS_UI_VST_X11 = \ | |||
carla_bridge_ui-vst__vst-x11.o carla_bridge_toolkit-qt__vst-x11.o carla_bridge_osc__vst.o | |||
carla_bridge_client__vst-x11.o carla_bridge_osc__vst.o \ | |||
carla_bridge_toolkit__vst-x11.o carla_bridge_toolkit-qt__vst-x11.o \ | |||
carla_bridge_ui-vst__vst-x11.o | |||
carla-bridge-vst-x11: $(OBJS_UI_VST_X11) | |||
$(CXX) $^ $(LINK_UI_VST_X11_FLAGS) -o $@ && $(STRIP) $@ | |||
carla_bridge_ui-vst__vst-x11.o: carla_bridge_ui-vst.cpp | |||
carla_bridge_client__vst-x11.o: carla_bridge_client.cpp | |||
$(CXX) $< $(BUILD_UI_VST_X11_FLAGS) -c -o $@ | |||
carla_bridge_toolkit__vst-x11.o: carla_bridge_toolkit.cpp | |||
$(CXX) $< $(BUILD_UI_VST_X11_FLAGS) -c -o $@ | |||
carla_bridge_toolkit-qt__vst-x11.o: carla_bridge_toolkit-qt.cpp | |||
$(CXX) $< $(BUILD_UI_VST_X11_FLAGS) -c -o $@ | |||
carla_bridge_ui-vst__vst-x11.o: carla_bridge_ui-vst.cpp | |||
$(CXX) $< $(BUILD_UI_VST_X11_FLAGS) -c -o $@ | |||
# -------------------------------------------------------------- | |||
# posix32 | |||
@@ -1,5 +1,5 @@ | |||
/* | |||
* Carla bridge code | |||
* Carla Bridge | |||
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or modify | |||
@@ -26,8 +26,8 @@ | |||
CARLA_BRIDGE_START_NAMESPACE | |||
class CarlaClient; | |||
class CarlaToolkit; | |||
class CarlaBridgeClient; | |||
class CarlaBridgeToolkit; | |||
CARLA_BRIDGE_END_NAMESPACE | |||
@@ -0,0 +1,332 @@ | |||
/* | |||
* Carla Bridge Client | |||
* Copyright (C) 2011-2012 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 COPYING file | |||
*/ | |||
#include "carla_bridge_client.hpp" | |||
#include "carla_bridge_toolkit.hpp" | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
# include "carla_engine.hpp" | |||
#else | |||
# include "carla_lib_utils.hpp" | |||
#endif | |||
#include <cmath> | |||
#include <cstdio> | |||
#include <cstdint> | |||
#include <cstdlib> | |||
CARLA_BRIDGE_START_NAMESPACE | |||
// --------------------------------------------------------------------- | |||
CarlaBridgeClient::CarlaBridgeClient(const char* const uiTitle) | |||
: m_osc(this), | |||
m_toolkit(CarlaBridgeToolkit::createNew(this, uiTitle)) | |||
{ | |||
qDebug("CarlaBridgeClient::CarlaBridgeClient(\"%s\")", uiTitle); | |||
m_oscData = nullptr; | |||
#ifdef BUILD_BRIDGE_UI | |||
m_uiFilename = nullptr; | |||
m_uiLib = nullptr; | |||
m_uiQuit = false; | |||
#endif | |||
m_toolkit->init(); | |||
} | |||
CarlaBridgeClient::~CarlaBridgeClient() | |||
{ | |||
qDebug("CarlaBridgeClient::~CarlaBridgeClient()"); | |||
#ifdef BUILD_BRIDGE_UI | |||
if (m_uiFilename) | |||
free(m_uiFilename); | |||
#endif | |||
} | |||
// --------------------------------------------------------------------- | |||
// ui initialization | |||
#ifdef BUILD_BRIDGE_UI | |||
bool CarlaBridgeClient::init(const char* const, const char* const) | |||
{ | |||
qDebug("CarlaBridgeClient::init()"); | |||
m_uiQuit = false; | |||
return false; | |||
} | |||
void CarlaBridgeClient::close() | |||
{ | |||
qDebug("CarlaBridgeClient::close()"); | |||
if (! m_uiQuit) | |||
{ | |||
m_uiQuit = true; | |||
if (isOscControlRegistered()) | |||
sendOscExiting(); | |||
} | |||
m_toolkit->quit(); | |||
} | |||
#endif | |||
// --------------------------------------------------------------------- | |||
// osc stuff | |||
bool CarlaBridgeClient::oscInit(const char* const url) | |||
{ | |||
qDebug("CarlaBridgeClient::oscInit(\"%s\")", url); | |||
bool ret = m_osc.init(url); | |||
m_oscData = m_osc.getControlData(); | |||
return ret; | |||
} | |||
bool CarlaBridgeClient::oscIdle() | |||
{ | |||
m_osc .idle(); | |||
#ifdef BUILD_BRIDGE_UI | |||
return ! m_uiQuit; | |||
#else | |||
return true; | |||
#endif | |||
} | |||
void CarlaBridgeClient::oscClose() | |||
{ | |||
qDebug("CarlaBridgeClient::oscClose()"); | |||
CARLA_ASSERT(m_oscData); | |||
m_osc.close(); | |||
m_oscData = nullptr; | |||
} | |||
bool CarlaBridgeClient::isOscControlRegistered() const | |||
{ | |||
return m_osc.isControlRegistered(); | |||
} | |||
void CarlaBridgeClient::sendOscUpdate() | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscUpdate()"); | |||
CARLA_ASSERT(m_oscData); | |||
if (m_oscData->target) | |||
osc_send_update(m_oscData, m_osc.getServerPath()); | |||
} | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
void CarlaBridgeClient::sendOscBridgeError(const char* const error) | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscBridgeError(\"%s\")", error); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(error); | |||
if (m_oscData->target) | |||
osc_send_bridge_error(m_oscData, error); | |||
} | |||
void CarlaBridgeClient::registerOscEngine(CarlaBackend::CarlaEngine* const engine) | |||
{ | |||
qDebug("CarlaBridgeClient::registerOscEngine(%p)", engine); | |||
engine->setOscBridgeData(m_oscData); | |||
} | |||
#endif | |||
// --------------------------------------------------------------------- | |||
// toolkit | |||
void CarlaBridgeClient::toolkitShow() | |||
{ | |||
qDebug("CarlaBridgeClient::toolkitShow()"); | |||
m_toolkit->show(); | |||
} | |||
void CarlaBridgeClient::toolkitHide() | |||
{ | |||
qDebug("CarlaBridgeClient::toolkitHide()"); | |||
m_toolkit->hide(); | |||
} | |||
void CarlaBridgeClient::toolkitResize(int width, int height) | |||
{ | |||
qDebug("CarlaBridgeClient::toolkitResize(%i, %i)", width, height); | |||
m_toolkit->resize(width, height); | |||
} | |||
void CarlaBridgeClient::toolkitExec(const bool showGui) | |||
{ | |||
qDebug("CarlaBridgeClient::toolkitExec(%s)", bool2str(showGui)); | |||
m_toolkit->exec(showGui); | |||
} | |||
void CarlaBridgeClient::toolkitQuit() | |||
{ | |||
qDebug("CarlaBridgeClient::toolkitQuit()"); | |||
#ifdef BUILD_BRIDGE_UI | |||
m_uiQuit = true; | |||
#endif | |||
m_toolkit->quit(); | |||
} | |||
// --------------------------------------------------------------------- | |||
void CarlaBridgeClient::sendOscConfigure(const char* const key, const char* const value) | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscConfigure(\"%s\", \"%s\")", key, value); | |||
CARLA_ASSERT(m_oscData); | |||
if (m_oscData->target) | |||
osc_send_configure(m_oscData, key, value); | |||
} | |||
void CarlaBridgeClient::sendOscControl(const int32_t index, const float value) | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscControl(%i, %f)", index, value); | |||
CARLA_ASSERT(m_oscData); | |||
if (m_oscData->target) | |||
osc_send_control(m_oscData, index, value); | |||
} | |||
void CarlaBridgeClient::sendOscProgram(const int32_t index) | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscProgram(%i)", index); | |||
CARLA_ASSERT(m_oscData); | |||
if (m_oscData->target) | |||
osc_send_program(m_oscData, index); | |||
} | |||
void CarlaBridgeClient::sendOscMidiProgram(const int32_t index) | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscMidiProgram(%i)", index); | |||
CARLA_ASSERT(m_oscData); | |||
if (m_oscData->target) | |||
osc_send_midi_program(m_oscData, index); | |||
} | |||
void CarlaBridgeClient::sendOscMidi(const uint8_t midiBuf[4]) | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscMidi(%p)", midiBuf); | |||
CARLA_ASSERT(m_oscData); | |||
if (m_oscData->target) | |||
osc_send_midi(m_oscData, midiBuf); | |||
} | |||
void CarlaBridgeClient::sendOscExiting() | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscExiting()"); | |||
CARLA_ASSERT(m_oscData); | |||
if (m_oscData->target) | |||
osc_send_exiting(m_oscData); | |||
} | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
void CarlaBridgeClient::sendOscBridgeUpdate() | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscBridgeUpdate()"); | |||
CARLA_ASSERT(m_oscData); | |||
CARLA_ASSERT(m_oscData->target && m_osc.m_serverPath); | |||
if (m_oscData->target && m_osc.m_serverPath) | |||
osc_send_bridge_update(m_oscData, m_osc.m_serverPath); | |||
} | |||
#endif | |||
#ifdef BRIDGE_LV2 | |||
void CarlaBridgeClient::sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf) | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscLv2TransferAtom(%i, \"%s\", \"%s\")", portIndex, typeStr, atomBuf); | |||
CARLA_ASSERT(m_oscData); | |||
if (m_oscData->target) | |||
osc_send_lv2_transfer_atom(m_oscData, portIndex, typeStr, atomBuf); | |||
} | |||
void CarlaBridgeClient::sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf) | |||
{ | |||
qDebug("CarlaBridgeClient::sendOscLv2TransferEvent(%i, \"%s\", \"%s\")", portIndex, typeStr, atomBuf); | |||
CARLA_ASSERT(m_oscData); | |||
if (m_oscData->target) | |||
osc_send_lv2_transfer_event(m_oscData, portIndex, typeStr, atomBuf); | |||
} | |||
#endif | |||
// --------------------------------------------------------------------- | |||
#ifdef BUILD_BRIDGE_UI | |||
void* CarlaBridgeClient::getContainerId() | |||
{ | |||
return m_toolkit->getContainerId(); | |||
} | |||
bool CarlaBridgeClient::uiLibOpen(const char* const filename) | |||
{ | |||
CARLA_ASSERT(filename); | |||
if (m_uiFilename) | |||
free(m_uiFilename); | |||
m_uiLib = lib_open(filename); | |||
m_uiFilename = strdup(filename ? filename : ""); | |||
return bool(m_uiLib); | |||
} | |||
bool CarlaBridgeClient::uiLibClose() | |||
{ | |||
if (m_uiLib) | |||
{ | |||
const bool closed = lib_close(m_uiLib); | |||
m_uiLib = nullptr; | |||
return closed; | |||
} | |||
return false; | |||
} | |||
void* CarlaBridgeClient::uiLibSymbol(const char* const symbol) | |||
{ | |||
if (m_uiLib) | |||
return lib_symbol(m_uiLib, symbol); | |||
return nullptr; | |||
} | |||
const char* CarlaBridgeClient::uiLibError() | |||
{ | |||
return lib_error(m_uiFilename); | |||
} | |||
#endif | |||
CARLA_BRIDGE_END_NAMESPACE |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Carla bridge code | |||
* Carla Bridge Client | |||
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or modify | |||
@@ -19,18 +19,7 @@ | |||
#define CARLA_BRIDGE_CLIENT_H | |||
#include "carla_bridge_osc.hpp" | |||
#include "carla_bridge_toolkit.hpp" | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
# include "carla_engine.hpp" | |||
#else | |||
# include "carla_lib_utils.hpp" | |||
#endif | |||
#include <cmath> | |||
#include <cstdio> | |||
#include <cstdint> | |||
#include <cstdlib> | |||
#include <QtCore/QMutex> | |||
CARLA_BRIDGE_START_NAMESPACE | |||
@@ -42,62 +31,27 @@ CARLA_BRIDGE_START_NAMESPACE | |||
* @{ | |||
*/ | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
const char* const carlaClientName = "carla-bridge-plugin"; | |||
#else | |||
const char* const carlaClientName = "carla-bridge-ui"; | |||
#endif | |||
class CarlaClient | |||
class CarlaBridgeClient | |||
{ | |||
public: | |||
CarlaClient(CarlaToolkit* const toolkit) | |||
: m_osc(this, carlaClientName), | |||
m_toolkit(toolkit) | |||
{ | |||
#ifdef BUILD_BRIDGE_UI | |||
m_filename = nullptr; | |||
m_lib = nullptr; | |||
m_quit = false; | |||
#endif | |||
m_toolkit->m_client = this; | |||
} | |||
CarlaBridgeClient(const char* const uiTitle); | |||
virtual ~CarlaBridgeClient(); | |||
virtual ~CarlaClient() | |||
{ | |||
#ifdef BUILD_BRIDGE_UI | |||
if (m_filename) | |||
free(m_filename); | |||
#endif | |||
} | |||
// --------------------------------------------------------------------- | |||
// ui initialization | |||
#ifdef BUILD_BRIDGE_UI | |||
virtual bool init(const char* const, const char* const) | |||
{ | |||
m_quit = false; | |||
return false; | |||
} | |||
virtual void close() | |||
{ | |||
if (! m_quit) | |||
{ | |||
m_quit = true; | |||
sendOscExiting(); | |||
} | |||
} | |||
virtual bool init(const char* const, const char* const); | |||
virtual void close(); | |||
#endif | |||
#ifdef BUILD_BRIDGE_UI | |||
// --------------------------------------------------------------------- | |||
// ui management | |||
#ifdef BUILD_BRIDGE_UI | |||
virtual void* getWidget() const = 0; | |||
virtual bool isResizable() const = 0; | |||
virtual bool needsReparent() const = 0; | |||
virtual bool isResizable() const = 0; | |||
virtual bool needsReparent() const = 0; | |||
#endif | |||
// --------------------------------------------------------------------- | |||
@@ -114,230 +68,80 @@ public: | |||
virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0; | |||
virtual void noteOff(const uint8_t channel, const uint8_t note) = 0; | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
// --------------------------------------------------------------------- | |||
// plugin | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
virtual void saveNow() = 0; | |||
virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0; | |||
virtual void setChunkData(const char* const filePath) = 0; | |||
#endif | |||
// --------------------------------------------------------------------- | |||
// osc stuff | |||
bool oscInit(const char* const url) | |||
{ | |||
qDebug("CarlaClient::oscInit(\"%s\")", url); | |||
return m_osc.init(url); | |||
} | |||
bool oscIdle() | |||
{ | |||
if (m_osc.m_server) | |||
while (lo_server_recv_noblock(m_osc.m_server, 0) != 0) {} | |||
#ifdef BUILD_BRIDGE_UI | |||
return ! m_quit; | |||
#else | |||
return true; | |||
#endif | |||
} | |||
void oscClose() | |||
{ | |||
qDebug("CarlaClient::oscClose()"); | |||
m_osc.close(); | |||
} | |||
void sendOscUpdate() | |||
{ | |||
qDebug("CarlaClient::sendOscUpdate()"); | |||
CARLA_ASSERT(m_osc.m_controlData.target); | |||
bool oscInit(const char* const url); | |||
bool oscIdle(); | |||
void oscClose(); | |||
if (m_osc.m_controlData.target) | |||
osc_send_update(&m_osc.m_controlData, m_osc.m_serverPath); | |||
} | |||
bool isOscControlRegistered() const; | |||
void sendOscUpdate(); | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
void sendOscBridgeError(const char* const error) | |||
{ | |||
qDebug("CarlaClient::sendOscBridgeError(\"%s\")", error); | |||
CARLA_ASSERT(m_osc.m_controlData.target); | |||
CARLA_ASSERT(error); | |||
if (m_osc.m_controlData.target) | |||
osc_send_bridge_error(&m_osc.m_controlData, error); | |||
} | |||
void registerOscEngine(CarlaBackend::CarlaEngine* const engine) | |||
{ | |||
qDebug("CarlaClient::registerOscEngine(%p)", engine); | |||
engine->setOscBridgeData(&m_osc.m_controlData); | |||
} | |||
void sendOscBridgeError(const char* const error); | |||
void registerOscEngine(CarlaBackend::CarlaEngine* const engine); | |||
#endif | |||
// --------------------------------------------------------------------- | |||
// toolkit | |||
void toolkitShow() | |||
{ | |||
m_toolkit->show(); | |||
} | |||
void toolkitHide() | |||
{ | |||
m_toolkit->hide(); | |||
} | |||
void toolkitResize(int width, int height) | |||
{ | |||
m_toolkit->resize(width, height); | |||
} | |||
void toolkitQuit() | |||
{ | |||
#ifdef BUILD_BRIDGE_UI | |||
m_quit = true; | |||
#endif | |||
m_toolkit->quit(); | |||
} | |||
void toolkitShow(); | |||
void toolkitHide(); | |||
void toolkitResize(int width, int height); | |||
void toolkitExec(const bool showGui); | |||
void toolkitQuit(); | |||
// --------------------------------------------------------------------- | |||
protected: | |||
void sendOscConfigure(const char* const key, const char* const value) | |||
{ | |||
qDebug("CarlaClient::sendOscConfigure(\"%s\", \"%s\")", key, value); | |||
if (m_osc.m_controlData.target) | |||
osc_send_configure(&m_osc.m_controlData, key, value); | |||
} | |||
void sendOscControl(const int32_t index, const float value) | |||
{ | |||
qDebug("CarlaClient::sendOscControl(%i, %f)", index, value); | |||
if (m_osc.m_controlData.target) | |||
osc_send_control(&m_osc.m_controlData, index, value); | |||
} | |||
void sendOscProgram(const int32_t index) | |||
{ | |||
qDebug("CarlaClient::sendOscProgram(%i)", index); | |||
if (m_osc.m_controlData.target) | |||
osc_send_program(&m_osc.m_controlData, index); | |||
} | |||
void sendOscMidiProgram(const int32_t index) | |||
{ | |||
qDebug("CarlaClient::sendOscMidiProgram(%i)", index); | |||
if (m_osc.m_controlData.target) | |||
osc_send_midi_program(&m_osc.m_controlData, index); | |||
} | |||
void sendOscMidi(const uint8_t midiBuf[4]) | |||
{ | |||
qDebug("CarlaClient::sendOscMidi(%p)", midiBuf); | |||
if (m_osc.m_controlData.target) | |||
osc_send_midi(&m_osc.m_controlData, midiBuf); | |||
} | |||
void sendOscExiting() | |||
{ | |||
qDebug("CarlaClient::sendOscExiting()"); | |||
if (m_osc.m_controlData.target) | |||
osc_send_exiting(&m_osc.m_controlData); | |||
} | |||
void sendOscConfigure(const char* const key, const char* const value); | |||
void sendOscControl(const int32_t index, const float value); | |||
void sendOscProgram(const int32_t index); | |||
void sendOscMidiProgram(const int32_t index); | |||
void sendOscMidi(const uint8_t midiBuf[4]); | |||
void sendOscExiting(); | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
void sendOscBridgeUpdate() | |||
{ | |||
qDebug("CarlaClient::sendOscBridgeUpdate()"); | |||
CARLA_ASSERT(m_osc.m_controlData.target && m_osc.m_serverPath); | |||
if (m_osc.m_controlData.target && m_osc.m_serverPath) | |||
osc_send_bridge_update(&m_osc.m_controlData, m_osc.m_serverPath); | |||
} | |||
void sendOscBridgeUpdate(); | |||
#endif | |||
#ifdef BRIDGE_LV2 | |||
void sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf) | |||
{ | |||
qDebug("CarlaClient::sendOscLv2TransferAtom(%i, \"%s\", \"%s\")", portIndex, typeStr, atomBuf); | |||
if (m_osc.m_controlData.target) | |||
osc_send_lv2_transfer_atom(&m_osc.m_controlData, portIndex, typeStr, atomBuf); | |||
} | |||
void sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf) | |||
{ | |||
qDebug("CarlaClient::sendOscLv2TransferEvent(%i, \"%s\", \"%s\")", portIndex, typeStr, atomBuf); | |||
if (m_osc.m_controlData.target) | |||
osc_send_lv2_transfer_event(&m_osc.m_controlData, portIndex, typeStr, atomBuf); | |||
} | |||
void sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf); | |||
void sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf); | |||
#endif | |||
// --------------------------------------------------------------------- | |||
#ifdef BUILD_BRIDGE_UI | |||
void* getContainerId() | |||
{ | |||
return m_toolkit->getContainerId(); | |||
} | |||
bool libOpen(const char* const filename) | |||
{ | |||
CARLA_ASSERT(filename); | |||
if (m_filename) | |||
free(m_filename); | |||
m_lib = lib_open(filename); | |||
m_filename = strdup(filename ? filename : ""); | |||
return bool(m_lib); | |||
} | |||
bool libClose() | |||
{ | |||
if (m_lib) | |||
{ | |||
const bool closed = lib_close(m_lib); | |||
m_lib = nullptr; | |||
return closed; | |||
} | |||
return false; | |||
} | |||
void* libSymbol(const char* const symbol) | |||
{ | |||
if (m_lib) | |||
return lib_symbol(m_lib, symbol); | |||
return nullptr; | |||
} | |||
const char* libError() | |||
{ | |||
return lib_error(m_filename); | |||
} | |||
void* getContainerId(); | |||
bool uiLibOpen(const char* const filename); | |||
bool uiLibClose(); | |||
void* uiLibSymbol(const char* const symbol); | |||
const char* uiLibError(); | |||
#endif | |||
// --------------------------------------------------------------------- | |||
private: | |||
CarlaBridgeOsc m_osc; | |||
CarlaToolkit* const m_toolkit; | |||
CarlaBridgeToolkit* const m_toolkit; | |||
const CarlaOscData* m_oscData; | |||
#ifdef BUILD_BRIDGE_UI | |||
char* m_filename; | |||
void* m_lib; | |||
bool m_quit; | |||
char* m_uiFilename; | |||
void* m_uiLib; | |||
bool m_uiQuit; | |||
#endif | |||
}; | |||
@@ -1,5 +1,5 @@ | |||
/* | |||
* Carla Plugin bridge code | |||
* Carla Bridge OSC | |||
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or modify | |||
@@ -18,99 +18,154 @@ | |||
#include "carla_bridge_osc.hpp" | |||
#include "carla_bridge_client.hpp" | |||
#include "carla_midi.h" | |||
#include "carla_utils.hpp" | |||
#include <QtCore/QString> | |||
#include <QtCore/QStringList> | |||
CARLA_BRIDGE_START_NAMESPACE | |||
unsigned int uintMin(unsigned int value1, unsigned int value2) | |||
{ | |||
return value1 < value2 ? value1 : value2; | |||
} | |||
void osc_error_handler(const int num, const char* const msg, const char* const path) | |||
{ | |||
qCritical("osc_error_handler(%i, \"%s\", \"%s\")", num, msg, path); | |||
} | |||
// ----------------------------------------------------------------------- | |||
CarlaBridgeOsc::CarlaBridgeOsc(CarlaClient* const client_, const char* const name) | |||
CarlaBridgeOsc::CarlaBridgeOsc(CarlaBridgeClient* const client_) | |||
: client(client_) | |||
{ | |||
qDebug("CarlaBridgeOsc::CarlaOsc(%p, \"%s\")", client, name); | |||
qDebug("CarlaBridgeOsc::CarlaBridgeOsc(%p)", client); | |||
CARLA_ASSERT(client); | |||
CARLA_ASSERT(name); | |||
m_name = nullptr; | |||
m_nameSize = 0; | |||
m_server = nullptr; | |||
m_serverPath = nullptr; | |||
m_controlData.path = nullptr; | |||
m_controlData.source = nullptr; // unused | |||
m_controlData.target = nullptr; | |||
m_name = strdup(name ? name : ""); | |||
m_nameSize = strlen(m_name); | |||
} | |||
CarlaBridgeOsc::~CarlaBridgeOsc() | |||
{ | |||
qDebug("CarlaBridgeOsc::~CarlaOsc()"); | |||
if (m_name) | |||
free(m_name); | |||
qDebug("CarlaBridgeOsc::~CarlaBridgeOsc()"); | |||
CARLA_ASSERT(! m_name); | |||
CARLA_ASSERT(! m_server); | |||
CARLA_ASSERT(! m_serverPath); | |||
} | |||
bool CarlaBridgeOsc::init(const char* const url) | |||
{ | |||
qDebug("CarlaBridgeOsc::init(\"%s\")", url); | |||
CARLA_ASSERT(! m_name); | |||
CARLA_ASSERT(! m_server); | |||
CARLA_ASSERT(! m_serverPath); | |||
CARLA_ASSERT(url); | |||
char* host = lo_url_get_hostname(url); | |||
char* port = lo_url_get_port(url); | |||
if (! url) | |||
{ | |||
qWarning("CarlaBridgeOsc::init(\"%s\") - invalid url", url); | |||
return false; | |||
} | |||
m_controlData.path = lo_url_get_path(url); | |||
#ifdef BUILD_BRIDGE_PLUGIN | |||
m_name = strdup("carla-bridge-plugin"); | |||
#else | |||
m_name = strdup("carla-bridge-ui"); | |||
#endif | |||
m_nameSize = strlen(m_name); | |||
char* const host = lo_url_get_hostname(url); | |||
char* const path = lo_url_get_path(url); | |||
char* const port = lo_url_get_port(url); | |||
if (! host) | |||
{ | |||
qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get url hostname", url); | |||
return false; | |||
} | |||
if (! path) | |||
{ | |||
free(host); | |||
qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get url path", url); | |||
return false; | |||
} | |||
if (! port) | |||
{ | |||
free(host); | |||
free(path); | |||
qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get url port", url); | |||
return false; | |||
} | |||
m_controlData.path = path; | |||
m_controlData.target = lo_address_new_with_proto(LO_TCP, host, port); | |||
free(host); | |||
free(port); | |||
if (! m_controlData.path) | |||
if (! m_controlData.target) | |||
{ | |||
qCritical("CarlaBridgeOsc::init(\"%s\") - failed to init OSC", url); | |||
qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get new url address for host '%s' and port '%s'", url, host, port); | |||
return false; | |||
} | |||
// create new OSC thread | |||
m_server = lo_server_new_with_proto(nullptr, LO_TCP, osc_error_handler); | |||
// get our full OSC server path | |||
char* const threadPath = lo_server_get_url(m_server); | |||
m_serverPath = strdup(QString("%1%2").arg(threadPath).arg(m_name).toUtf8().constData()); | |||
free(threadPath); | |||
if (! m_server) | |||
{ | |||
qCritical("CarlaBridgeOsc::init(\"%s\") - failed to create new OSC server", url); | |||
return false; | |||
} | |||
if (char* const serverUrl = lo_server_get_url(m_server)) | |||
{ | |||
m_serverPath = strdup(QString("%1%2").arg(serverUrl).arg(m_name).toUtf8().constData()); | |||
free(serverUrl); | |||
} | |||
else | |||
m_serverPath = strdup(QString("%1carla-bridge").arg(serverUrl).toUtf8().constData()); | |||
// register message handler | |||
lo_server_add_method(m_server, nullptr, nullptr, osc_message_handler, this); | |||
return true; | |||
} | |||
void CarlaBridgeOsc::idle() | |||
{ | |||
CARLA_ASSERT(m_server); | |||
if (m_server) | |||
{ | |||
while (lo_server_recv_noblock(m_server, 0) != 0) {} | |||
} | |||
} | |||
void CarlaBridgeOsc::close() | |||
{ | |||
qDebug("CarlaBridgeOsc::close()"); | |||
CARLA_ASSERT(m_name); | |||
CARLA_ASSERT(m_server); | |||
CARLA_ASSERT(m_serverPath); | |||
m_controlData.free(); | |||
m_nameSize = 0; | |||
lo_server_del_method(m_server, nullptr, nullptr); | |||
lo_server_free(m_server); | |||
if (m_name) | |||
{ | |||
free(m_name); | |||
m_name = nullptr; | |||
} | |||
free((void*)m_serverPath); | |||
m_serverPath = nullptr; | |||
m_server = nullptr; | |||
if (m_server) | |||
{ | |||
lo_server_del_method(m_server, nullptr, nullptr); | |||
lo_server_free(m_server); | |||
m_server = nullptr; | |||
} | |||
if (m_serverPath) | |||
{ | |||
free(m_serverPath); | |||
m_serverPath = nullptr; | |||
} | |||
m_controlData.free(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
@@ -118,15 +173,23 @@ void CarlaBridgeOsc::close() | |||
int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) | |||
{ | |||
qDebug("CarlaBridgeOsc::handleMessage(\"%s\", %i, %p, \"%s\", %p)", path, argc, argv, types, msg); | |||
CARLA_ASSERT(m_name); | |||
CARLA_ASSERT(m_server); | |||
CARLA_ASSERT(m_serverPath); | |||
CARLA_ASSERT(m_name); | |||
CARLA_ASSERT(path); | |||
if (! (m_name && path)) | |||
if (! path) | |||
{ | |||
qCritical("CarlaBridgeOsc::handleMessage() - got invalid path"); | |||
return 1; | |||
} | |||
if (! (m_name && m_server && m_serverPath)) | |||
{ | |||
qCritical("CarlaBridgeOsc::handleMessage(\"%s\", ...) - received message but client is offline", path); | |||
return 1; | |||
} | |||
// Check if message is for this client | |||
if (strlen(path) <= m_nameSize || strncmp(path+1, m_name, m_nameSize) != 0) | |||
{ | |||
qWarning("CarlaBridgeOsc::handleMessage() - message not for this client: '%s' != '/%s/'", path, m_name); | |||
@@ -134,46 +197,51 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||
} | |||
char method[32] = { 0 }; | |||
memcpy(method, path + (m_nameSize + 1), uintMin(strlen(path), 32)); | |||
strncpy(method, path + (m_nameSize + 2), 31); | |||
if (method[0] == 0 || method[0] != '/') | |||
if (method[0] == '\0') | |||
{ | |||
qWarning("CarlaBridgeOsc::handleMessage(\"%s\", ...) - received message without method", path); | |||
return 1; | |||
} | |||
// Common OSC methods | |||
if (strcmp(method, "/configure") == 0) | |||
if (strcmp(method, "configure") == 0) | |||
return handleMsgConfigure(argc, argv, types); | |||
if (strcmp(method, "/control") == 0) | |||
if (strcmp(method, "control") == 0) | |||
return handleMsgControl(argc, argv, types); | |||
if (strcmp(method, "/program") == 0) | |||
if (strcmp(method, "program") == 0) | |||
return handleMsgProgram(argc, argv, types); | |||
if (strcmp(method, "/midi_program") == 0) | |||
if (strcmp(method, "midi_program") == 0) | |||
return handleMsgMidiProgram(argc, argv, types); | |||
if (strcmp(method, "/midi") == 0) | |||
if (strcmp(method, "midi") == 0) | |||
return handleMsgMidi(argc, argv, types); | |||
if (strcmp(method, "/sample-rate") == 0) | |||
if (strcmp(method, "sample-rate") == 0) | |||
return 0; // unused | |||
if (strcmp(method, "/show") == 0) | |||
if (strcmp(method, "show") == 0) | |||
return handleMsgShow(); | |||
if (strcmp(method, "/hide") == 0) | |||
if (strcmp(method, "hide") == 0) | |||
return handleMsgHide(); | |||
if (strcmp(method, "/quit") == 0) | |||
if (strcmp(method, "quit") == 0) | |||
return handleMsgQuit(); | |||
#ifdef BRIDGE_LV2 | |||
if (strcmp(method, "/lv2_atom_transfer") == 0) | |||
// LV2 UI methods | |||
if (strcmp(method, "lv2_atom_transfer") == 0) | |||
return handleMsgLv2TransferAtom(argc, argv, types); | |||
if (strcmp(method, "/lv2_event_transfer") == 0) | |||
if (strcmp(method, "lv2_event_transfer") == 0) | |||
return handleMsgLv2TransferEvent(argc, argv, types); | |||
#endif | |||
#if 0 | |||
// TODO | |||
else if (strcmp(method, "set_parameter_midi_channel") == 0) | |||
return osc_set_parameter_midi_channel_handler(argv); | |||
else if (strcmp(method, "set_parameter_midi_cc") == 0) | |||
return osc_set_parameter_midi_channel_handler(argv); | |||
#endif | |||
qWarning("CarlaBridgeOsc::handleMessage(\"%s\", ...) - got unsupported OSC method '%s'", path, method); | |||
qWarning("CarlaBridgeOsc::handleMessage(\"%s\", ...) - received unsupported OSC method '%s'", path, method); | |||
return 1; | |||
} | |||
@@ -1,5 +1,5 @@ | |||
/* | |||
* Carla bridge code | |||
* Carla Bridge OSC | |||
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or modify | |||
@@ -15,8 +15,8 @@ | |||
* For a full copy of the GNU General Public License see the COPYING file | |||
*/ | |||
#ifndef CARLA_BRIDGE_OSC_H | |||
#define CARLA_BRIDGE_OSC_H | |||
#ifndef CARLA_BRIDGE_OSC_HPP | |||
#define CARLA_BRIDGE_OSC_HPP | |||
#include "carla_bridge.hpp" | |||
#include "carla_osc_utils.hpp" | |||
@@ -48,24 +48,39 @@ | |||
CARLA_BRIDGE_START_NAMESPACE | |||
/*! | |||
* @defgroup CarlaBridgeOSC Carla Bridge OSC | |||
* | |||
* The Carla Bridge OSC. | |||
* @{ | |||
*/ | |||
#if 0 | |||
} // Fix editor indentation | |||
#endif | |||
class CarlaBridgeOsc | |||
{ | |||
public: | |||
CarlaBridgeOsc(CarlaClient* const client, const char* const name); | |||
CarlaBridgeOsc(CarlaBridgeClient* const client); | |||
~CarlaBridgeOsc(); | |||
bool init(const char* const url); | |||
void idle(); | |||
void close(); | |||
// ------------------------------------------------------------------- | |||
bool isControlRegistered() const | |||
{ | |||
return bool(m_controlData.target); | |||
} | |||
const CarlaOscData* getControlData() const | |||
{ | |||
return &m_controlData; | |||
} | |||
const char* getServerPath() const | |||
{ | |||
return m_serverPath; | |||
} | |||
// ------------------------------------------------------------------- | |||
protected: | |||
int handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg); | |||
int handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS); | |||
@@ -84,30 +99,36 @@ protected: | |||
// ------------------------------------------------------------------- | |||
private: | |||
CarlaClient* const client; | |||
protected: | |||
CarlaBridgeClient* const client; | |||
lo_server m_server; | |||
const char* m_serverPath; | |||
CarlaOscData m_controlData; | |||
// ------------------------------------------------------------------- | |||
private: | |||
char* m_name; | |||
size_t m_nameSize; | |||
lo_server m_server; | |||
char* m_serverPath; | |||
CarlaOscData m_controlData; | |||
// ------------------------------------------------------------------- | |||
static void osc_error_handler(const int num, const char* const msg, const char* const path) | |||
{ | |||
qWarning("CarlaBridgeOsc::osc_error_handler(%i, \"%s\", \"%s\")", num, msg, path); | |||
} | |||
static int osc_message_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg, void* const user_data) | |||
{ | |||
CARLA_ASSERT(user_data); | |||
CarlaBridgeOsc* const _this_ = (CarlaBridgeOsc*)user_data; | |||
return _this_->handleMessage(path, argc, argv, types, msg); | |||
if (CarlaBridgeOsc* const _this_ = (CarlaBridgeOsc*)user_data) | |||
return _this_->handleMessage(path, argc, argv, types, msg); | |||
return -1; | |||
} | |||
friend class CarlaClient; | |||
}; | |||
/**@}*/ | |||
CARLA_BRIDGE_END_NAMESPACE | |||
#endif // CARLA_BRIDGE_OSC_H | |||
#endif // CARLA_BRIDGE_OSC_HPP |
@@ -17,8 +17,8 @@ | |||
#include "carla_bridge_client.hpp" | |||
#ifdef BRIDGE_LV2_X11 | |||
# error X11 UI uses Qt4 | |||
#if defined(BRIDGE_COCOA) || defined(BRIDGE_HWND) || defined(BRIDGE_X11) | |||
# error Cocoa/HWND/X11 UI uses Qt | |||
#endif | |||
#include <gtk/gtk.h> | |||
@@ -28,14 +28,14 @@ CARLA_BRIDGE_START_NAMESPACE | |||
// ------------------------------------------------------------------------- | |||
class CarlaToolkitGtk2 : public CarlaToolkit | |||
class CarlaToolkitGtk : public CarlaToolkit | |||
{ | |||
public: | |||
CarlaToolkitGtk2(const char* const title) | |||
CarlaToolkitGtk(const char* const title) | |||
: CarlaToolkit(title), | |||
settings("Cadence", "Carla-Gtk2UIs") | |||
{ | |||
qDebug("CarlaToolkitGtk2::CarlaToolkitGtk2(%s)", title); | |||
qDebug("CarlaToolkitGtk::CarlaToolkitGtk(%s)", title); | |||
window = nullptr; | |||
@@ -43,14 +43,14 @@ public: | |||
lastWidth = lastHeight = 0; | |||
} | |||
~CarlaToolkitGtk2() | |||
~CarlaToolkitGtk() | |||
{ | |||
qDebug("CarlaToolkitGtk2::~CarlaToolkitGtk2()"); | |||
qDebug("CarlaToolkitGtk::~CarlaToolkitGtk()"); | |||
} | |||
void init() | |||
{ | |||
qDebug("CarlaToolkitGtk2::init()"); | |||
qDebug("CarlaToolkitGtk::init()"); | |||
static int argc = 0; | |||
static char** argv = { nullptr }; | |||
@@ -59,7 +59,7 @@ public: | |||
void exec(CarlaClient* const client, const bool showGui) | |||
{ | |||
qDebug("CarlaToolkitGtk2::exec(%p)", client); | |||
qDebug("CarlaToolkitGtk::exec(%p)", client); | |||
CARLA_ASSERT(client); | |||
m_client = client; | |||
@@ -101,7 +101,7 @@ public: | |||
void quit() | |||
{ | |||
qDebug("CarlaToolkitGtk2::quit()"); | |||
qDebug("CarlaToolkitGtk::quit()"); | |||
if (window) | |||
{ | |||
@@ -116,7 +116,7 @@ public: | |||
void show() | |||
{ | |||
qDebug("CarlaToolkitGtk2::show()"); | |||
qDebug("CarlaToolkitGtk::show()"); | |||
CARLA_ASSERT(window); | |||
if (window) | |||
@@ -125,16 +125,22 @@ public: | |||
void hide() | |||
{ | |||
qDebug("CarlaToolkitGtk2::hide()"); | |||
qDebug("CarlaToolkitGtk::hide()"); | |||
CARLA_ASSERT(window); | |||
if (window) | |||
{ | |||
#ifdef BRIDGE_GTK2 | |||
gtk_widget_hide_all(window); | |||
#else | |||
gtk_widget_hide(window); | |||
#endif | |||
} | |||
} | |||
void resize(int width, int height) | |||
{ | |||
qDebug("CarlaToolkitGtk2::resize(%i, %i)", width, height); | |||
qDebug("CarlaToolkitGtk::resize(%i, %i)", width, height); | |||
CARLA_ASSERT(window); | |||
if (window) | |||
@@ -146,7 +152,7 @@ public: | |||
protected: | |||
void handleDestroy() | |||
{ | |||
qDebug("CarlaToolkitGtk2::handleDestroy()"); | |||
qDebug("CarlaToolkitGtk::handleDestroy()"); | |||
window = nullptr; | |||
m_client = nullptr; | |||
@@ -179,7 +185,7 @@ private: | |||
static void gtk_ui_destroy(GtkWidget*, gpointer data) | |||
{ | |||
CarlaToolkitGtk2* const _this_ = (CarlaToolkitGtk2*)data; | |||
CarlaToolkitGtk* const _this_ = (CarlaToolkitGtk*)data; | |||
_this_->handleDestroy(); | |||
gtk_main_quit(); | |||
@@ -187,7 +193,7 @@ private: | |||
static gboolean gtk_ui_timeout(gpointer data) | |||
{ | |||
CarlaToolkitGtk2* const _this_ = (CarlaToolkitGtk2*)data; | |||
CarlaToolkitGtk* const _this_ = (CarlaToolkitGtk*)data; | |||
return _this_->handleTimeout(); | |||
} | |||
}; | |||
@@ -196,7 +202,7 @@ private: | |||
CarlaToolkit* CarlaToolkit::createNew(const char* const title) | |||
{ | |||
return new CarlaToolkitGtk2(title); | |||
return new CarlaToolkitGtk(title); | |||
} | |||
CARLA_BRIDGE_END_NAMESPACE |
@@ -1,202 +0,0 @@ | |||
/* | |||
* Carla UI bridge code | |||
* Copyright (C) 2011-2012 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 COPYING file | |||
*/ | |||
#include "carla_bridge_client.hpp" | |||
#ifdef BRIDGE_LV2_X11 | |||
# error X11 UI uses Qt4 | |||
#endif | |||
#include <gtk/gtk.h> | |||
#include <QtCore/QSettings> | |||
CARLA_BRIDGE_START_NAMESPACE | |||
// ------------------------------------------------------------------------- | |||
class CarlaToolkitGtk3 : public CarlaToolkit | |||
{ | |||
public: | |||
CarlaToolkitGtk3(const char* const title) | |||
: CarlaToolkit(title), | |||
settings("Cadence", "Carla-Gtk3UIs") | |||
{ | |||
qDebug("CarlaToolkitGtk3::CarlaToolkitGtk3(%s)", title); | |||
window = nullptr; | |||
lastX = lastY = 0; | |||
lastWidth = lastHeight = 0; | |||
} | |||
~CarlaToolkitGtk3() | |||
{ | |||
qDebug("CarlaToolkitGtk3::~CarlaToolkitGtk3()"); | |||
} | |||
void init() | |||
{ | |||
qDebug("CarlaToolkitGtk3::init()"); | |||
static int argc = 0; | |||
static char** argv = { nullptr }; | |||
gtk_init(&argc, &argv); | |||
} | |||
void exec(CarlaClient* const client, const bool showGui) | |||
{ | |||
qDebug("CarlaToolkitGtk3::exec(%p)", client); | |||
CARLA_ASSERT(client); | |||
m_client = client; | |||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |||
gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)client->getWidget()); | |||
gtk_window_set_resizable(GTK_WINDOW(window), client->isResizable()); | |||
gtk_window_set_title(GTK_WINDOW(window), m_title); | |||
gtk_window_get_position(GTK_WINDOW(window), &lastX, &lastY); | |||
gtk_window_get_size(GTK_WINDOW(window), &lastWidth, &lastHeight); | |||
if (settings.contains(QString("%1/pos_x").arg(m_title))) | |||
{ | |||
lastX = settings.value(QString("%1/pos_x").arg(m_title), lastX).toInt(); | |||
lastY = settings.value(QString("%1/pos_y").arg(m_title), lastY).toInt(); | |||
gtk_window_move(GTK_WINDOW(window), lastX, lastY); | |||
if (client->isResizable()) | |||
{ | |||
lastWidth = settings.value(QString("%1/width").arg(m_title), lastWidth).toInt(); | |||
lastHeight = settings.value(QString("%1/height").arg(m_title), lastHeight).toInt(); | |||
gtk_window_resize(GTK_WINDOW(window), lastWidth, lastHeight); | |||
} | |||
} | |||
g_timeout_add(50, gtk_ui_timeout, this); | |||
g_signal_connect(window, "destroy", G_CALLBACK(gtk_ui_destroy), this); | |||
if (showGui) | |||
show(); | |||
else | |||
m_client->sendOscUpdate(); | |||
// Main loop | |||
gtk_main(); | |||
} | |||
void quit() | |||
{ | |||
qDebug("CarlaToolkitGtk3::quit()"); | |||
if (window) | |||
{ | |||
gtk_widget_destroy(window); | |||
gtk_main_quit(); | |||
window = nullptr; | |||
} | |||
m_client = nullptr; | |||
} | |||
void show() | |||
{ | |||
qDebug("CarlaToolkitGtk3::show()"); | |||
CARLA_ASSERT(window); | |||
if (window) | |||
gtk_widget_show_all(window); | |||
} | |||
void hide() | |||
{ | |||
qDebug("CarlaToolkitGtk3::hide()"); | |||
CARLA_ASSERT(window); | |||
if (window) | |||
gtk_widget_hide(window); | |||
} | |||
void resize(int width, int height) | |||
{ | |||
qDebug("CarlaToolkitGtk3::resize(%i, %i)", width, height); | |||
CARLA_ASSERT(window); | |||
if (window) | |||
gtk_window_resize(GTK_WINDOW(window), width, height); | |||
} | |||
// --------------------------------------------------------------------- | |||
protected: | |||
void handleDestroy() | |||
{ | |||
qDebug("CarlaToolkitGtk3::handleDestroy()"); | |||
window = nullptr; | |||
m_client = nullptr; | |||
settings.setValue(QString("%1/pos_x").arg(m_title), lastX); | |||
settings.setValue(QString("%1/pos_y").arg(m_title), lastY); | |||
settings.setValue(QString("%1/width").arg(m_title), lastWidth); | |||
settings.setValue(QString("%1/height").arg(m_title), lastHeight); | |||
settings.sync(); | |||
} | |||
gboolean handleTimeout() | |||
{ | |||
if (window) | |||
{ | |||
gtk_window_get_position(GTK_WINDOW(window), &lastX, &lastY); | |||
gtk_window_get_size(GTK_WINDOW(window), &lastWidth, &lastHeight); | |||
} | |||
return m_client ? m_client->oscIdle() : false; | |||
} | |||
// --------------------------------------------------------------------- | |||
private: | |||
GtkWidget* window; | |||
QSettings settings; | |||
gint lastX, lastY, lastWidth, lastHeight; | |||
static void gtk_ui_destroy(GtkWidget*, gpointer data) | |||
{ | |||
CarlaToolkitGtk3* const _this_ = (CarlaToolkitGtk3*)data; | |||
_this_->handleDestroy(); | |||
gtk_main_quit(); | |||
} | |||
static gboolean gtk_ui_timeout(gpointer data) | |||
{ | |||
CarlaToolkitGtk3* const _this_ = (CarlaToolkitGtk3*)data; | |||
return _this_->handleTimeout(); | |||
} | |||
}; | |||
// ------------------------------------------------------------------------- | |||
CarlaToolkit* CarlaToolkit::createNew(const char* const title) | |||
{ | |||
return new CarlaToolkitGtk3(title); | |||
} | |||
CARLA_BRIDGE_END_NAMESPACE |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Carla UI bridge code | |||
* Carla Bridge Toolkit, Qt version | |||
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or modify | |||
@@ -16,126 +16,127 @@ | |||
*/ | |||
#include "carla_bridge_client.hpp" | |||
#include "carla_bridge_toolkit.hpp" | |||
#include <QtCore/QSettings> | |||
#include <QtCore/QTimer> | |||
#include <QtCore/QThread> | |||
#include <QtCore/QTimerEvent> | |||
#ifdef BRIDGE_LV2_QT5 | |||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |||
# include <QtWidgets/QApplication> | |||
# include <QtWidgets/QMainWindow> | |||
# include <QtWidgets/QVBoxLayout> | |||
# ifdef Q_WS_X11 | |||
# undef Q_WS_X11 | |||
# endif | |||
#else | |||
# include <QtGui/QApplication> | |||
# include <QtGui/QMainWindow> | |||
# include <QtGui/QVBoxLayout> | |||
# ifdef Q_WS_X11 | |||
# include <QtGui/QX11EmbedContainer> | |||
# endif | |||
#endif | |||
#ifdef Q_WS_X11 | |||
# include <QtGui/QX11EmbedContainer> | |||
#if defined(BRIDGE_COCOA) || defined(BRIDGE_HWND) || defined(BRIDGE_X11) | |||
# define BRIDGE_CONTAINER | |||
# ifdef Q_WS_X11 | |||
typedef QX11EmbedContainer QEmbedContainer; | |||
# else | |||
typedef QWidget QEmbedContainer; | |||
# endif | |||
#endif | |||
CARLA_BRIDGE_START_NAMESPACE | |||
static int qargc = 0; | |||
static char* qargv[0] = {}; | |||
class BridgeApplication : public QApplication | |||
{ | |||
public: | |||
BridgeApplication() | |||
: QApplication(qargc, qargv, true) | |||
{ | |||
msgTimer = 0; | |||
m_client = nullptr; | |||
} | |||
void exec(CarlaClient* const client) | |||
{ | |||
m_client = client; | |||
msgTimer = startTimer(50); | |||
QApplication::exec(); | |||
} | |||
protected: | |||
void timerEvent(QTimerEvent* const event) | |||
{ | |||
if (event->timerId() == msgTimer) | |||
{ | |||
if (m_client && ! m_client->oscIdle()) | |||
killTimer(msgTimer); | |||
} | |||
// ------------------------------------------------------------------------- | |||
QApplication::timerEvent(event); | |||
} | |||
#if defined(BRIDGE_QT4) | |||
static const char* const appName = "Carla-Qt4UIs"; | |||
#elif defined(BRIDGE_QT5) | |||
static const char* const appName = "Carla-Qt5UIs"; | |||
#elif defined(BRIDGE_COCOA) | |||
static const char* const appName = "Carla-CocoaUIs"; | |||
#elif defined(BRIDGE_HWND) | |||
static const char* const appName = "Carla-HWNDUIs"; | |||
#elif defined(BRIDGE_X11) | |||
static const char* const appName = "Carla-X11UIs"; | |||
#else | |||
static const char* const appName = "Carla-UIs"; | |||
#endif | |||
private: | |||
int msgTimer; | |||
CarlaClient* m_client; | |||
}; | |||
static int qargc = 0; | |||
static char* qargv[0] = {}; | |||
// ------------------------------------------------------------------------- | |||
class CarlaToolkitQt: public CarlaToolkit | |||
class CarlaBridgeToolkitQt: public CarlaBridgeToolkit, | |||
public QObject | |||
{ | |||
public: | |||
CarlaToolkitQt(const char* const title) | |||
: CarlaToolkit(title), | |||
#if defined(BRIDGE_LV2_QT4) | |||
settings("Cadence", "Carla-Qt4UIs") | |||
#elif defined(BRIDGE_LV2_QT5) | |||
settings("Cadence", "Carla-Qt5UIs") | |||
#elif defined(BRIDGE_LV2_X11) || defined(BRIDGE_VST_X11) | |||
settings("Cadence", "Carla-X11UIs") | |||
#elif defined(BRIDGE_LV2_HWND) || defined(BRIDGE_VST_HWND) | |||
settings("Cadence", "Carla-HWNDUIs") | |||
#else | |||
settings("Cadence", "Carla-UIs") | |||
#endif | |||
CarlaBridgeToolkitQt(CarlaBridgeClient* const client, const char* const title) | |||
: CarlaBridgeToolkit(client, title), | |||
QObject(nullptr), | |||
settings("Cadence", appName) | |||
{ | |||
qDebug("CarlaToolkitQt::CarlaToolkitQ4(%s)", title); | |||
qDebug("CarlaBridgeToolkitQt::CarlaBridgeToolkitQt(\"%s\")", title); | |||
app = nullptr; | |||
window = nullptr; | |||
#ifdef Q_WS_X11 | |||
x11Container = nullptr; | |||
msgTimer = 0; | |||
needsResize = false; | |||
nextWidth = 0; | |||
nextHeight = 0; | |||
#ifdef BRIDGE_CONTAINER | |||
embedContainer = nullptr; | |||
#endif | |||
} | |||
~CarlaToolkitQt() | |||
~CarlaBridgeToolkitQt() | |||
{ | |||
qDebug("CarlaToolkitQt::~CarlaToolkitQt()"); | |||
qDebug("CarlaBridgeToolkitQt::~CarlaBridgeToolkitQt()"); | |||
CARLA_ASSERT(! app); | |||
CARLA_ASSERT(! msgTimer); | |||
if (window) | |||
{ | |||
window->close(); | |||
delete window; | |||
} | |||
#ifdef BRIDGE_CONTAINER | |||
// TESTING | |||
if (embedContainer) | |||
{ | |||
embedContainer->close(); | |||
delete embedContainer; | |||
} | |||
#endif | |||
} | |||
void init() | |||
{ | |||
qDebug("CarlaToolkitQt::init()"); | |||
qDebug("CarlaBridgeToolkitQt::init()"); | |||
CARLA_ASSERT(! app); | |||
CARLA_ASSERT(! window); | |||
CARLA_ASSERT(! msgTimer); | |||
app = new BridgeApplication; | |||
app = new QApplication(qargc, qargv); | |||
window = new QMainWindow(nullptr); | |||
window->resize(10, 10); | |||
window->resize(30, 30); | |||
window->hide(); | |||
} | |||
void exec(CarlaClient* const client, const bool showGui) | |||
void exec(const bool showGui) | |||
{ | |||
qDebug("CarlaToolkitQt::exec(%p)", client); | |||
qDebug("CarlaBridgeToolkitQt::exec(%s)", bool2str(showGui)); | |||
CARLA_ASSERT(app); | |||
CARLA_ASSERT(window); | |||
CARLA_ASSERT(client); | |||
#ifndef BRIDGE_LV2_X11 | |||
#if defined(BRIDGE_QT4) || defined(BRIDGE_QT5) | |||
QWidget* const widget = (QWidget*)client->getWidget(); | |||
window->setCentralWidget(widget); | |||
@@ -146,46 +147,66 @@ public: | |||
#endif | |||
if (! client->isResizable()) | |||
{ | |||
window->setFixedSize(window->width(), window->height()); | |||
#ifdef Q_OS_WIN | |||
window->setWindowFlags(window->windowFlags() | Qt::MSWindowsFixedSizeDialogHint); | |||
#endif | |||
} | |||
window->setWindowTitle(m_title); | |||
window->setWindowTitle(title); | |||
if (settings.contains(QString("%1/pos_x").arg(m_title))) | |||
if (settings.contains(QString("%1/pos_x").arg(title))) | |||
{ | |||
int posX = settings.value(QString("%1/pos_x").arg(m_title), window->x()).toInt(); | |||
int posY = settings.value(QString("%1/pos_y").arg(m_title), window->y()).toInt(); | |||
window->move(posX, posY); | |||
bool hasX, hasY; | |||
int posX = settings.value(QString("%1/pos_x").arg(title), window->x()).toInt(&hasX); | |||
int posY = settings.value(QString("%1/pos_y").arg(title), window->y()).toInt(&hasY); | |||
if (hasX && hasY) | |||
window->move(posX, posY); | |||
if (client->isResizable()) | |||
{ | |||
int width = settings.value(QString("%1/width").arg(m_title), window->width()).toInt(); | |||
int height = settings.value(QString("%1/height").arg(m_title), window->height()).toInt(); | |||
window->resize(width, height); | |||
bool hasWidth, hasHeight; | |||
int width = settings.value(QString("%1/width").arg(title), window->width()).toInt(&hasWidth); | |||
int height = settings.value(QString("%1/height").arg(title), window->height()).toInt(&hasHeight); | |||
if (hasWidth && hasHeight) | |||
window->resize(width, height); | |||
} | |||
} | |||
if (showGui) | |||
show(); | |||
else | |||
m_client->sendOscUpdate(); | |||
client->sendOscUpdate(); | |||
// Timer | |||
msgTimer = startTimer(50); | |||
// Main loop | |||
app->exec(client); | |||
app->exec(); | |||
} | |||
void quit() | |||
{ | |||
qDebug("CarlaToolkitQt::quit()"); | |||
qDebug("CarlaBridgeToolkitQt::quit()"); | |||
CARLA_ASSERT(app); | |||
if (msgTimer != 0) | |||
{ | |||
killTimer(msgTimer); | |||
msgTimer = 0; | |||
} | |||
if (window) | |||
{ | |||
if (m_client) | |||
if (client) | |||
{ | |||
settings.setValue(QString("%1/pos_x").arg(m_title), window->x()); | |||
settings.setValue(QString("%1/pos_y").arg(m_title), window->y()); | |||
settings.setValue(QString("%1/width").arg(m_title), window->width()); | |||
settings.setValue(QString("%1/height").arg(m_title), window->height()); | |||
settings.setValue(QString("%1/pos_x").arg(title), window->x()); | |||
settings.setValue(QString("%1/pos_y").arg(title), window->y()); | |||
settings.setValue(QString("%1/width").arg(title), window->width()); | |||
settings.setValue(QString("%1/height").arg(title), window->height()); | |||
settings.sync(); | |||
} | |||
@@ -195,8 +216,6 @@ public: | |||
window = nullptr; | |||
} | |||
m_client = nullptr; | |||
if (app) | |||
{ | |||
if (! app->closingDown()) | |||
@@ -209,7 +228,7 @@ public: | |||
void show() | |||
{ | |||
qDebug("CarlaToolkitQt::show()"); | |||
qDebug("CarlaBridgeToolkitQt::show()"); | |||
CARLA_ASSERT(window); | |||
if (window) | |||
@@ -218,62 +237,95 @@ public: | |||
void hide() | |||
{ | |||
qDebug("CarlaToolkitQt::hide()"); | |||
qDebug("CarlaBridgeToolkitQt::hide()"); | |||
CARLA_ASSERT(window); | |||
if (window) | |||
window->hide(); | |||
} | |||
void resize(int width, int height) | |||
void resize(const int width, const int height) | |||
{ | |||
qDebug("CarlaToolkitQt::resize(%i, %i)", width, height); | |||
qDebug("CarlaBridgeToolkitQt::resize(%i, %i)", width, height); | |||
CARLA_ASSERT(window); | |||
if (app->thread() != QThread::currentThread()) | |||
{ | |||
nextWidth = width; | |||
nextHeight = height; | |||
needsResize = true; | |||
return; | |||
} | |||
if (window) | |||
window->setFixedSize(width, height); | |||
#ifdef BRIDGE_LV2_X11 | |||
if (x11Container) | |||
x11Container->setFixedSize(width, height); | |||
#ifdef BRIDGE_CONTAINER | |||
if (embedContainer) | |||
embedContainer->setFixedSize(width, height); | |||
#endif | |||
} | |||
#ifdef BRIDGE_CONTAINER | |||
void* getContainerId() | |||
{ | |||
#ifdef Q_WS_X11 | |||
if (! x11Container) | |||
qDebug("CarlaBridgeToolkitQt::getContainerId()"); | |||
CARLA_ASSERT(window); | |||
if (! embedContainer) | |||
{ | |||
x11Container = new QX11EmbedContainer(window); | |||
embedContainer = new QEmbedContainer(window); | |||
window->setCentralWidget(x11Container); | |||
window->setCentralWidget(embedContainer); | |||
window->adjustSize(); | |||
x11Container->setParent(window); | |||
x11Container->show(); | |||
embedContainer->setParent(window); | |||
embedContainer->show(); | |||
} | |||
return (void*)x11Container->winId(); | |||
#else | |||
return nullptr; | |||
#endif | |||
return (void*)embedContainer->winId(); | |||
} | |||
#endif | |||
private: | |||
BridgeApplication* app; | |||
protected: | |||
QApplication* app; | |||
QMainWindow* window; | |||
QSettings settings; | |||
int msgTimer; | |||
#ifdef Q_WS_X11 | |||
QX11EmbedContainer* x11Container; | |||
bool needsResize; | |||
int nextWidth, nextHeight; | |||
#ifdef BRIDGE_CONTAINER | |||
QEmbedContainer* embedContainer; | |||
#endif | |||
void timerEvent(QTimerEvent* const event) | |||
{ | |||
if (event->timerId() == msgTimer && client) | |||
{ | |||
if (needsResize) | |||
{ | |||
client->toolkitResize(nextWidth, nextHeight); | |||
needsResize = false; | |||
} | |||
if (client->isOscControlRegistered() && ! client->oscIdle()) | |||
{ | |||
killTimer(msgTimer); | |||
msgTimer = 0; | |||
} | |||
} | |||
QObject::timerEvent(event); | |||
} | |||
}; | |||
// ------------------------------------------------------------------------- | |||
CarlaToolkit* CarlaToolkit::createNew(const char* const title) | |||
CarlaBridgeToolkit* CarlaBridgeToolkit::createNew(CarlaBridgeClient* const client, const char* const title) | |||
{ | |||
return new CarlaToolkitQt(title); | |||
return new CarlaBridgeToolkitQt(client, title); | |||
} | |||
CARLA_BRIDGE_END_NAMESPACE |
@@ -0,0 +1,50 @@ | |||
/* | |||
* Carla Bridge Toolkit | |||
* Copyright (C) 2011-2012 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 COPYING file | |||
*/ | |||
#include "carla_bridge_toolkit.hpp" | |||
#include "carla_utils.hpp" | |||
#include <cstdlib> | |||
#include <cstring> | |||
CARLA_BRIDGE_START_NAMESPACE | |||
CarlaBridgeToolkit::CarlaBridgeToolkit(CarlaBridgeClient* const client_, const char* const newTitle) | |||
: client(client_) | |||
{ | |||
qDebug("CarlaBridgeToolkit::CarlaBridgeToolkit(\"%s\")", newTitle); | |||
CARLA_ASSERT(newTitle); | |||
title = strdup(newTitle ? newTitle : "(null)"); | |||
} | |||
CarlaBridgeToolkit::~CarlaBridgeToolkit() | |||
{ | |||
qDebug("CarlaBridgeToolkit::~CarlaBridgeToolkit()"); | |||
free(title); | |||
} | |||
#if BUILD_BRIDGE_UI | |||
void* CarlaBridgeToolkit::getContainerId() | |||
{ | |||
qDebug("CarlaBridgeToolkit::getContainerId()"); | |||
return nullptr; | |||
} | |||
#endif | |||
CARLA_BRIDGE_END_NAMESPACE |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Carla bridge code | |||
* Carla Bridge Toolkit | |||
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or modify | |||
@@ -15,16 +15,17 @@ | |||
* For a full copy of the GNU General Public License see the COPYING file | |||
*/ | |||
#ifndef CARLA_BRIDGE_TOOLKIT_H | |||
#define CARLA_BRIDGE_TOOLKIT_H | |||
#ifndef CARLA_BRIDGE_TOOLKIT_HPP | |||
#define CARLA_BRIDGE_TOOLKIT_HPP | |||
#include "carla_bridge.hpp" | |||
#include <cstdlib> | |||
#include <cstring> | |||
CARLA_BRIDGE_START_NAMESPACE | |||
#if 0 | |||
} // Fix editor indentation | |||
#endif | |||
/*! | |||
* @defgroup CarlaBridgeToolkit Carla Bridge Toolkit | |||
* | |||
@@ -32,48 +33,33 @@ CARLA_BRIDGE_START_NAMESPACE | |||
* @{ | |||
*/ | |||
class CarlaToolkit | |||
class CarlaBridgeToolkit | |||
{ | |||
public: | |||
CarlaToolkit(const char* const title) | |||
{ | |||
CARLA_ASSERT(title); | |||
m_title = strdup(title ? title : "(null)"); | |||
m_client = nullptr; | |||
} | |||
virtual ~CarlaToolkit() | |||
{ | |||
if (m_title) | |||
free(m_title); | |||
} | |||
CarlaBridgeToolkit(CarlaBridgeClient* const client, const char* const title); | |||
virtual ~CarlaBridgeToolkit(); | |||
virtual void init() = 0; | |||
virtual void exec(CarlaClient* const client, const bool showGui) = 0; | |||
virtual void exec(const bool showGui) = 0; | |||
virtual void quit() = 0; | |||
virtual void show() = 0; | |||
virtual void hide() = 0; | |||
virtual void resize(int width, int height) = 0; | |||
virtual void resize(const int width, const int height) = 0; | |||
#if BUILD_BRIDGE_UI | |||
virtual void* getContainerId() | |||
{ | |||
return nullptr; | |||
} | |||
virtual void* getContainerId(); | |||
static CarlaToolkit* createNew(const char* const title); | |||
static CarlaBridgeToolkit* createNew(CarlaBridgeClient* const client, const char* const title); | |||
#endif | |||
protected: | |||
char* m_title; | |||
CarlaClient* m_client; | |||
friend class CarlaClient; | |||
CarlaBridgeClient* const client; | |||
char* title; | |||
}; | |||
/**@}*/ | |||
CARLA_BRIDGE_END_NAMESPACE | |||
#endif // CARLA_BRIDGE_TOOLKIT_H | |||
#endif // CARLA_BRIDGE_TOOLKIT_HPP |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Carla UI bridge code | |||
* Carla Bridge UI, VST version | |||
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or modify | |||
@@ -18,13 +18,14 @@ | |||
#ifdef BRIDGE_VST | |||
#include "carla_bridge_client.hpp" | |||
#include "carla_bridge_toolkit.hpp" | |||
#include "carla_vst_utils.hpp" | |||
#include "carla_midi.h" | |||
#include <QtCore/QObject> | |||
#include <QtCore/QTimerEvent> | |||
#include <QtGui/QDialog> | |||
#ifdef Q_WS_X11 | |||
#if defined(Q_WS_X11) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) | |||
# include <QtGui/QX11Info> | |||
#endif | |||
@@ -36,11 +37,12 @@ CARLA_BRIDGE_START_NAMESPACE | |||
uint32_t bufferSize = 512; | |||
double sampleRate = 44100.0; | |||
class CarlaVstClient : public CarlaClient, QObject | |||
class CarlaVstClient : public CarlaBridgeClient, | |||
public QObject | |||
{ | |||
public: | |||
CarlaVstClient(CarlaToolkit* const toolkit) | |||
: CarlaClient(toolkit), | |||
CarlaVstClient(const char* const uiTitle) | |||
: CarlaBridgeClient(uiTitle), | |||
QObject(nullptr) | |||
{ | |||
effect = nullptr; | |||
@@ -65,24 +67,24 @@ public: | |||
// ----------------------------------------------------------------- | |||
// init | |||
CarlaClient::init(binary, nullptr); | |||
CarlaBridgeClient::init(binary, nullptr); | |||
// ----------------------------------------------------------------- | |||
// open DLL | |||
if (! libOpen(binary)) | |||
if (! uiLibOpen(binary)) | |||
{ | |||
qWarning("%s", libError()); | |||
qWarning("%s", uiLibError()); | |||
return false; | |||
} | |||
// ----------------------------------------------------------------- | |||
// get DLL main entry | |||
VST_Function vstFn = (VST_Function)libSymbol("VSTPluginMain"); | |||
VST_Function vstFn = (VST_Function)uiLibSymbol("VSTPluginMain"); | |||
if (! vstFn) | |||
vstFn = (VST_Function)libSymbol("main"); | |||
vstFn = (VST_Function)uiLibSymbol("main"); | |||
if (! vstFn) | |||
return false; | |||
@@ -105,7 +107,7 @@ public: | |||
#endif | |||
int32_t value = 0; | |||
#ifdef Q_WS_X11 | |||
#if defined(Q_WS_X11) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) | |||
value = (int64_t)QX11Info::display(); | |||
#endif | |||
@@ -119,8 +121,9 @@ public: | |||
if (effect->dispatcher(effect, effEditOpen, 0, value, getContainerId(), 0.0f) != 1) | |||
{ | |||
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f); | |||
return false; | |||
//effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f); | |||
//return false; | |||
qWarning("VST UI failed to open, trying to init anyway..."); | |||
} | |||
// ----------------------------------------------------------------- | |||
@@ -145,7 +148,7 @@ public: | |||
void close() | |||
{ | |||
CarlaClient::close(); | |||
CarlaBridgeClient::close(); | |||
if (effect) | |||
{ | |||
@@ -204,7 +207,9 @@ public: | |||
void handleAudioMasterAutomate(const uint32_t index, const float value) | |||
{ | |||
effect->setParameter(effect, index, value); | |||
sendOscControl(index, value); | |||
if (isOscControlRegistered()) | |||
sendOscControl(index, value); | |||
} | |||
intptr_t handleAudioMasterGetCurrentProcessLevel() | |||
@@ -214,6 +219,9 @@ public: | |||
intptr_t handleAudioMasterProcessEvents(const VstEvents* const vstEvents) | |||
{ | |||
if (isOscControlRegistered()) | |||
return 1; | |||
for (int32_t i=0; i < vstEvents->numEvents; i++) | |||
{ | |||
if (! vstEvents->events[i]) | |||
@@ -246,7 +254,8 @@ public: | |||
void handleAudioMasterUpdateDisplay() | |||
{ | |||
sendOscConfigure("reloadprograms", ""); | |||
if (isOscControlRegistered()) | |||
sendOscConfigure("reloadprograms", ""); | |||
} | |||
// --------------------------------------------------------------------- | |||
@@ -470,18 +479,12 @@ int main(int argc, char* argv[]) | |||
if (sampleRateStr) | |||
sampleRate = atof(sampleRateStr); | |||
// Init toolkit | |||
CarlaToolkit* const toolkit = CarlaToolkit::createNew(uiTitle); | |||
toolkit->init(); | |||
// Init VST-UI | |||
CarlaVstClient client(toolkit); | |||
// Init VST client | |||
CarlaVstClient client(uiTitle); | |||
// Init OSC | |||
if (useOsc && ! client.oscInit(oscUrl)) | |||
{ | |||
toolkit->quit(); | |||
delete toolkit; | |||
return -1; | |||
} | |||
@@ -490,7 +493,7 @@ int main(int argc, char* argv[]) | |||
if (client.init(binary, nullptr)) | |||
{ | |||
toolkit->exec(&client, !useOsc); | |||
client.toolkitExec(!useOsc); | |||
ret = 0; | |||
} | |||
else | |||
@@ -505,13 +508,9 @@ int main(int argc, char* argv[]) | |||
client.oscClose(); | |||
} | |||
// Close VST-UI | |||
// Close VST client | |||
client.close(); | |||
// Close toolkit | |||
toolkit->quit(); | |||
delete toolkit; | |||
return ret; | |||
} | |||
@@ -12,19 +12,19 @@ VERSION = 0.5.0 | |||
SOURCES = \ | |||
../carla_bridge_osc.cpp \ | |||
../carla_bridge_ui-lv2.cpp \ | |||
../carla_bridge_toolkit-gtk2.cpp | |||
../carla_bridge_toolkit-gtk.cpp | |||
HEADERS = \ | |||
../carla_bridge.h \ | |||
../carla_bridge_client.h \ | |||
../carla_bridge_osc.h \ | |||
../carla_bridge_toolkit.h \ | |||
../../carla-includes/carla_includes.h \ | |||
../../carla-includes/carla_lib_includes.h \ | |||
../../carla-includes/carla_osc_includes.h \ | |||
../../carla-includes/carla_lv2.h \ | |||
../carla_bridge.hpp \ | |||
../carla_bridge_client.hpp \ | |||
../carla_bridge_osc.hpp \ | |||
../carla_bridge_toolkit.hpp \ | |||
../../carla-includes/carla_defines.hpp \ | |||
../../carla-includes/carla_midi.h \ | |||
../../carla-includes/lv2_rdf.h | |||
../../carla-includes/lv2_rdf.hpp \ | |||
../../carla-utils/carla_lib_utils.hpp \ | |||
../../carla-utils/carla_osc_utils.hpp \ | |||
../../carla-utils/carla_lv2_utils.hpp | |||
INCLUDEPATH = .. \ | |||
../../carla-includes | |||
@@ -12,19 +12,19 @@ VERSION = 0.5.0 | |||
SOURCES = \ | |||
../carla_bridge_osc.cpp \ | |||
../carla_bridge_ui-lv2.cpp \ | |||
../carla_bridge_toolkit-gtk3.cpp | |||
../carla_bridge_toolkit-gtk.cpp | |||
HEADERS = \ | |||
../carla_bridge.h \ | |||
../carla_bridge_client.h \ | |||
../carla_bridge_osc.h \ | |||
../carla_bridge_toolkit.h \ | |||
../../carla-includes/carla_includes.h \ | |||
../../carla-includes/carla_lib_includes.h \ | |||
../../carla-includes/carla_osc_includes.h \ | |||
../../carla-includes/carla_lv2.h \ | |||
../carla_bridge.hpp \ | |||
../carla_bridge_client.hpp \ | |||
../carla_bridge_osc.hpp \ | |||
../carla_bridge_toolkit.hpp \ | |||
../../carla-includes/carla_defines.hpp \ | |||
../../carla-includes/carla_midi.h \ | |||
../../carla-includes/lv2_rdf.h | |||
../../carla-includes/lv2_rdf.hpp \ | |||
../../carla-utils/carla_lib_utils.hpp \ | |||
../../carla-utils/carla_osc_utils.hpp \ | |||
../../carla-utils/carla_lv2_utils.hpp | |||
INCLUDEPATH = .. \ | |||
../../carla-includes | |||
@@ -12,19 +12,19 @@ VERSION = 0.5.0 | |||
SOURCES = \ | |||
../carla_bridge_osc.cpp \ | |||
../carla_bridge_ui-lv2.cpp \ | |||
../carla_bridge_toolkit-qt4.cpp | |||
../carla_bridge_toolkit-qt.cpp | |||
HEADERS = \ | |||
../carla_bridge.h \ | |||
../carla_bridge_client.h \ | |||
../carla_bridge_osc.h \ | |||
../carla_bridge_toolkit.h \ | |||
../../carla-includes/carla_includes.h \ | |||
../../carla-includes/carla_lib_includes.h \ | |||
../../carla-includes/carla_osc_includes.h \ | |||
../../carla-includes/carla_lv2.h \ | |||
../carla_bridge.hpp \ | |||
../carla_bridge_client.hpp \ | |||
../carla_bridge_osc.hpp \ | |||
../carla_bridge_toolkit.hpp \ | |||
../../carla-includes/carla_defines.hpp \ | |||
../../carla-includes/carla_midi.h \ | |||
../../carla-includes/lv2_rdf.h | |||
../../carla-includes/lv2_rdf.hpp \ | |||
../../carla-utils/carla_lib_utils.hpp \ | |||
../../carla-utils/carla_osc_utils.hpp \ | |||
../../carla-utils/carla_lv2_utils.hpp | |||
INCLUDEPATH = .. \ | |||
../../carla-includes | |||
@@ -0,0 +1,41 @@ | |||
# QtCreator project file | |||
QT = core widgets | |||
CONFIG = debug link_pkgconfig qt warn_on | |||
PKGCONFIG = liblo | |||
TARGET = carla-bridge-lv2-qt5 | |||
TEMPLATE = app | |||
VERSION = 0.5.0 | |||
SOURCES = \ | |||
../carla_bridge_osc.cpp \ | |||
../carla_bridge_ui-lv2.cpp \ | |||
../carla_bridge_toolkit-qt.cpp | |||
HEADERS = \ | |||
../carla_bridge.hpp \ | |||
../carla_bridge_client.hpp \ | |||
../carla_bridge_osc.hpp \ | |||
../carla_bridge_toolkit.hpp \ | |||
../../carla-includes/carla_defines.hpp \ | |||
../../carla-includes/carla_midi.h \ | |||
../../carla-includes/lv2_rdf.hpp \ | |||
../../carla-utils/carla_lib_utils.hpp \ | |||
../../carla-utils/carla_osc_utils.hpp \ | |||
../../carla-utils/carla_lv2_utils.hpp | |||
INCLUDEPATH = .. \ | |||
../../carla-includes \ | |||
../../carla-utils | |||
LIBS = \ | |||
../../carla-lilv/carla_lilv.a \ | |||
../../carla-rtmempool/carla_rtmempool.a | |||
DEFINES = QTCREATOR_TEST | |||
DEFINES += DEBUG | |||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_QT5 | |||
QMAKE_CXXFLAGS *= -std=c++0x |
@@ -12,19 +12,19 @@ VERSION = 0.5.0 | |||
SOURCES = \ | |||
../carla_bridge_osc.cpp \ | |||
../carla_bridge_ui-lv2.cpp \ | |||
../carla_bridge_toolkit-qt4.cpp | |||
../carla_bridge_toolkit-qt.cpp | |||
HEADERS = \ | |||
../carla_bridge.h \ | |||
../carla_bridge_client.h \ | |||
../carla_bridge_osc.h \ | |||
../carla_bridge_toolkit.h \ | |||
../../carla-includes/carla_includes.h \ | |||
../../carla-includes/carla_lib_includes.h \ | |||
../../carla-includes/carla_osc_includes.h \ | |||
../../carla-includes/carla_lv2.h \ | |||
../carla_bridge.hpp \ | |||
../carla_bridge_client.hpp \ | |||
../carla_bridge_osc.hpp \ | |||
../carla_bridge_toolkit.hpp \ | |||
../../carla-includes/carla_defines.hpp \ | |||
../../carla-includes/carla_midi.h \ | |||
../../carla-includes/lv2_rdf.h | |||
../../carla-includes/lv2_rdf.hpp \ | |||
../../carla-utils/carla_lib_utils.hpp \ | |||
../../carla-utils/carla_osc_utils.hpp \ | |||
../../carla-utils/carla_lv2_utils.hpp | |||
INCLUDEPATH = .. \ | |||
../../carla-includes | |||
@@ -35,6 +35,6 @@ LIBS = \ | |||
DEFINES = QTCREATOR_TEST | |||
DEFINES += DEBUG | |||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_X11 | |||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_X11 BRIDGE_LV2_X11 | |||
QMAKE_CXXFLAGS *= -std=c++0x |
@@ -0,0 +1,81 @@ | |||
# QtCreator project file | |||
QT = core gui | |||
CONFIG = debug link_pkgconfig qt warn_on | |||
PKGCONFIG = jack liblo | |||
TARGET = carla-bridge-qtcreator | |||
TEMPLATE = app | |||
VERSION = 0.5.0 | |||
SOURCES = \ | |||
../carla_bridge_osc.cpp \ | |||
../carla_bridge_plugin.cpp | |||
SOURCES += \ | |||
../../carla-engine/carla_engine.cpp \ | |||
../../carla-engine/carla_engine_osc.cpp \ | |||
../../carla-engine/carla_engine_thread.cpp \ | |||
../../carla-engine/jack.cpp | |||
SOURCES += \ | |||
../../carla-plugin/carla_plugin.cpp \ | |||
../../carla-plugin/carla_plugin_thread.cpp \ | |||
../../carla-plugin/ladspa.cpp \ | |||
../../carla-plugin/dssi.cpp \ | |||
../../carla-plugin/lv2.cpp \ | |||
../../carla-plugin/vst.cpp | |||
HEADERS = \ | |||
../carla_bridge.hpp \ | |||
../carla_bridge_client.hpp \ | |||
../carla_bridge_osc.hpp \ | |||
../carla_bridge_toolkit.hpp \ | |||
HEADERS += \ | |||
../../carla-includes/carla_defines.hpp \ | |||
../../carla-includes/carla_midi.h \ | |||
../../carla-includes/ladspa_rdf.hpp \ | |||
../../carla-includes/lv2_rdf.hpp | |||
HEADERS += \ | |||
../../carla-backend/carla_backend.hpp \ | |||
../../carla-backend/carla_backend_utils.hpp | |||
HEADERS += \ | |||
../../carla-engine/carla_engine.hpp \ | |||
../../carla-engine/carla_engine_osc.hpp \ | |||
../../carla-engine/carla_engine_thread.hpp \ | |||
HEADERS += \ | |||
../../carla-plugin/carla_plugin.hpp \ | |||
../../carla-plugin/carla_plugin_thread.hpp | |||
HEADERS += \ | |||
../../carla-utils/carla_lib_utils.hpp \ | |||
../../carla-utils/carla_osc_utils.hpp \ | |||
../../carla-utils/carla_ladspa_utils.hpp \ | |||
../../carla-utils/carla_lv2_utils.hpp \ | |||
../../carla-utils/carla_vst_utils.hpp | |||
INCLUDEPATH = .. \ | |||
../../carla-backend \ | |||
../../carla-engine \ | |||
../../carla-includes \ | |||
../../carla-jackbridge \ | |||
../../carla-plugin \ | |||
../../carla-utils | |||
DEFINES = QTCREATOR_TEST | |||
DEFINES += DEBUG | |||
#DEFINES += VESTIGE_HEADER | |||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_PLUGIN | |||
DEFINES += CARLA_ENGINE_JACK | |||
DEFINES += WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST | |||
LIBS = -ldl \ | |||
../../carla-lilv/carla_lilv.a \ | |||
../../carla-rtmempool/carla_rtmempool.a | |||
QMAKE_CXXFLAGS *= -std=c++0x |
@@ -1,6 +1,10 @@ | |||
# QtCreator project file | |||
contains(QT_VERSION, ^5.*) { | |||
QT = core widgets | |||
} else { | |||
QT = core gui | |||
} | |||
CONFIG = debug link_pkgconfig qt warn_on | |||
PKGCONFIG = liblo | |||
@@ -10,26 +14,29 @@ TEMPLATE = app | |||
VERSION = 0.5.0 | |||
SOURCES = \ | |||
../carla_bridge_client.cpp \ | |||
../carla_bridge_osc.cpp \ | |||
../carla_bridge_ui-vst.cpp \ | |||
../carla_bridge_toolkit-qt4.cpp | |||
../carla_bridge_toolkit.cpp \ | |||
../carla_bridge_toolkit-qt.cpp \ | |||
../carla_bridge_ui-vst.cpp | |||
HEADERS = \ | |||
../carla_bridge.h \ | |||
../carla_bridge_client.h \ | |||
../carla_bridge_osc.h \ | |||
../carla_bridge_toolkit.h \ | |||
../../carla-includes/carla_includes.h \ | |||
../../carla-includes/carla_lib_includes.h \ | |||
../../carla-includes/carla_osc_includes.h \ | |||
../../carla-includes/carla_vst.h \ | |||
../../carla-includes/carla_midi.h | |||
../carla_bridge.hpp \ | |||
../carla_bridge_client.hpp \ | |||
../carla_bridge_osc.hpp \ | |||
../carla_bridge_toolkit.hpp \ | |||
../../carla-includes/carla_defines.hpp \ | |||
../../carla-includes/carla_midi.h \ | |||
../../carla-utils/carla_lib_utils.hpp \ | |||
../../carla-utils/carla_osc_utils.hpp \ | |||
../../carla-utils/carla_vst_utils.hpp | |||
INCLUDEPATH = .. \ | |||
../../carla-includes | |||
../../carla-includes \ | |||
../../carla-utils | |||
DEFINES = QTCREATOR_TEST | |||
DEFINES += DEBUG | |||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_VST BRIDGE_VST_X11 | |||
DEFINES += BUILD_BRIDGE BUILD_BRIDGE_UI BRIDGE_VST BRIDGE_X11 BRIDGE_VST_X11 | |||
QMAKE_CXXFLAGS *= -std=c++0x |
@@ -4293,7 +4293,7 @@ public: | |||
else if (iSuil >= 0) | |||
iFinal = iSuil; | |||
const bool isBridged = (iFinal == eQt4 || iFinal == eCocoa || iFinal == eHWND || iFinal == eX11 || iFinal == eGtk2 || iFinal == eGtk3); | |||
const bool isBridged = false; //(iFinal == eQt4 || iFinal == eCocoa || iFinal == eHWND || iFinal == eX11 || iFinal == eGtk2 || iFinal == eGtk3); | |||
#ifdef WANT_SUIL | |||
const bool isSuil = (iFinal == iSuil && !isBridged); | |||
#endif | |||