Browse Source

Carla: Make it possible to use DSSI UIs in plugin-bridge (part 1)

tags/v0.9.0
falkTX 12 years ago
parent
commit
edb8903f15
13 changed files with 133 additions and 137 deletions
  1. +29
    -9
      c++/carla-bridge/carla_bridge_plugin.cpp
  2. +19
    -16
      c++/carla-engine/carla_engine.cpp
  3. +12
    -51
      c++/carla-engine/carla_engine.hpp
  4. +28
    -10
      c++/carla-engine/carla_engine_osc.cpp
  5. +11
    -7
      c++/carla-engine/carla_engine_osc.hpp
  6. +10
    -8
      c++/carla-engine/carla_engine_thread.cpp
  7. +12
    -6
      c++/carla-plugin/carla_plugin.cpp
  8. +5
    -9
      c++/carla-plugin/carla_plugin.hpp
  9. +2
    -14
      c++/carla-plugin/dssi.cpp
  10. +1
    -1
      c++/carla-plugin/ladspa.cpp
  11. +1
    -3
      c++/carla-plugin/lv2.cpp
  12. +1
    -1
      c++/carla-plugin/vst.cpp
  13. +2
    -2
      c++/carla-utils/carla_osc_utils.hpp

+ 29
- 9
c++/carla-bridge/carla_bridge_plugin.cpp View File

@@ -226,8 +226,6 @@ public:
{ {
qDebug("BridgePluginClient::BridgePluginClient()"); qDebug("BridgePluginClient::BridgePluginClient()");


hasUI = false;

msgTimerGUI = 0; msgTimerGUI = 0;
msgTimerOSC = 0; msgTimerOSC = 0;


@@ -235,7 +233,9 @@ public:
plugin = nullptr; plugin = nullptr;
pluginGui = nullptr; pluginGui = nullptr;


m_client = this;
m_client = this;
m_hasUI = false;
m_doQuit = false;


m_needsResize = false; m_needsResize = false;
m_nextSize[0] = 0; m_nextSize[0] = 0;
@@ -277,8 +277,10 @@ public:


if (showGui) if (showGui)
{ {
if (hasUI)
if (m_hasUI)
show(); show();

m_doQuit = true;
} }
else else
{ {
@@ -368,7 +370,7 @@ public:
if (! (plugin && pluginGui)) if (! (plugin && pluginGui))
return; return;


hasUI = true;
m_hasUI = true;


pluginGui->setResizable(resizable); pluginGui->setResizable(resizable);
pluginGui->setTitle(plugin->name()); pluginGui->setTitle(plugin->name());
@@ -376,6 +378,11 @@ public:
plugin->setGuiContainer(pluginGui->getContainer()); plugin->setGuiContainer(pluginGui->getContainer());
} }


void enableUI()
{
m_hasUI = true;
}

// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// processing // processing


@@ -592,7 +599,12 @@ public:


case CarlaBackend::CALLBACK_SHOW_GUI: case CarlaBackend::CALLBACK_SHOW_GUI:
if (value1 == 0) if (value1 == 0)
{
engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI, ""); engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI, "");

if (m_doQuit)
qCloseNow = true;
}
break; break;


case CarlaBackend::CALLBACK_RESIZE_GUI: case CarlaBackend::CALLBACK_RESIZE_GUI:
@@ -692,12 +704,13 @@ protected:
// --------------------------------------------------------------------- // ---------------------------------------------------------------------


private: private:
bool hasUI;
int msgTimerGUI, msgTimerOSC; int msgTimerGUI, msgTimerOSC;
#if 0 #if 0
std::set<int32_t> parametersToUpdate; std::set<int32_t> parametersToUpdate;
#endif #endif


bool m_doQuit;
bool m_hasUI;
bool m_needsResize; bool m_needsResize;
int m_nextSize[2]; int m_nextSize[2];


@@ -786,8 +799,15 @@ int main(int argc, char* argv[])
return 2; return 2;
} }


void* extraStuff = nullptr;

#if 1 // TESTING
static const char* const dssiGUI = "/usr/lib/dssi/amsynth_dssi/amsynth_dssi_gtk";
extraStuff = (void*)dssiGUI;
#endif

// Init plugin // Init plugin
short id = engine->addPlugin(itype, filename, name, label);
short id = engine->addPlugin(itype, filename, name, label, extraStuff);
int ret; int ret;


