@@ -52,7 +52,9 @@ const unsigned int MAX_PARAMETERS = 200; //!< Default value for the maximum numb | |||||
* \see CarlaPlugin::hints() | * \see CarlaPlugin::hints() | ||||
* @{ | * @{ | ||||
*/ | */ | ||||
#ifndef BUILD_BRIDGE | |||||
const unsigned int PLUGIN_IS_BRIDGE = 0x001; //!< Plugin is a bridge (ie, BridgePlugin). This hint is required because "bridge" itself is not a plugin type. | const unsigned int PLUGIN_IS_BRIDGE = 0x001; //!< Plugin is a bridge (ie, BridgePlugin). This hint is required because "bridge" itself is not a plugin type. | ||||
#endif | |||||
const unsigned int PLUGIN_IS_SYNTH = 0x002; //!< Plugin is a synthesizer (produces sound). | const unsigned int PLUGIN_IS_SYNTH = 0x002; //!< Plugin is a synthesizer (produces sound). | ||||
const unsigned int PLUGIN_HAS_GUI = 0x004; //!< Plugin has its own custom GUI. | const unsigned int PLUGIN_HAS_GUI = 0x004; //!< Plugin has its own custom GUI. | ||||
const unsigned int PLUGIN_USES_CHUNKS = 0x008; //!< Plugin uses chunks to save internal data.\see CarlaPlugin::chunkData() | const unsigned int PLUGIN_USES_CHUNKS = 0x008; //!< Plugin uses chunks to save internal data.\see CarlaPlugin::chunkData() | ||||
@@ -405,6 +405,9 @@ doxygen: carla_bridge.doxygen | |||||
clean: | clean: | ||||
rm -f *.o *.dll *.so *.exe | rm -f *.o *.dll *.so *.exe | ||||
rm -f $(OBJS_POSIX32) | |||||
rm -f $(OBJS_POSIX64) | |||||
rm -f $(OBJS_WIN32) | |||||
rm -f $(OBJS_WIN64) | |||||
rm -f carla-bridge-lv2-gtk2 carla-bridge-lv2-gtk3 carla-bridge-lv2-qt4 carla-bridge-lv2-qt5 carla-bridge-lv2-x11 carla-bridge-vst-x11 | rm -f carla-bridge-lv2-gtk2 carla-bridge-lv2-gtk3 carla-bridge-lv2-qt4 carla-bridge-lv2-qt5 carla-bridge-lv2-x11 carla-bridge-vst-x11 | ||||
rm -f carla-bridge-posix32 carla-bridge-posix64 | rm -f carla-bridge-posix32 carla-bridge-posix64 | ||||
rm -f $(OBJS_POSIX32) $(OBJS_POSIX64) $(OBJS_WIN32) $(OBJS_WIN64) |
@@ -180,7 +180,7 @@ void CarlaBridgeClient::toolkitHide() | |||||
m_toolkit->hide(); | m_toolkit->hide(); | ||||
} | } | ||||
void CarlaBridgeClient::toolkitResize(int width, int height) | |||||
void CarlaBridgeClient::toolkitResize(const int width, const int height) | |||||
{ | { | ||||
qDebug("CarlaBridgeClient::toolkitResize(%i, %i)", width, height); | qDebug("CarlaBridgeClient::toolkitResize(%i, %i)", width, height); | ||||
@@ -282,12 +282,12 @@ void CarlaBridgeClient::sendOscLv2TransferEvent(const int32_t portIndex, const c | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
#ifdef BUILD_BRIDGE_UI | |||||
void* CarlaBridgeClient::getContainerId() | void* CarlaBridgeClient::getContainerId() | ||||
{ | { | ||||
return m_toolkit->getContainerId(); | return m_toolkit->getContainerId(); | ||||
} | } | ||||
#ifdef BUILD_BRIDGE_UI | |||||
bool CarlaBridgeClient::uiLibOpen(const char* const filename) | bool CarlaBridgeClient::uiLibOpen(const char* const filename) | ||||
{ | { | ||||
CARLA_ASSERT(! m_uiLib); | CARLA_ASSERT(! m_uiLib); | ||||
@@ -99,7 +99,7 @@ public: | |||||
void toolkitShow(); | void toolkitShow(); | ||||
void toolkitHide(); | void toolkitHide(); | ||||
void toolkitResize(int width, int height); | |||||
void toolkitResize(const int width, const int height); | |||||
void toolkitExec(const bool showGui); | void toolkitExec(const bool showGui); | ||||
void toolkitQuit(); | void toolkitQuit(); | ||||
@@ -120,8 +120,9 @@ protected: | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
#ifdef BUILD_BRIDGE_UI | |||||
void* getContainerId(); | void* getContainerId(); | ||||
#ifdef BUILD_BRIDGE_UI | |||||
bool uiLibOpen(const char* const filename); | bool uiLibOpen(const char* const filename); | ||||
bool uiLibClose(); | bool uiLibClose(); | ||||
void* uiLibSymbol(const char* const symbol); | void* uiLibSymbol(const char* const symbol); | ||||
@@ -21,7 +21,6 @@ | |||||
#include "carla_bridge_toolkit.hpp" | #include "carla_bridge_toolkit.hpp" | ||||
#include "carla_plugin.hpp" | #include "carla_plugin.hpp" | ||||
//#include <QtCore/QTimerEvent> | |||||
#include <QtCore/QDir> | #include <QtCore/QDir> | ||||
#include <QtCore/QFile> | #include <QtCore/QFile> | ||||
#include <QtCore/QTextStream> | #include <QtCore/QTextStream> | ||||
@@ -110,8 +109,9 @@ public: | |||||
app = nullptr; | app = nullptr; | ||||
gui = nullptr; | gui = nullptr; | ||||
m_hasUI = false; | |||||
m_uiQuit = false; | m_uiQuit = false; | ||||
m_uiShow = true; | |||||
m_uiShow = false; | |||||
init(); | init(); | ||||
} | } | ||||
@@ -119,8 +119,23 @@ public: | |||||
~CarlaBridgeToolkitPlugin() | ~CarlaBridgeToolkitPlugin() | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitPlugin::~CarlaBridgeToolkitPlugin()"); | qDebug("CarlaBridgeToolkitPlugin::~CarlaBridgeToolkitPlugin()"); | ||||
CARLA_ASSERT(! app); | |||||
CARLA_ASSERT(! gui); | |||||
if (gui) | |||||
{ | |||||
gui->close(); | |||||
delete gui; | |||||
gui = nullptr; | |||||
} | |||||
if (app) | |||||
{ | |||||
if (! app->closingDown()) | |||||
app->quit(); | |||||
delete app; | |||||
app = nullptr; | |||||
} | |||||
} | } | ||||
void init() | void init() | ||||
@@ -143,7 +158,7 @@ public: | |||||
if (showGui) | if (showGui) | ||||
{ | { | ||||
if (m_uiShow) | |||||
if (m_hasUI) | |||||
show(); | show(); | ||||
} | } | ||||
else | else | ||||
@@ -164,41 +179,12 @@ public: | |||||
qDebug("CarlaBridgeToolkitPlugin::quit()"); | qDebug("CarlaBridgeToolkitPlugin::quit()"); | ||||
CARLA_ASSERT(app); | CARLA_ASSERT(app); | ||||
if (gui) | |||||
{ | |||||
gui->close(); | |||||
delete gui; | |||||
gui = nullptr; | |||||
} | |||||
if (app) | |||||
{ | |||||
if (! app->closingDown()) | |||||
app->quit(); | |||||
delete app; | |||||
app = nullptr; | |||||
} | |||||
if (app && ! app->closingDown()) | |||||
app->quit(); | |||||
} | } | ||||
void show() | |||||
{ | |||||
qDebug("CarlaBridgeToolkitPlugin::show()"); | |||||
CARLA_ASSERT(gui); | |||||
if (gui && m_uiShow) | |||||
gui->setVisible(true); | |||||
} | |||||
void hide() | |||||
{ | |||||
qDebug("CarlaBridgeToolkitPlugin::hide()"); | |||||
CARLA_ASSERT(gui); | |||||
if (gui && m_uiShow) | |||||
gui->setVisible(false); | |||||
} | |||||
void show(); | |||||
void hide(); | |||||
void resize(const int width, const int height) | void resize(const int width, const int height) | ||||
{ | { | ||||
@@ -229,9 +215,10 @@ public: | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
void hasUI(const bool yesNo) | |||||
void setHasUI(const bool hasUI, const bool showUI) | |||||
{ | { | ||||
m_uiShow = yesNo; | |||||
m_hasUI = hasUI; | |||||
m_uiShow = showUI; | |||||
} | } | ||||
protected: | protected: | ||||
@@ -241,6 +228,7 @@ protected: | |||||
void guiClosedCallback(); | void guiClosedCallback(); | ||||
private: | private: | ||||
bool m_hasUI; | |||||
bool m_uiQuit; | bool m_uiQuit; | ||||
bool m_uiShow; | bool m_uiShow; | ||||
}; | }; | ||||
@@ -294,14 +282,25 @@ public: | |||||
plugin->getGuiInfo(&guiType, &guiResizable); | plugin->getGuiInfo(&guiType, &guiResizable); | ||||
CarlaBridgeToolkitPlugin* const plugToolkit = (CarlaBridgeToolkitPlugin*)m_toolkit; | CarlaBridgeToolkitPlugin* const plugToolkit = (CarlaBridgeToolkitPlugin*)m_toolkit; | ||||
plugToolkit->hasUI(guiType != CarlaBackend::GUI_NONE); | |||||
qWarning("----------------------------------------------------- trying..., %s", CarlaBackend::GuiType2Str(guiType)); | |||||
if (guiType == CarlaBackend::GUI_INTERNAL_QT4 || guiType == CarlaBackend::GUI_INTERNAL_COCOA || guiType == CarlaBackend::GUI_INTERNAL_HWND || guiType == CarlaBackend::GUI_INTERNAL_X11) | if (guiType == CarlaBackend::GUI_INTERNAL_QT4 || guiType == CarlaBackend::GUI_INTERNAL_COCOA || guiType == CarlaBackend::GUI_INTERNAL_HWND || guiType == CarlaBackend::GUI_INTERNAL_X11) | ||||
{ | |||||
plugin->setGuiContainer(plugToolkit->getContainer()); | plugin->setGuiContainer(plugToolkit->getContainer()); | ||||
plugToolkit->setHasUI(true, true); | |||||
} | |||||
else | |||||
{ | |||||
plugToolkit->setHasUI(guiType != CarlaBackend::GUI_NONE, false); | |||||
} | |||||
} | } | ||||
void quit() | void quit() | ||||
{ | { | ||||
engine = nullptr; | |||||
plugin = nullptr; | |||||
if (msgTimerGUI != 0) | if (msgTimerGUI != 0) | ||||
{ | { | ||||
killTimer(msgTimerGUI); | killTimer(msgTimerGUI); | ||||
@@ -345,6 +344,14 @@ public: | |||||
engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI, ""); | engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI, ""); | ||||
} | } | ||||
void showPluginGui(const bool yesNo) | |||||
{ | |||||
CARLA_ASSERT(plugin); | |||||
if (plugin) | |||||
plugin->showGui(yesNo); | |||||
} | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
static void callback(void* const ptr, CarlaBackend::CallbackType const action, const unsigned short, const int value1, const int value2, const double value3, const char* const valueStr) | static void callback(void* const ptr, CarlaBackend::CallbackType const action, const unsigned short, const int value1, const int value2, const double value3, const char* const valueStr) | ||||
@@ -570,8 +577,37 @@ protected: | |||||
// ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
void CarlaBridgeToolkitPlugin::show() | |||||
{ | |||||
qDebug("----------------------------------------------------------------------------------------------------------"); | |||||
qDebug("CarlaBridgeToolkitPlugin::show()"); | |||||
CARLA_ASSERT(gui); | |||||
CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; | |||||
plugClient->showPluginGui(true); | |||||
if (gui && m_uiShow) | |||||
gui->setVisible(true); | |||||
} | |||||
void CarlaBridgeToolkitPlugin::hide() | |||||
{ | |||||
qDebug("CarlaBridgeToolkitPlugin::hide()"); | |||||
CARLA_ASSERT(gui); | |||||
CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; | |||||
if (gui && m_uiShow) | |||||
gui->setVisible(false); | |||||
plugClient->showPluginGui(false); | |||||
} | |||||
void CarlaBridgeToolkitPlugin::guiClosedCallback() | void CarlaBridgeToolkitPlugin::guiClosedCallback() | ||||
{ | { | ||||
qDebug("CarlaBridgeToolkitPlugin::guiClosedCallback()"); | |||||
CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; | CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; | ||||
if (m_uiQuit) | if (m_uiQuit) | ||||
@@ -692,7 +728,13 @@ int main(int argc, char* argv[]) | |||||
engine->setCallback(client.callback, &client); | engine->setCallback(client.callback, &client); | ||||
client.setEngine(engine); | client.setEngine(engine); | ||||
if (! engine->init("")) | |||||
// Init engine | |||||
CarlaString engName(name ? name : label); | |||||
engName += " (master)"; | |||||
engName.toBasic(); | |||||
engName.truncate(engine->maxClientNameSize()); | |||||
if (! engine->init(engName)) | |||||
{ | { | ||||
if (const char* const lastError = engine->getLastError()) | if (const char* const lastError = engine->getLastError()) | ||||
{ | { | ||||
@@ -97,6 +97,7 @@ public: | |||||
{ | { | ||||
qDebug("CarlaBridgeToolkitQt::~CarlaBridgeToolkitQt()"); | qDebug("CarlaBridgeToolkitQt::~CarlaBridgeToolkitQt()"); | ||||
CARLA_ASSERT(! app); | CARLA_ASSERT(! app); | ||||
CARLA_ASSERT(! window); | |||||
CARLA_ASSERT(! msgTimer); | CARLA_ASSERT(! msgTimer); | ||||
} | } | ||||
@@ -568,6 +568,21 @@ public: | |||||
return false; | return false; | ||||
#else | #else | ||||
// open temp client to get initial buffer-size and sample-rate values | |||||
if (bufferSize == 0 || sampleRate == 0.0) | |||||
{ | |||||
m_client = jackbridge_client_open(clientName, JackNullOption, nullptr); | |||||
if (m_client) | |||||
{ | |||||
bufferSize = jackbridge_get_buffer_size(m_client); | |||||
sampleRate = jackbridge_get_sample_rate(m_client); | |||||
jackbridge_client_close(m_client); | |||||
m_client = nullptr; | |||||
} | |||||
} | |||||
name = clientName; | name = clientName; | ||||
name.toBasic(); | name.toBasic(); | ||||
@@ -1063,8 +1063,10 @@ void CarlaPlugin::updateOscData(const lo_address source, const char* const url) | |||||
free((void*)host); | free((void*)host); | ||||
free((void*)port); | free((void*)port); | ||||
#ifndef BUILD_BRIDGE | |||||
if (m_hints & PLUGIN_IS_BRIDGE) | if (m_hints & PLUGIN_IS_BRIDGE) | ||||
return; | return; | ||||
#endif | |||||
osc_send_sample_rate(&osc.data, x_engine->getSampleRate()); | osc_send_sample_rate(&osc.data, x_engine->getSampleRate()); | ||||
@@ -1581,6 +1583,7 @@ CarlaPluginGUI::~CarlaPluginGUI() | |||||
qDebug("CarlaPluginGUI::~CarlaPluginGUI()"); | qDebug("CarlaPluginGUI::~CarlaPluginGUI()"); | ||||
CARLA_ASSERT(m_container); | CARLA_ASSERT(m_container); | ||||
// FIXME, automatically deleted by parent ? | |||||
delete m_container; | delete m_container; | ||||
} | } | ||||
@@ -973,6 +973,8 @@ public: | |||||
void showGui(const bool yesNo) | void showGui(const bool yesNo) | ||||
{ | { | ||||
qDebug("Lv2Plugin::showGui(%s)", bool2str(yesNo)); | |||||
switch(gui.type) | switch(gui.type) | ||||
{ | { | ||||
case GUI_NONE: | case GUI_NONE: | ||||
@@ -4241,7 +4243,7 @@ public: | |||||
break; | break; | ||||
case LV2_UI_GTK2: | case LV2_UI_GTK2: | ||||
#ifdef WANT_SUIL | |||||
#if defined(WANT_SUIL) || defined(BUILD_BRIDGE) | |||||
if (isUiBridgeable(i) && preferUiBridges) | if (isUiBridgeable(i) && preferUiBridges) | ||||
eGtk2 = i; | eGtk2 = i; | ||||
#else | #else | ||||
@@ -4293,8 +4295,10 @@ public: | |||||
else if (iSuil >= 0) | else if (iSuil >= 0) | ||||
iFinal = iSuil; | iFinal = iSuil; | ||||
const bool isBridged = false; //(iFinal == eQt4 || iFinal == eCocoa || iFinal == eHWND || iFinal == eX11 || iFinal == eGtk2 || iFinal == eGtk3); | |||||
#ifdef WANT_SUIL | |||||
#ifndef WANT_SUIL | |||||
const bool isBridged = (iFinal == eQt4 || iFinal == eCocoa || iFinal == eHWND || iFinal == eX11 || iFinal == eGtk2 || iFinal == eGtk3); | |||||
#else | |||||
const bool isBridged = false; | |||||
const bool isSuil = (iFinal == iSuil && !isBridged); | const bool isSuil = (iFinal == iSuil && !isBridged); | ||||
#endif | #endif | ||||
@@ -1549,12 +1549,16 @@ public: | |||||
intptr_t handleAudioMasterGetBlockSize() | intptr_t handleAudioMasterGetBlockSize() | ||||
{ | { | ||||
return x_engine->getBufferSize(); | |||||
const uint32_t bufferSize = x_engine->getBufferSize(); | |||||
effect->dispatcher(effect, effSetBlockSize, 0, bufferSize, nullptr, 0.0f); | |||||
return bufferSize; | |||||
} | } | ||||
intptr_t handleAudioMasterGetSampleRate() | intptr_t handleAudioMasterGetSampleRate() | ||||
{ | { | ||||
return x_engine->getSampleRate(); | |||||
const double sampleRate = x_engine->getSampleRate(); | |||||
effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, sampleRate); | |||||
return sampleRate; | |||||
} | } | ||||
intptr_t handleAudioMasterGetTime() | intptr_t handleAudioMasterGetTime() | ||||