if (id >= 0 && id < CarlaBackend::MAX_PLUGINS) if (id >= 0 && id < CarlaBackend::MAX_PLUGINS)
@@ -801,9 +821,9 @@ int main(int argc, char* argv[])
plugin->getGuiInfo(&guiType, &guiResizable); plugin->getGuiInfo(&guiType, &guiResizable);


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)
{
client.createWindow(guiResizable); client.createWindow(guiResizable);
}
else if (guiType == CarlaBackend::GUI_EXTERNAL_LV2 || guiType == CarlaBackend::GUI_EXTERNAL_OSC)
client.enableUI();


if (! useOsc) if (! useOsc)
plugin->setActive(true, false, false); plugin->setActive(true, false, false);


+ 19
- 16
c++/carla-engine/carla_engine.cpp View File

@@ -364,20 +364,15 @@ void CarlaEngineClient::setLatency(const uint32_t samples)
// Carla Engine Client // Carla Engine Client


CarlaEngine::CarlaEngine() CarlaEngine::CarlaEngine()
: m_thread(this),
#ifndef BUILD_BRIDGE
m_osc(this),
#endif
m_oscData(nullptr),
m_callback(nullptr),
: m_osc(this),
m_thread(this)
#ifdef Q_COMPILER_INITIALIZER_LISTS #ifdef Q_COMPILER_INITIALIZER_LISTS
,
m_callbackPtr(nullptr), m_callbackPtr(nullptr),
m_carlaPlugins{nullptr}, m_carlaPlugins{nullptr},
m_uniqueNames{nullptr}, m_uniqueNames{nullptr},
m_insPeak{0.0}, m_insPeak{0.0},
m_outsPeak{0.0} m_outsPeak{0.0}
#else
m_callbackPtr(nullptr)
#endif #endif
{ {
qDebug("CarlaEngine::CarlaEngine()"); qDebug("CarlaEngine::CarlaEngine()");
@@ -385,6 +380,10 @@ CarlaEngine::CarlaEngine()
bufferSize = 0; bufferSize = 0;
sampleRate = 0.0; sampleRate = 0.0;


m_oscData = nullptr;
m_callback = nullptr;
m_callbackPtr = nullptr;

m_aboutToClose = false; m_aboutToClose = false;
m_maxPluginNumber = 0; m_maxPluginNumber = 0;


@@ -512,8 +511,9 @@ bool CarlaEngine::init(const char* const clientName)


m_aboutToClose = false; m_aboutToClose = false;


#ifndef BUILD_BRIDGE
m_osc.init(clientName); m_osc.init(clientName);

#ifndef BUILD_BRIDGE
m_oscData = m_osc.getControlData(); m_oscData = m_osc.getControlData();


if (strcmp(clientName, "Carla") != 0) if (strcmp(clientName, "Carla") != 0)
@@ -534,10 +534,10 @@ bool CarlaEngine::close()


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
osc_send_control_exit(); osc_send_control_exit();
m_osc.close();
#endif #endif
m_oscData = nullptr;
m_osc.close();


m_oscData = nullptr;
m_maxPluginNumber = 0; m_maxPluginNumber = 0;


name.clear(); name.clear();
@@ -1200,16 +1200,18 @@ void CarlaEngine::midiUnlock()
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// OSC Stuff // OSC Stuff


bool CarlaEngine::isOscControlRegisted() const
{
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
bool CarlaEngine::isOscControlRegistered() const
{
return m_osc.isControlRegistered(); return m_osc.isControlRegistered();
}
#else #else
bool CarlaEngine::isOscBridgeRegistered() const
{
return bool(m_oscData); return bool(m_oscData);
#endif
} }
#endif


#ifndef BUILD_BRIDGE
bool CarlaEngine::idleOsc() bool CarlaEngine::idleOsc()
{ {
return m_osc.idle(); return m_osc.idle();
@@ -1224,7 +1226,8 @@ const char* CarlaEngine::getOscServerPathUDP() const
{ {
return m_osc.getServerPathUDP(); return m_osc.getServerPathUDP();
} }
#else

#ifdef BUILD_BRIDGE
void CarlaEngine::setOscBridgeData(const CarlaOscData* const oscData) void CarlaEngine::setOscBridgeData(const CarlaOscData* const oscData)
{ {
m_oscData = oscData; m_oscData = oscData;


+ 12
- 51
c++/carla-engine/carla_engine.hpp View File

@@ -18,20 +18,11 @@
#ifndef CARLA_ENGINE_HPP #ifndef CARLA_ENGINE_HPP
#define CARLA_ENGINE_HPP #define CARLA_ENGINE_HPP


#include "carla_engine_osc.hpp"
#include "carla_engine_thread.hpp" #include "carla_engine_thread.hpp"


#ifdef BUILD_BRIDGE
# include "carla_osc_utils.hpp"
#else
# include "carla_engine_osc.hpp"
#endif

CARLA_BACKEND_START_NAMESPACE CARLA_BACKEND_START_NAMESPACE


#ifdef BUILD_BRIDGE
class CarlaPlugin;
#endif

/*! /*!
* @defgroup CarlaBackendEngine Carla Backend Engine * @defgroup CarlaBackendEngine Carla Backend Engine
* *
@@ -735,41 +726,6 @@ public:
* Set the engine option \a option. * Set the engine option \a option.
*/ */
void setOption(const OptionsType option, const int value, const char* const valueStr); void setOption(const OptionsType option, const int value, const char* const valueStr);

// ProcessMode processMode() const
// {
// return options.processMode;
// }

// bool processHighPrecision() const
// {
// return options.processHighPrecision;
// }

// uint maxParameters() const
// {
// return options.maxParameters;
// }

// bool forceStereo() const
// {
// return options.forceStereo;
// }

// bool useDssiVstChunks() const
// {
// return options.useDssiVstChunks;
// }

// bool preferUiBridges() const
// {
// return options.preferUiBridges;
// }

// uint oscUiTimeout() const
// {
// return options.oscUiTimeout;
// }
#endif #endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -798,12 +754,18 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// OSC Stuff // OSC Stuff


#ifndef BUILD_BRIDGE
/*! /*!
* Check if OSC controller is registered. * Check if OSC controller is registered.
*/ */
bool isOscControlRegisted() const;
bool isOscControlRegistered() const;
#else
/*!
* Check if OSC bridge is registered.
*/
bool isOscBridgeRegistered() const;
#endif


#ifndef BUILD_BRIDGE
/*! /*!
* Idle OSC. * Idle OSC.
*/ */
@@ -818,7 +780,8 @@ public:
* Get OSC UDP server path. * Get OSC UDP server path.
*/ */
const char* getOscServerPathUDP() const; const char* getOscServerPathUDP() const;
#else

#ifdef BUILD_BRIDGE
/*! /*!
* Set OSC bridge data. * Set OSC bridge data.
*/ */
@@ -955,10 +918,8 @@ protected:
void bufferSizeChanged(const uint32_t newBufferSize); void bufferSizeChanged(const uint32_t newBufferSize);


private: private:
CarlaEngineThread m_thread;
#ifndef BUILD_BRIDGE
CarlaEngineOsc m_osc; CarlaEngineOsc m_osc;
#endif
CarlaEngineThread m_thread;


const CarlaOscData* m_oscData; const CarlaOscData* m_oscData;




+ 28
- 10
c++/carla-engine/carla_engine_osc.cpp View File

@@ -40,9 +40,11 @@ CarlaEngineOsc::CarlaEngineOsc(CarlaEngine* const engine_)


m_serverTCP = nullptr; m_serverTCP = nullptr;
m_serverUDP = nullptr; m_serverUDP = nullptr;
#ifndef BUILD_BRIDGE
m_controlData.path = nullptr; m_controlData.path = nullptr;
m_controlData.source = nullptr; m_controlData.source = nullptr;
m_controlData.target = nullptr; m_controlData.target = nullptr;
#endif


m_name = nullptr; m_name = nullptr;
m_nameSize = 0; m_nameSize = 0;
@@ -120,7 +122,9 @@ void CarlaEngineOsc::close()
CARLA_ASSERT(m_serverPathUDP.isNotEmpty()); CARLA_ASSERT(m_serverPathUDP.isNotEmpty());
CARLA_ASSERT(m_name); CARLA_ASSERT(m_name);


#ifndef BUILD_BRIDGE
m_controlData.free(); m_controlData.free();
#endif


if (m_serverTCP) if (m_serverTCP)
{ {
@@ -160,6 +164,7 @@ int CarlaEngineOsc::handleMessage(const char* const path, const int argc, const
if (! path) if (! path)
return 1; return 1;


#ifndef BUILD_BRIDGE
// Initial path check // Initial path check
if (strcmp(path, "/register") == 0) if (strcmp(path, "/register") == 0)
{ {
@@ -170,6 +175,7 @@ int CarlaEngineOsc::handleMessage(const char* const path, const int argc, const
{ {
return handleMsgUnregister(); return handleMsgUnregister();
} }
#endif


// Check if message is for this client // Check if message is for this client
if (strlen(path) <= m_nameSize || strncmp(path+1, m_name, m_nameSize) != 0) if (strlen(path) <= m_nameSize || strncmp(path+1, m_name, m_nameSize) != 0)
@@ -227,6 +233,7 @@ int CarlaEngineOsc::handleMessage(const char* const path, const int argc, const
if (strcmp(method, "/exiting") == 0) if (strcmp(method, "/exiting") == 0)
return handleMsgExiting(plugin); return handleMsgExiting(plugin);


#ifndef BUILD_BRIDGE
// Internal methods // Internal methods
if (strcmp(method, "/set_active") == 0) if (strcmp(method, "/set_active") == 0)
return handleMsgSetActive(plugin, argc, argv, types); return handleMsgSetActive(plugin, argc, argv, types);
@@ -253,14 +260,6 @@ int CarlaEngineOsc::handleMessage(const char* const path, const int argc, const
if (strcmp(method, "/note_off") == 0) if (strcmp(method, "/note_off") == 0)
return handleMsgNoteOff(plugin, argc, argv, types); return handleMsgNoteOff(plugin, argc, argv, types);


// Plugin-specific methods
#ifdef WANT_LV2
if (strcmp(method, "/lv2_atom_transfer") == 0)
return handleMsgLv2AtomTransfer(plugin, argc, argv, types);
if (strcmp(method, "/lv2_event_transfer") == 0)
return handleMsgLv2EventTransfer(plugin, argc, argv, types);
#endif

// Plugin Bridges // Plugin Bridges
if ((plugin->hints() & PLUGIN_IS_BRIDGE) > 0 && strlen(method) > 12 && strncmp(method, "/bridge_", 8) == 0) if ((plugin->hints() & PLUGIN_IS_BRIDGE) > 0 && strlen(method) > 12 && strncmp(method, "/bridge_", 8) == 0)
{ {
@@ -309,6 +308,15 @@ int CarlaEngineOsc::handleMessage(const char* const path, const int argc, const
if (strcmp(method+8, "error") == 0) if (strcmp(method+8, "error") == 0)
return plugin->setOscBridgeInfo(PluginBridgeError, argc, argv, types); return plugin->setOscBridgeInfo(PluginBridgeError, argc, argv, types);
} }
#endif

// Plugin-specific methods
#ifdef WANT_LV2
if (strcmp(method, "/lv2_atom_transfer") == 0)
return handleMsgLv2AtomTransfer(plugin, argc, argv, types);
if (strcmp(method, "/lv2_event_transfer") == 0)
return handleMsgLv2EventTransfer(plugin, argc, argv, types);
#endif


qWarning("CarlaEngineOsc::handleMessage() - unsupported OSC method '%s'", method); qWarning("CarlaEngineOsc::handleMessage() - unsupported OSC method '%s'", method);
return 1; return 1;
@@ -316,6 +324,7 @@ int CarlaEngineOsc::handleMessage(const char* const path, const int argc, const


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


#ifndef BUILD_BRIDGE
int CarlaEngineOsc::handleMsgRegister(const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source) int CarlaEngineOsc::handleMsgRegister(const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source)
{ {
qDebug("CarlaEngineOsc::handleMsgRegister()"); qDebug("CarlaEngineOsc::handleMsgRegister()");
@@ -369,6 +378,7 @@ int CarlaEngineOsc::handleMsgUnregister()
m_controlData.free(); m_controlData.free();
return 0; return 0;
} }
#endif


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


@@ -491,6 +501,7 @@ int CarlaEngineOsc::handleMsgExiting(CARLA_ENGINE_OSC_HANDLE_ARGS1)


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


#ifndef BUILD_BRIDGE
int CarlaEngineOsc::handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS2) int CarlaEngineOsc::handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS2)
{ {
qDebug("CarlaEngineOsc::handleMsgSetActive()"); qDebug("CarlaEngineOsc::handleMsgSetActive()");
@@ -590,11 +601,14 @@ int CarlaEngineOsc::handleMsgSetProgram(CARLA_ENGINE_OSC_HANDLE_ARGS2)
const int32_t index = argv[0]->i; const int32_t index = argv[0]->i;
plugin->setProgram(index, true, false, true, true); plugin->setProgram(index, true, false, true, true);


if (index >= 0)
#ifndef BUILD_BRIDGE
// parameters might have changed, send all param values back
if (m_controlData.target && index >= 0)
{ {
for (uint32_t i=0; i < plugin->parameterCount(); i++) for (uint32_t i=0; i < plugin->parameterCount(); i++)
engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i)); engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i));
} }
#endif


return 0; return 0;
} }
@@ -607,11 +621,14 @@ int CarlaEngineOsc::handleMsgSetMidiProgram(CARLA_ENGINE_OSC_HANDLE_ARGS2)
const int32_t index = argv[0]->i; const int32_t index = argv[0]->i;
plugin->setMidiProgram(index, true, false, true, true); plugin->setMidiProgram(index, true, false, true, true);


if (index >= 0)
#ifndef BUILD_BRIDGE
// parameters might have changed, send all param values back
if (m_controlData.target && index >= 0)
{ {
for (uint32_t i=0; i < plugin->parameterCount(); i++) for (uint32_t i=0; i < plugin->parameterCount(); i++)
engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i)); engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i));
} }
#endif


return 0; return 0;
} }
@@ -662,5 +679,6 @@ int CarlaEngineOsc::handleMsgBridgeSetOutPeak(CARLA_ENGINE_OSC_HANDLE_ARGS2)


return 0; return 0;
} }
#endif


CARLA_BACKEND_END_NAMESPACE CARLA_BACKEND_END_NAMESPACE

+ 11
- 7
c++/carla-engine/carla_engine_osc.hpp View File

@@ -18,10 +18,6 @@
#ifndef CARLA_ENGINE_OSC_HPP #ifndef CARLA_ENGINE_OSC_HPP
#define CARLA_ENGINE_OSC_HPP #define CARLA_ENGINE_OSC_HPP


#ifdef BUILD_BRIDGE
# error Bad use of file! This should never be used in bridge builds
#endif

#include "carla_backend.hpp" #include "carla_backend.hpp"
#include "carla_osc_utils.hpp" #include "carla_osc_utils.hpp"


@@ -69,6 +65,7 @@ public:


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


#ifndef BUILD_BRIDGE
bool isControlRegistered() const bool isControlRegistered() const
{ {
return bool(m_controlData.target); return bool(m_controlData.target);
@@ -78,6 +75,7 @@ public:
{ {
return &m_controlData; return &m_controlData;
} }
#endif


const char* getServerPathTCP() const const char* getServerPathTCP() const
{ {
@@ -98,7 +96,9 @@ private:
lo_server m_serverUDP; lo_server m_serverUDP;
CarlaString m_serverPathTCP; CarlaString m_serverPathTCP;
CarlaString m_serverPathUDP; CarlaString m_serverPathUDP;
#ifndef BUILD_BRIDGE
CarlaOscData m_controlData; // for carla-control CarlaOscData m_controlData; // for carla-control
#endif


char* m_name; char* m_name;
size_t m_nameSize; size_t m_nameSize;
@@ -107,8 +107,10 @@ private:


int handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg); int handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg);


#ifndef BUILD_BRIDGE
int handleMsgRegister(const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source); int handleMsgRegister(const int argc, const lo_arg* const* const argv, const char* const types, const lo_address source);
int handleMsgUnregister(); int handleMsgUnregister();
#endif


int handleMsgUpdate(CARLA_ENGINE_OSC_HANDLE_ARGS2, const lo_address source); int handleMsgUpdate(CARLA_ENGINE_OSC_HANDLE_ARGS2, const lo_address source);
int handleMsgConfigure(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgConfigure(CARLA_ENGINE_OSC_HANDLE_ARGS2);
@@ -117,6 +119,7 @@ private:
int handleMsgMidi(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgMidi(CARLA_ENGINE_OSC_HANDLE_ARGS2);
int handleMsgExiting(CARLA_ENGINE_OSC_HANDLE_ARGS1); int handleMsgExiting(CARLA_ENGINE_OSC_HANDLE_ARGS1);


#ifndef BUILD_BRIDGE
int handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgSetActive(CARLA_ENGINE_OSC_HANDLE_ARGS2);
int handleMsgSetDryWet(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgSetDryWet(CARLA_ENGINE_OSC_HANDLE_ARGS2);
int handleMsgSetVolume(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgSetVolume(CARLA_ENGINE_OSC_HANDLE_ARGS2);
@@ -130,14 +133,15 @@ private:
int handleMsgNoteOn(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgNoteOn(CARLA_ENGINE_OSC_HANDLE_ARGS2);
int handleMsgNoteOff(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgNoteOff(CARLA_ENGINE_OSC_HANDLE_ARGS2);


int handleMsgBridgeSetInPeak(CARLA_ENGINE_OSC_HANDLE_ARGS2);
int handleMsgBridgeSetOutPeak(CARLA_ENGINE_OSC_HANDLE_ARGS2);
#endif

#ifdef WANT_LV2 #ifdef WANT_LV2
int handleMsgLv2AtomTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgLv2AtomTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2);
int handleMsgLv2EventTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2); int handleMsgLv2EventTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2);
#endif #endif


int handleMsgBridgeSetInPeak(CARLA_ENGINE_OSC_HANDLE_ARGS2);
int handleMsgBridgeSetOutPeak(CARLA_ENGINE_OSC_HANDLE_ARGS2);

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


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 userData) 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 userData)


+ 10
- 8
c++/carla-engine/carla_engine_thread.cpp View File

@@ -71,14 +71,18 @@ void CarlaEngineThread::run()
qDebug("CarlaEngineThread::run()"); qDebug("CarlaEngineThread::run()");
CARLA_ASSERT(engine->isRunning()); CARLA_ASSERT(engine->isRunning());


bool oscControlRegisted, usesSingleThread;
bool oscRegisted, usesSingleThread;
unsigned short i; unsigned short i;
double value; double value;


while (engine->isRunning() && ! m_stopNow) while (engine->isRunning() && ! m_stopNow)
{ {
const ScopedLocker m(this); const ScopedLocker m(this);
oscControlRegisted = engine->isOscControlRegisted();
#ifndef BUILD_BRIDGE
oscRegisted = engine->isOscControlRegistered();
#else
oscRegisted = engine->isOscBridgeRegistered();
#endif


for (i=0; i < engine->maxPluginNumber(); i++) for (i=0; i < engine->maxPluginNumber(); i++)
{ {
@@ -98,7 +102,7 @@ void CarlaEngineThread::run()
if (! usesSingleThread) if (! usesSingleThread)
plugin->postEventsRun(); plugin->postEventsRun();


if (oscControlRegisted || ! usesSingleThread)
if (oscRegisted || ! usesSingleThread)
{ {
// --------------------------------------------------- // ---------------------------------------------------
// Update parameter outputs // Update parameter outputs
@@ -114,8 +118,8 @@ void CarlaEngineThread::run()
if (! usesSingleThread) if (! usesSingleThread)
plugin->uiParameterChange(j, value); plugin->uiParameterChange(j, value);


// Update OSC control client
if (oscControlRegisted)
// Update OSC engine client
if (oscRegisted)
{ {
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_parameter_value(j, value); engine->osc_send_bridge_set_parameter_value(j, value);
@@ -128,7 +132,7 @@ void CarlaEngineThread::run()
// --------------------------------------------------- // ---------------------------------------------------
// Update OSC control client peaks // Update OSC control client peaks


if (oscControlRegisted)
if (oscRegisted)
{ {
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
engine->osc_send_peaks(plugin); engine->osc_send_peaks(plugin);
@@ -139,9 +143,7 @@ void CarlaEngineThread::run()
} }
} }


#ifndef BUILD_BRIDGE
if (! engine->idleOsc()) if (! engine->idleOsc())
#endif
msleep(50); msleep(50);
} }
} }


+ 12
- 6
c++/carla-plugin/carla_plugin.cpp View File

@@ -74,12 +74,11 @@ CarlaPlugin::CarlaPlugin(CarlaEngine* const engine, const unsigned short id)
m_latency = 0; m_latency = 0;
m_latencyBuffers = nullptr; m_latencyBuffers = nullptr;


#ifndef BUILD_BRIDGE
// Extra
osc.data.path = nullptr; osc.data.path = nullptr;
osc.data.source = nullptr; osc.data.source = nullptr;
osc.data.target = nullptr; osc.data.target = nullptr;
osc.thread = nullptr; osc.thread = nullptr;
#endif
} }


CarlaPlugin::~CarlaPlugin() CarlaPlugin::~CarlaPlugin()
@@ -908,10 +907,15 @@ void CarlaPlugin::recreateLatencyBuffers()
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// OSC stuff // OSC stuff


void CarlaPlugin::registerToOscControl()
void CarlaPlugin::registerToOscClient()
{ {
if (! x_engine->isOscControlRegisted())
#ifndef BUILD_BRIDGE
if (! x_engine->isOscControlRegistered())
return; return;
#else
if (! x_engine->isOscBridgeRegistered())
return;
#endif


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
x_engine->osc_send_control_add_plugin_start(m_id, m_name); x_engine->osc_send_control_add_plugin_start(m_id, m_name);
@@ -1034,7 +1038,6 @@ void CarlaPlugin::registerToOscControl()
#endif #endif
} }


#ifndef BUILD_BRIDGE
void CarlaPlugin::updateOscData(const lo_address source, const char* const url) void CarlaPlugin::updateOscData(const lo_address source, const char* const url)
{ {
// FIXME - remove debug prints later // FIXME - remove debug prints later
@@ -1101,7 +1104,11 @@ bool CarlaPlugin::waitForOscGuiShow()
{ {
qWarning("CarlaPlugin::waitForOscGuiShow()"); qWarning("CarlaPlugin::waitForOscGuiShow()");


#ifndef BUILD_BRIDGE
const uint oscUiTimeout = x_engine->getOptions().oscUiTimeout; const uint oscUiTimeout = x_engine->getOptions().oscUiTimeout;
#else
const uint oscUiTimeout = 40;
#endif


// wait for UI 'update' call // wait for UI 'update' call
for (uint i=0; i < oscUiTimeout; i++) for (uint i=0; i < oscUiTimeout; i++)
@@ -1119,7 +1126,6 @@ bool CarlaPlugin::waitForOscGuiShow()
qWarning("CarlaPlugin::waitForOscGuiShow() - Timeout while waiting for UI to respond (waited %u msecs)", oscUiTimeout); qWarning("CarlaPlugin::waitForOscGuiShow() - Timeout while waiting for UI to respond (waited %u msecs)", oscUiTimeout);
return false; return false;
} }
#endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// MIDI events // MIDI events


+ 5
- 9
c++/carla-plugin/carla_plugin.hpp View File

@@ -23,11 +23,11 @@
#include "carla_osc_utils.hpp" #include "carla_osc_utils.hpp"


#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
# include "carla_backend_utils.hpp"
//# include "carla_backend_utils.hpp"
# include "carla_bridge_osc.hpp" # include "carla_bridge_osc.hpp"
#else
# include "carla_plugin_thread.hpp"
//#else
#endif #endif
#include "carla_plugin_thread.hpp"


// common includes // common includes
#include <cmath> #include <cmath>
@@ -694,11 +694,10 @@ public:
// OSC stuff // OSC stuff


/*! /*!
* Register this plugin to the engine's OSC controller.
* Register this plugin to the engine's OSC client (controller or bridge).
*/ */
void registerToOscControl();
void registerToOscClient();


#ifndef BUILD_BRIDGE
/*! /*!
* Update the plugin's internal OSC data according to \a source and \a url.\n * Update the plugin's internal OSC data according to \a source and \a url.\n
* This is used for OSC-GUI bridges. * This is used for OSC-GUI bridges.
@@ -715,7 +714,6 @@ public:
* This is a handy function that waits for the GUI to respond and automatically asks it to show itself. * This is a handy function that waits for the GUI to respond and automatically asks it to show itself.
*/ */
bool waitForOscGuiShow(); bool waitForOscGuiShow();
#endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// MIDI events // MIDI events
@@ -948,12 +946,10 @@ protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Extra // Extra


#ifndef BUILD_BRIDGE
struct { struct {
CarlaOscData data; CarlaOscData data;
CarlaPluginThread* thread; CarlaPluginThread* thread;
} osc; } osc;
#endif


struct { struct {
QMutex mutex; QMutex mutex;


+ 2
- 14
c++/carla-plugin/dssi.cpp View File

@@ -55,7 +55,6 @@ public:
{ {
qDebug("DssiPlugin::~DssiPlugin()"); qDebug("DssiPlugin::~DssiPlugin()");


#ifndef BUILD_BRIDGE
// close UI // close UI
if (m_hints & PLUGIN_HAS_GUI) if (m_hints & PLUGIN_HAS_GUI)
{ {
@@ -64,7 +63,7 @@ public:
if (osc.thread) if (osc.thread)
{ {
// Wait a bit first, try safe quit, then force kill // Wait a bit first, try safe quit, then force kill
if (osc.thread->isRunning() && ! osc.thread->wait(x_engine->getOptions().oscUiTimeout * 100))
if (osc.thread->isRunning() && ! osc.thread->wait(40 * 100)) // x_engine->getOptions().oscUiTimeout
{ {
qWarning("Failed to properly stop DSSI GUI thread"); qWarning("Failed to properly stop DSSI GUI thread");
osc.thread->terminate(); osc.thread->terminate();
@@ -73,7 +72,6 @@ public:
delete osc.thread; delete osc.thread;
} }
} }
#endif


if (ldescriptor) if (ldescriptor)
{ {
@@ -235,10 +233,8 @@ public:
descriptor->configure(handle, key, value); descriptor->configure(handle, key, value);
if (h2) descriptor->configure(h2, key, value); if (h2) descriptor->configure(h2, key, value);


#ifndef BUILD_BRIDGE
if (sendGui && osc.data.target) if (sendGui && osc.data.target)
osc_send_configure(&osc.data, key, value); osc_send_configure(&osc.data, key, value);
#endif


if (strcmp(key, "reloadprograms") == 0 || strcmp(key, "load") == 0 || strncmp(key, "patches", 7) == 0) if (strcmp(key, "reloadprograms") == 0 || strcmp(key, "load") == 0 || strncmp(key, "patches", 7) == 0)
{ {
@@ -302,7 +298,6 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set gui stuff // Set gui stuff


#ifndef BUILD_BRIDGE
void showGui(const bool yesNo) void showGui(const bool yesNo)
{ {
CARLA_ASSERT(osc.thread); CARLA_ASSERT(osc.thread);
@@ -330,7 +325,6 @@ public:
osc.thread->quit(); osc.thread->quit();
} }
} }
#endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin state // Plugin state
@@ -1445,7 +1439,6 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Post-poned events // Post-poned events


#ifndef BUILD_BRIDGE
void uiParameterChange(const uint32_t index, const double value) void uiParameterChange(const uint32_t index, const double value)
{ {
CARLA_ASSERT(index < param.count); CARLA_ASSERT(index < param.count);
@@ -1499,7 +1492,6 @@ public:
midiData[2] = note; midiData[2] = note;
osc_send_midi(&osc.data, midiData); osc_send_midi(&osc.data, midiData);
} }
#endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Cleanup // Cleanup
@@ -1594,7 +1586,6 @@ public:
// --------------------------------------------------------------- // ---------------------------------------------------------------
// gui stuff // gui stuff


#ifndef BUILD_BRIDGE
if (guiFilename) if (guiFilename)
{ {
osc.thread = new CarlaPluginThread(x_engine, this, CarlaPluginThread::PLUGIN_THREAD_DSSI_GUI); osc.thread = new CarlaPluginThread(x_engine, this, CarlaPluginThread::PLUGIN_THREAD_DSSI_GUI);
@@ -1602,9 +1593,6 @@ public:


m_hints |= PLUGIN_HAS_GUI; m_hints |= PLUGIN_HAS_GUI;
} }
#else
Q_UNUSED(guiFilename);
#endif


return true; return true;
} }
@@ -1663,7 +1651,7 @@ CarlaPlugin* CarlaPlugin::newDSSI(const initializer& init, const void* const ext
} }
# endif # endif


plugin->registerToOscControl();
plugin->registerToOscClient();


return plugin; return plugin;
#else #else


+ 1
- 1
c++/carla-plugin/ladspa.cpp View File

@@ -1262,7 +1262,7 @@ CarlaPlugin* CarlaPlugin::newLADSPA(const initializer& init, const void* const e
} }
# endif # endif


plugin->registerToOscControl();
plugin->registerToOscClient();


return plugin; return plugin;
#else #else


+ 1
- 3
c++/carla-plugin/lv2.cpp View File

@@ -4600,7 +4600,6 @@ Lv2Plugin::Ft Lv2Plugin::ft = { nullptr, nullptr, nullptr, nullptr, nullptr, nul


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


#ifndef BUILD_BRIDGE
int CarlaEngineOsc::handleMsgLv2AtomTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2) int CarlaEngineOsc::handleMsgLv2AtomTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2)
{ {
qDebug("CarlaOsc::handleMsgLv2AtomTransfer()"); qDebug("CarlaOsc::handleMsgLv2AtomTransfer()");
@@ -4642,7 +4641,6 @@ int CarlaEngineOsc::handleMsgLv2EventTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2)


return 0; return 0;
} }
#endif


CARLA_BACKEND_END_NAMESPACE CARLA_BACKEND_END_NAMESPACE


@@ -4687,7 +4685,7 @@ CarlaPlugin* CarlaPlugin::newLV2(const initializer& init)
} }
# endif # endif


plugin->registerToOscControl();
plugin->registerToOscClient();
plugin->updateUi(); plugin->updateUi();


return plugin; return plugin;


+ 1
- 1
c++/carla-plugin/vst.cpp View File

@@ -2440,7 +2440,7 @@ CarlaPlugin* CarlaPlugin::newVST(const initializer& init)
} }
# endif # endif


plugin->registerToOscControl();
plugin->registerToOscClient();


return plugin; return plugin;
#else #else


+ 2
- 2
c++/carla-utils/carla_osc_utils.hpp View File

@@ -217,7 +217,8 @@ void osc_send_exiting(const CarlaOscData* const oscData)
lo_send(oscData->target, targetPath, ""); lo_send(oscData->target, targetPath, "");
} }
} }
#else
#endif

static inline static inline
void osc_send_show(const CarlaOscData* const oscData) void osc_send_show(const CarlaOscData* const oscData)
{ {
@@ -262,7 +263,6 @@ void osc_send_quit(const CarlaOscData* const oscData)
lo_send(oscData->target, targetPath, ""); lo_send(oscData->target, targetPath, "");
} }
} }
#endif


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




Loading…
Cancel
Save