Browse Source

Continue Carla rework

tags/v0.9.0
falkTX 12 years ago
parent
commit
135a7ce5dd
11 changed files with 110 additions and 115 deletions
  1. +1
    -0
      c++/carla-bridge/carla_bridge.hpp
  2. +1
    -1
      c++/carla-bridge/carla_bridge_client.hpp
  3. +7
    -6
      c++/carla-bridge/carla_bridge_plugin.cpp
  4. +3
    -3
      c++/carla-engine/carla_engine.cpp
  5. +11
    -2
      c++/carla-engine/carla_engine.hpp
  6. +1
    -1
      c++/carla-engine/jack.cpp
  7. +25
    -32
      c++/carla-plugin/carla_plugin.cpp
  8. +4
    -2
      c++/carla-plugin/carla_plugin.hpp
  9. +10
    -7
      c++/carla-plugin/dssi.cpp
  10. +38
    -52
      c++/carla-plugin/lv2.cpp
  11. +9
    -9
      c++/carla-plugin/vst.cpp

+ 1
- 0
c++/carla-bridge/carla_bridge.hpp View File

@@ -22,6 +22,7 @@


#define CARLA_BRIDGE_START_NAMESPACE namespace CarlaBridge { #define CARLA_BRIDGE_START_NAMESPACE namespace CarlaBridge {
#define CARLA_BRIDGE_END_NAMESPACE } #define CARLA_BRIDGE_END_NAMESPACE }
#define CARLA_BRIDGE_USE_NAMESPACE using namespace CarlaBridge;


CARLA_BRIDGE_START_NAMESPACE CARLA_BRIDGE_START_NAMESPACE




+ 1
- 1
c++/carla-bridge/carla_bridge_client.hpp View File

@@ -44,7 +44,7 @@ CARLA_BRIDGE_START_NAMESPACE


class CarlaClient class CarlaClient
{ {
public:
public:
CarlaClient(CarlaToolkit* const toolkit) CarlaClient(CarlaToolkit* const toolkit)
#ifdef BUILD_BRIDGE_PLUGIN #ifdef BUILD_BRIDGE_PLUGIN
: m_osc(this, "carla-bridge-plugin"), : m_osc(this, "carla-bridge-plugin"),


+ 7
- 6
c++/carla-bridge/carla_bridge_plugin.cpp View File

@@ -18,6 +18,7 @@
#ifdef BUILD_BRIDGE_PLUGIN #ifdef BUILD_BRIDGE_PLUGIN


#include "carla_bridge_client.hpp" #include "carla_bridge_client.hpp"
#include "carla_backend_utils.hpp"
#include "carla_plugin.hpp" #include "carla_plugin.hpp"


#include <set> #include <set>
@@ -464,7 +465,7 @@ public:
for (uint32_t i=0; i < plugin->customDataCount(); i++) for (uint32_t i=0; i < plugin->customDataCount(); i++)
{ {
const CarlaBackend::CustomData* const cdata = plugin->customData(i); const CarlaBackend::CustomData* const cdata = plugin->customData(i);
engine->osc_send_bridge_set_custom_data(CarlaBackend::getCustomDataTypeString(cdata->type), cdata->key, cdata->value);
engine->osc_send_bridge_set_custom_data(cdata->type, cdata->key, cdata->value);
} }


if (plugin->hints() & CarlaBackend::PLUGIN_USES_CHUNKS) if (plugin->hints() & CarlaBackend::PLUGIN_USES_CHUNKS)
@@ -506,7 +507,7 @@ public:
if (! plugin) if (! plugin)
return; return;


plugin->setCustomData(CarlaBackend::getCustomDataStringType(type), key, value, true);
plugin->setCustomData(type, key, value, true);
} }


void setChunkData(const char* const filePath) void setChunkData(const char* const filePath)
@@ -543,9 +544,9 @@ public:
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// callback // callback


void handleCallback(const CarlaBackend::CallbackType action, const int value1, const int value2, const double value3)
void handleCallback(const CarlaBackend::CallbackType action, const int value1, const int value2, const double value3, const char* const valueStr)
{ {
qDebug("CarlaPluginClient::handleCallback(%s, %i, %i, %g)", CarlaBackend::CallbackType2Str(action), value1, value2, value3);
qDebug("CarlaPluginClient::handleCallback(%s, %i, %i, %g \"%s\")", CarlaBackend::CallbackType2Str(action), value1, value2, value3, valueStr);


if (! engine) if (! engine)
return; return;
@@ -616,7 +617,7 @@ public:


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


static void callback(void* const ptr, CarlaBackend::CallbackType const action, const unsigned short, const int value1, const int value2, const double value3)
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)
{ {
CARLA_ASSERT(ptr); CARLA_ASSERT(ptr);


@@ -624,7 +625,7 @@ public:
return; return;


BridgePluginClient* const _this_ = (BridgePluginClient*)ptr; BridgePluginClient* const _this_ = (BridgePluginClient*)ptr;
_this_->handleCallback(action, value1, value2, value3);
_this_->handleCallback(action, value1, value2, value3, valueStr);
} }


protected: protected:


+ 3
- 3
c++/carla-engine/carla_engine.cpp View File

@@ -1845,9 +1845,9 @@ void CarlaEngine::osc_send_bridge_set_midi_program(const int32_t index)
} }
} }


void CarlaEngine::osc_send_bridge_set_custom_data(const char* const stype, const char* const key, const char* const value)
void CarlaEngine::osc_send_bridge_set_custom_data(const char* const type, const char* const key, const char* const value)
{ {
qDebug("CarlaEngine::osc_send_bridge_set_custom_data(\"%s\", \"%s\", \"%s\")", stype, key, value);
qDebug("CarlaEngine::osc_send_bridge_set_custom_data(\"%s\", \"%s\", \"%s\")", type, key, value);
CARLA_ASSERT(m_oscData); CARLA_ASSERT(m_oscData);


if (m_oscData && m_oscData->target) if (m_oscData && m_oscData->target)
@@ -1855,7 +1855,7 @@ void CarlaEngine::osc_send_bridge_set_custom_data(const char* const stype, const
char target_path[strlen(m_oscData->path)+24]; char target_path[strlen(m_oscData->path)+24];
strcpy(target_path, m_oscData->path); strcpy(target_path, m_oscData->path);
strcat(target_path, "/bridge_set_custom_data"); strcat(target_path, "/bridge_set_custom_data");
lo_send(m_oscData->target, target_path, "sss", stype, key, value);
lo_send(m_oscData->target, target_path, "sss", type, key, value);
} }
} }




+ 11
- 2
c++/carla-engine/carla_engine.hpp View File

@@ -18,11 +18,20 @@
#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
* *
@@ -703,7 +712,7 @@ public:
void osc_send_bridge_set_default_value(const int32_t index, const double value); void osc_send_bridge_set_default_value(const int32_t index, const double value);
void osc_send_bridge_set_program(const int32_t index); void osc_send_bridge_set_program(const int32_t index);
void osc_send_bridge_set_midi_program(const int32_t index); void osc_send_bridge_set_midi_program(const int32_t index);
void osc_send_bridge_set_custom_data(const char* const stype, const char* const key, const char* const value);
void osc_send_bridge_set_custom_data(const char* const type, const char* const key, const char* const value);
void osc_send_bridge_set_chunk_data(const char* const chunkFile); void osc_send_bridge_set_chunk_data(const char* const chunkFile);
void osc_send_bridge_set_inpeak(const int32_t portId); void osc_send_bridge_set_inpeak(const int32_t portId);
void osc_send_bridge_set_outpeak(const int32_t portId); void osc_send_bridge_set_outpeak(const int32_t portId);


+ 1
- 1
c++/carla-engine/jack.cpp View File

@@ -944,7 +944,7 @@ protected:
} }


m_client = nullptr; m_client = nullptr;
callback(CALLBACK_QUIT, 0, 0, 0, 0.0);
callback(CALLBACK_QUIT, 0, 0, 0, 0.0, nullptr);
} }


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


+ 25
- 32
c++/carla-plugin/carla_plugin.cpp View File

@@ -456,7 +456,7 @@ void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool se
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_ACTIVE, 0, value);
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_ACTIVE, 0, value, nullptr);
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
else if (m_hints & PLUGIN_IS_BRIDGE) else if (m_hints & PLUGIN_IS_BRIDGE)
osc_send_control(&osc.data, PARAMETER_ACTIVE, value); osc_send_control(&osc.data, PARAMETER_ACTIVE, value);
@@ -482,7 +482,7 @@ void CarlaPlugin::setDryWet(double value, const bool sendOsc, const bool sendCal
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_DRYWET, 0, value);
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_DRYWET, 0, value, nullptr);
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
else if (m_hints & PLUGIN_IS_BRIDGE) else if (m_hints & PLUGIN_IS_BRIDGE)
osc_send_control(&osc.data, PARAMETER_DRYWET, value); osc_send_control(&osc.data, PARAMETER_DRYWET, value);
@@ -508,7 +508,7 @@ void CarlaPlugin::setVolume(double value, const bool sendOsc, const bool sendCal
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_VOLUME, 0, value);
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_VOLUME, 0, value, nullptr);
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
else if (m_hints & PLUGIN_IS_BRIDGE) else if (m_hints & PLUGIN_IS_BRIDGE)
osc_send_control(&osc.data, PARAMETER_VOLUME, value); osc_send_control(&osc.data, PARAMETER_VOLUME, value);
@@ -534,7 +534,7 @@ void CarlaPlugin::setBalanceLeft(double value, const bool sendOsc, const bool se
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_BALANCE_LEFT, 0, value);
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_BALANCE_LEFT, 0, value, nullptr);
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
else if (m_hints & PLUGIN_IS_BRIDGE) else if (m_hints & PLUGIN_IS_BRIDGE)
osc_send_control(&osc.data, PARAMETER_BALANCE_LEFT, value); osc_send_control(&osc.data, PARAMETER_BALANCE_LEFT, value);
@@ -560,7 +560,7 @@ void CarlaPlugin::setBalanceRight(double value, const bool sendOsc, const bool s
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_BALANCE_RIGHT, 0, value);
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, PARAMETER_BALANCE_RIGHT, 0, value, nullptr);
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
else if (m_hints & PLUGIN_IS_BRIDGE) else if (m_hints & PLUGIN_IS_BRIDGE)
osc_send_control(&osc.data, PARAMETER_BALANCE_RIGHT, value); osc_send_control(&osc.data, PARAMETER_BALANCE_RIGHT, value);
@@ -596,7 +596,7 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, double value, co
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, parameterId, 0, value);
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, parameterId, 0, value, nullptr);
} }


void CarlaPlugin::setParameterValueByRIndex(const int32_t rindex, const double value, const bool sendGui, const bool sendOsc, const bool sendCallback) void CarlaPlugin::setParameterValueByRIndex(const int32_t rindex, const double value, const bool sendGui, const bool sendOsc, const bool sendCallback)
@@ -639,7 +639,7 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, uint8_t ch
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, m_id, parameterId, channel, 0.0);
x_engine->callback(CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, m_id, parameterId, channel, 0.0, nullptr);
} }


void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, const bool sendOsc, const bool sendCallback) void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, const bool sendOsc, const bool sendCallback)
@@ -660,40 +660,33 @@ void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, con
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_PARAMETER_MIDI_CC_CHANGED, m_id, parameterId, cc, 0.0);
x_engine->callback(CALLBACK_PARAMETER_MIDI_CC_CHANGED, m_id, parameterId, cc, 0.0, nullptr);
} }


void CarlaPlugin::setCustomData(const CustomDataType type, const char* const key, const char* const value, const bool sendGui)
void CarlaPlugin::setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui)
{ {
CARLA_ASSERT(type != CUSTOM_DATA_INVALID);
CARLA_ASSERT(type);
CARLA_ASSERT(key); CARLA_ASSERT(key);
CARLA_ASSERT(value); CARLA_ASSERT(value);


if (type == CUSTOM_DATA_INVALID)
return qCritical("CarlaPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is invalid", CustomDataType2Str(type), key, value, bool2str(sendGui));
if (! type)
return qCritical("CarlaPlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is invalid", type, key, value, bool2str(sendGui));


if (! key) if (! key)
return qCritical("CarlaPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2Str(type), key, value, bool2str(sendGui));
return qCritical("CarlaPlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - key is null", type, key, value, bool2str(sendGui));


if (! value) if (! value)
return qCritical("CarlaPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2Str(type), key, value, bool2str(sendGui));
return qCritical("CarlaPlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - value is null", type, key, value, bool2str(sendGui));


bool saveData = true; bool saveData = true;


switch (type)
if (strcmp(type, CUSTOM_DATA_STRING) == 0)
{ {
case CUSTOM_DATA_INVALID:
saveData = false;
break;
case CUSTOM_DATA_STRING:
// Ignore some keys // Ignore some keys
if (strncmp(key, "OSC:", 4) == 0 || strcmp(key, "guiVisible") == 0) if (strncmp(key, "OSC:", 4) == 0 || strcmp(key, "guiVisible") == 0)
saveData = false; saveData = false;
else if (strcmp(key, CARLA_BRIDGE_MSG_SAVE_NOW) == 0 || strcmp(key, CARLA_BRIDGE_MSG_SET_CHUNK) == 0 || strcmp(key, CARLA_BRIDGE_MSG_SET_CUSTOM) == 0) else if (strcmp(key, CARLA_BRIDGE_MSG_SAVE_NOW) == 0 || strcmp(key, CARLA_BRIDGE_MSG_SET_CHUNK) == 0 || strcmp(key, CARLA_BRIDGE_MSG_SET_CUSTOM) == 0)
saveData = false; saveData = false;
break;
default:
break;
} }


if (saveData) if (saveData)
@@ -711,7 +704,7 @@ void CarlaPlugin::setCustomData(const CustomDataType type, const char* const key


// Otherwise store it // Otherwise store it
CustomData newData; CustomData newData;
newData.type = type;
newData.type = strdup(type);
newData.key = strdup(key); newData.key = strdup(key);
newData.value = strdup(value); newData.value = strdup(value);
custom.push_back(newData); custom.push_back(newData);
@@ -763,7 +756,7 @@ void CarlaPlugin::setProgram(int32_t index, const bool sendGui, const bool sendO
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_PROGRAM_CHANGED, m_id, index, 0, 0.0);
x_engine->callback(CALLBACK_PROGRAM_CHANGED, m_id, index, 0, 0.0, nullptr);


Q_UNUSED(block); Q_UNUSED(block);
} }
@@ -808,7 +801,7 @@ void CarlaPlugin::setMidiProgram(int32_t index, const bool sendGui, const bool s
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, m_id, index, 0, 0.0);
x_engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, m_id, index, 0, 0.0, nullptr);


Q_UNUSED(block); Q_UNUSED(block);
} }
@@ -1168,7 +1161,7 @@ void CarlaPlugin::sendMidiSingleNote(const uint8_t channel, const uint8_t note,
#endif #endif


if (sendCallback) if (sendCallback)
x_engine->callback(velo ? CALLBACK_NOTE_ON : CALLBACK_NOTE_OFF, m_id, channel, note, velo);
x_engine->callback(velo ? CALLBACK_NOTE_ON : CALLBACK_NOTE_OFF, m_id, channel, note, velo, nullptr);
} }


void CarlaPlugin::sendMidiAllNotesOff() void CarlaPlugin::sendMidiAllNotesOff()
@@ -1252,7 +1245,7 @@ void CarlaPlugin::postEventsRun()
break; break;


case PluginPostEventDebug: case PluginPostEventDebug:
x_engine->callback(CALLBACK_DEBUG, m_id, event->value1, event->value2, event->value3);
x_engine->callback(CALLBACK_DEBUG, m_id, event->value1, event->value2, event->value3, nullptr);
break; break;


case PluginPostEventParameterChange: case PluginPostEventParameterChange:
@@ -1267,7 +1260,7 @@ void CarlaPlugin::postEventsRun()
#endif #endif


// Update Host // Update Host
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, event->value1, 0, event->value3);
x_engine->callback(CALLBACK_PARAMETER_VALUE_CHANGED, m_id, event->value1, 0, event->value3, nullptr);
break; break;


case PluginPostEventProgramChange: case PluginPostEventProgramChange:
@@ -1287,7 +1280,7 @@ void CarlaPlugin::postEventsRun()
#endif #endif


// Update Host // Update Host
x_engine->callback(CALLBACK_PROGRAM_CHANGED, m_id, event->value1, 0, 0.0);
x_engine->callback(CALLBACK_PROGRAM_CHANGED, m_id, event->value1, 0, 0.0, nullptr);
break; break;


case PluginPostEventMidiProgramChange: case PluginPostEventMidiProgramChange:
@@ -1307,7 +1300,7 @@ void CarlaPlugin::postEventsRun()
#endif #endif


// Update Host // Update Host
x_engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, m_id, event->value1, 0, 0.0);
x_engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, m_id, event->value1, 0, 0.0, nullptr);
break; break;


case PluginPostEventNoteOn: case PluginPostEventNoteOn:
@@ -1321,7 +1314,7 @@ void CarlaPlugin::postEventsRun()
#endif #endif


// Update Host // Update Host
x_engine->callback(CALLBACK_NOTE_ON, m_id, event->value1, event->value2, rint(event->value3));
x_engine->callback(CALLBACK_NOTE_ON, m_id, event->value1, event->value2, rint(event->value3), nullptr);
break; break;


case PluginPostEventNoteOff: case PluginPostEventNoteOff:
@@ -1335,7 +1328,7 @@ void CarlaPlugin::postEventsRun()
#endif #endif


// Update Host // Update Host
x_engine->callback(CALLBACK_NOTE_OFF, m_id, event->value1, event->value2, 0.0);
x_engine->callback(CALLBACK_NOTE_OFF, m_id, event->value1, event->value2, 0.0, nullptr);
break; break;


case PluginPostEventCustom: case PluginPostEventCustom:


+ 4
- 2
c++/carla-plugin/carla_plugin.hpp View File

@@ -21,10 +21,12 @@
#include "carla_midi.h" #include "carla_midi.h"
#include "carla_engine.hpp" #include "carla_engine.hpp"
#include "carla_osc_utils.hpp" #include "carla_osc_utils.hpp"
#include "carla_plugin_thread.hpp"


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


// common includes // common includes
@@ -51,7 +53,7 @@ CARLA_BACKEND_START_NAMESPACE
* @{ * @{
*/ */


#define CARLA_PROCESS_CONTINUE_CHECK if (! m_enabled) { x_engine->callback(CALLBACK_DEBUG, m_id, m_enabled, 0, 0.0); return; }
#define CARLA_PROCESS_CONTINUE_CHECK if (! m_enabled) { x_engine->callback(CALLBACK_DEBUG, m_id, m_enabled, 0, 0.0, nullptr); return; }


const unsigned short MAX_MIDI_EVENTS = 512; const unsigned short MAX_MIDI_EVENTS = 512;
const unsigned short MAX_POST_EVENTS = 152; const unsigned short MAX_POST_EVENTS = 152;


+ 10
- 7
c++/carla-plugin/dssi.cpp View File

@@ -214,20 +214,23 @@ public:
CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback);
} }


void setCustomData(const CustomDataType type, const char* const key, const char* const value, const bool sendGui)
void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui)
{ {
CARLA_ASSERT(type == CUSTOM_DATA_STRING);
CARLA_ASSERT(type);
CARLA_ASSERT(key); CARLA_ASSERT(key);
CARLA_ASSERT(value); CARLA_ASSERT(value);


if (type != CUSTOM_DATA_STRING)
return qCritical("DssiPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is not string", CustomDataType2Str(type), key, value, bool2str(sendGui));
if (! type)
return qCritical("DssiPlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is invalid", type, key, value, bool2str(sendGui));

if (strcmp(type, CUSTOM_DATA_STRING) != 0)
return qCritical("DssiPlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is not string", type, key, value, bool2str(sendGui));


if (! key) if (! key)
return qCritical("DssiPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2Str(type), key, value, bool2str(sendGui));
return qCritical("DssiPlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - key is null", type, key, value, bool2str(sendGui));


if (! value) if (! value)
return qCritical("DssiPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2Str(type), key, value, bool2str(sendGui));
return qCritical("DssiPlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - value is null", type, key, value, bool2str(sendGui));


descriptor->configure(handle, key, value); descriptor->configure(handle, key, value);
if (h2) descriptor->configure(h2, key, value); if (h2) descriptor->configure(h2, key, value);
@@ -826,7 +829,7 @@ public:
} }
else else
{ {
x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0);
x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0, nullptr);


// Check if current program is invalid // Check if current program is invalid
bool programChanged = false; bool programChanged = false;


+ 38
- 52
c++/carla-plugin/lv2.cpp View File

@@ -823,26 +823,25 @@ public:
CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback);
} }


void setCustomData(const CustomDataType type, const char* const key, const char* const value, const bool sendGui)
void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui)
{ {
CARLA_ASSERT(type != CUSTOM_DATA_INVALID);
CARLA_ASSERT(type);
CARLA_ASSERT(key); CARLA_ASSERT(key);
CARLA_ASSERT(value); CARLA_ASSERT(value);


if (type == CUSTOM_DATA_INVALID)
return qCritical("Lv2Plugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is invalid", CustomDataType2Str(type), key, value, bool2str(sendGui));
if (! type)
return qCritical("Lv2Plugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is invalid", type, key, value, bool2str(sendGui));


if (! key) if (! key)
return qCritical("Lv2Plugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2Str(type), key, value, bool2str(sendGui));
return qCritical("Lv2Plugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - key is null", type, key, value, bool2str(sendGui));


if (! value) if (! value)
return qCritical("Lv2Plugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2Str(type), key, value, bool2str(sendGui));
return qCritical("Lv2Plugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - value is null", type, key, value, bool2str(sendGui));


CarlaPlugin::setCustomData(type, key, value, sendGui); CarlaPlugin::setCustomData(type, key, value, sendGui);


if (ext.state) if (ext.state)
{ {
const char* const stype = getCustomDataTypeString(type);
LV2_State_Status status; LV2_State_Status status;


if (x_engine->isOffline()) if (x_engine->isOffline())
@@ -861,22 +860,22 @@ public:
switch (status) switch (status)
{ {
case LV2_STATE_SUCCESS: case LV2_STATE_SUCCESS:
qDebug("Lv2Plugin::setCustomData(%s, %s, <value>, %s) - success", stype, key, bool2str(sendGui));
qDebug("Lv2Plugin::setCustomData(\"%s\", \"%s\", <value>, %s) - success", type, key, bool2str(sendGui));
break; break;
case LV2_STATE_ERR_UNKNOWN: case LV2_STATE_ERR_UNKNOWN:
qWarning("Lv2Plugin::setCustomData(%s, %s, <value>, %s) - unknown error", stype, key, bool2str(sendGui));
qWarning("Lv2Plugin::setCustomData(\"%s\", \"%s\", <value>, %s) - unknown error", type, key, bool2str(sendGui));
break; break;
case LV2_STATE_ERR_BAD_TYPE: case LV2_STATE_ERR_BAD_TYPE:
qWarning("Lv2Plugin::setCustomData(%s, %s, <value>, %s) - error, bad type", stype, key, bool2str(sendGui));
qWarning("Lv2Plugin::setCustomData(\"%s\", \"%s\", <value>, %s) - error, bad type", type, key, bool2str(sendGui));
break; break;
case LV2_STATE_ERR_BAD_FLAGS: case LV2_STATE_ERR_BAD_FLAGS:
qWarning("Lv2Plugin::setCustomData(%s, %s, <value>, %s) - error, bad flags", stype, key, bool2str(sendGui));
qWarning("Lv2Plugin::setCustomData(\"%s\", \"%s\", <value>, %s) - error, bad flags", type, key, bool2str(sendGui));
break; break;
case LV2_STATE_ERR_NO_FEATURE: case LV2_STATE_ERR_NO_FEATURE:
qWarning("Lv2Plugin::setCustomData(%s, %s, <value>, %s) - error, missing feature", stype, key, bool2str(sendGui));
qWarning("Lv2Plugin::setCustomData(\"%s\", \"%s\", <value>, %s) - error, missing feature", type, key, bool2str(sendGui));
break; break;
case LV2_STATE_ERR_NO_PROPERTY: case LV2_STATE_ERR_NO_PROPERTY:
qWarning("Lv2Plugin::setCustomData(%s, %s, <value>, %s) - error, missing property", stype, key, bool2str(sendGui));
qWarning("Lv2Plugin::setCustomData(\"%s\", \"%s\", <value>, %s) - error, missing property", type, key, bool2str(sendGui));
break; break;
} }
} }
@@ -978,7 +977,7 @@ public:
case GUI_INTERNAL_HWND: case GUI_INTERNAL_HWND:
case GUI_INTERNAL_X11: case GUI_INTERNAL_X11:
if (yesNo && gui.width > 0 && gui.height > 0) if (yesNo && gui.width > 0 && gui.height > 0)
x_engine->callback(CALLBACK_RESIZE_GUI, m_id, gui.width, gui.height, 0.0);
x_engine->callback(CALLBACK_RESIZE_GUI, m_id, gui.width, gui.height, 0.0, nullptr);
break; break;


case GUI_EXTERNAL_LV2: case GUI_EXTERNAL_LV2:
@@ -1008,7 +1007,7 @@ public:
} }
else else
// failed to init UI // failed to init UI
x_engine->callback(CALLBACK_SHOW_GUI, m_id, -1, 0, 0.0);
x_engine->callback(CALLBACK_SHOW_GUI, m_id, -1, 0, 0.0, nullptr);


break; break;


@@ -1882,7 +1881,7 @@ public:
} }
else else
{ {
x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0);
x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0, nullptr);


// Check if current program is invalid // Check if current program is invalid
bool programChanged = false; bool programChanged = false;
@@ -3140,7 +3139,7 @@ public:
} }
} }


x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0);
x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0, nullptr);
} }


LV2_State_Status handleStateStore(const uint32_t key, const void* const value, const size_t size, const uint32_t type, const uint32_t flags) LV2_State_Status handleStateStore(const uint32_t key, const void* const value, const size_t size, const uint32_t type, const uint32_t flags)
@@ -3148,20 +3147,9 @@ public:
CARLA_ASSERT(key > 0); CARLA_ASSERT(key > 0);
CARLA_ASSERT(value); CARLA_ASSERT(value);


CustomDataType dtype;
const char* const stype = getCustomURIString(type);
const char* const uriKey = getCustomURIString(key); const char* const uriKey = getCustomURIString(key);


if (type == CARLA_URI_MAP_ID_ATOM_CHUNK)
dtype = CUSTOM_DATA_CHUNK;
else if (type == CARLA_URI_MAP_ID_ATOM_PATH)
dtype = CUSTOM_DATA_PATH;
else if (type == CARLA_URI_MAP_ID_ATOM_STRING)
dtype = CUSTOM_DATA_STRING;
else if (type >= CARLA_URI_MAP_ID_COUNT)
dtype = CUSTOM_DATA_BINARY;
else
dtype = CUSTOM_DATA_INVALID;

// do basic checks // do basic checks
if (! uriKey) if (! uriKey)
{ {
@@ -3175,9 +3163,9 @@ public:
return LV2_STATE_ERR_BAD_FLAGS; return LV2_STATE_ERR_BAD_FLAGS;
} }


if (dtype == CUSTOM_DATA_INVALID)
if (! stype)
{ {
qCritical("Lv2Plugin::handleStateStore(%i, %p, " P_SIZE ", %i, %i) - invalid type '%s'", key, value, size, type, flags, CustomDataType2Str(dtype));
qCritical("Lv2Plugin::handleStateStore(%i, %p, " P_SIZE ", %i, %i) - invalid type", key, value, size, type, flags);
return LV2_STATE_ERR_BAD_TYPE; return LV2_STATE_ERR_BAD_TYPE;
} }


@@ -3188,7 +3176,7 @@ public:
{ {
free((void*)custom[i].value); free((void*)custom[i].value);


if (dtype == CUSTOM_DATA_STRING || dtype == CUSTOM_DATA_PATH)
if (strcmp(stype, LV2_ATOM__String) == 0 || strcmp(stype, LV2_ATOM__Path) == 0)
custom[i].value = strdup((const char*)value); custom[i].value = strdup((const char*)value);
else else
custom[i].value = strdup(QByteArray((const char*)value, size).toBase64().constData()); custom[i].value = strdup(QByteArray((const char*)value, size).toBase64().constData());
@@ -3199,10 +3187,10 @@ public:


// Otherwise store it // Otherwise store it
CustomData newData; CustomData newData;
newData.type = dtype;
newData.type = strdup(stype);
newData.key = strdup(uriKey); newData.key = strdup(uriKey);


if (dtype == CUSTOM_DATA_STRING || dtype == CUSTOM_DATA_PATH)
if (strcmp(stype, LV2_ATOM__String) == 0 || strcmp(stype, LV2_ATOM__Path) == 0)
newData.value = strdup((const char*)value); newData.value = strdup((const char*)value);
else else
newData.value = strdup(QByteArray((const char*)value, size).toBase64().constData()); newData.value = strdup(QByteArray((const char*)value, size).toBase64().constData());
@@ -3224,14 +3212,14 @@ public:
return nullptr; return nullptr;
} }


const char* stype = nullptr;
const char* stringData = nullptr; const char* stringData = nullptr;
CustomDataType dtype = CUSTOM_DATA_INVALID;


for (size_t i=0; i < custom.size(); i++) for (size_t i=0; i < custom.size(); i++)
{ {
if (strcmp(custom[i].key, uriKey) == 0) if (strcmp(custom[i].key, uriKey) == 0)
{ {
dtype = custom[i].type;
stype = custom[i].type;
stringData = custom[i].value; stringData = custom[i].value;
break; break;
} }
@@ -3244,32 +3232,28 @@ public:
} }


*size = 0; *size = 0;
*type = 0;
*type = key;
*flags = LV2_STATE_IS_POD; *flags = LV2_STATE_IS_POD;


if (dtype == CUSTOM_DATA_STRING)
if (strcmp(stype, LV2_ATOM__String) == 0)
{ {
*size = strlen(stringData); *size = strlen(stringData);
*type = CARLA_URI_MAP_ID_ATOM_STRING;
return stringData; return stringData;
} }
if (dtype == CUSTOM_DATA_PATH)
else if (strcmp(stype, LV2_ATOM__Path) == 0)
{ {
*size = strlen(stringData); *size = strlen(stringData);
*type = CARLA_URI_MAP_ID_ATOM_PATH;
return stringData; return stringData;
} }
if (dtype == CUSTOM_DATA_CHUNK || dtype == CUSTOM_DATA_BINARY)
else
{ {
static QByteArray chunk; static QByteArray chunk;
chunk = QByteArray::fromBase64(stringData); chunk = QByteArray::fromBase64(stringData);

*size = chunk.size(); *size = chunk.size();
*type = (dtype == CUSTOM_DATA_CHUNK) ? CARLA_URI_MAP_ID_ATOM_CHUNK : key;
return chunk.constData(); return chunk.constData();
} }


qCritical("Lv2Plugin::handleStateRetrieve(%i, %p, %p, %p) - invalid key type '%s'", key, size, type, flags, CustomDataType2Str(dtype));
qCritical("Lv2Plugin::handleStateRetrieve(%i, %p, %p, %p) - invalid key type '%s'", key, size, type, flags, stype);
return nullptr; return nullptr;
} }


@@ -3308,7 +3292,7 @@ public:
ui.descriptor->cleanup(ui.handle); ui.descriptor->cleanup(ui.handle);


ui.handle = nullptr; ui.handle = nullptr;
x_engine->callback(CALLBACK_SHOW_GUI, m_id, 0, 0, 0.0);
x_engine->callback(CALLBACK_SHOW_GUI, m_id, 0, 0, 0.0, nullptr);
} }


uint32_t handleUiPortMap(const char* const symbol) uint32_t handleUiPortMap(const char* const symbol)
@@ -3337,7 +3321,7 @@ public:


gui.width = width; gui.width = width;
gui.height = height; gui.height = height;
x_engine->callback(CALLBACK_RESIZE_GUI, m_id, width, height, 0.0);
x_engine->callback(CALLBACK_RESIZE_GUI, m_id, width, height, 0.0, nullptr);


return 0; return 0;
} }
@@ -3454,13 +3438,13 @@ public:
qWarning("Lv2Plugin::initExternalUi() - failed to instantiate UI"); qWarning("Lv2Plugin::initExternalUi() - failed to instantiate UI");
ui.handle = nullptr; ui.handle = nullptr;
ui.widget = nullptr; ui.widget = nullptr;
x_engine->callback(CALLBACK_SHOW_GUI, m_id, -1, 0, 0.0);
x_engine->callback(CALLBACK_SHOW_GUI, m_id, -1, 0, 0.0, nullptr);
} }
} }


void uiTransferCustomData(const CustomData* const cdata) void uiTransferCustomData(const CustomData* const cdata)
{ {
if (cdata->type == CUSTOM_DATA_INVALID || ! (ui.handle && ui.descriptor && ui.descriptor->port_event))
if (! (cdata->type && ui.handle && ui.descriptor && ui.descriptor->port_event))
return; return;


LV2_URID_Map* const URID_Map = (LV2_URID_Map*)features[lv2_feature_id_urid_map]->data; LV2_URID_Map* const URID_Map = (LV2_URID_Map*)features[lv2_feature_id_urid_map]->data;
@@ -3482,11 +3466,11 @@ public:


lv2_atom_forge_property_head(&forge, getCustomURID(cdata->key), CARLA_URI_MAP_ID_NULL); lv2_atom_forge_property_head(&forge, getCustomURID(cdata->key), CARLA_URI_MAP_ID_NULL);


if (cdata->type == CUSTOM_DATA_STRING)
if (strcmp(cdata->type, LV2_ATOM__String) == 0)
lv2_atom_forge_string(&forge, cdata->value, strlen(cdata->value)); lv2_atom_forge_string(&forge, cdata->value, strlen(cdata->value));
else if (cdata->type == CUSTOM_DATA_PATH)
else if (strcmp(cdata->type, LV2_ATOM__Path) == 0)
lv2_atom_forge_path(&forge, cdata->value, strlen(cdata->value)); lv2_atom_forge_path(&forge, cdata->value, strlen(cdata->value));
else if (cdata->type == CUSTOM_DATA_CHUNK)
else if (strcmp(cdata->type, LV2_ATOM__Chunk) == 0)
lv2_atom_forge_literal(&forge, cdata->value, strlen(cdata->value), CARLA_URI_MAP_ID_ATOM_CHUNK, CARLA_URI_MAP_ID_NULL); lv2_atom_forge_literal(&forge, cdata->value, strlen(cdata->value), CARLA_URI_MAP_ID_ATOM_CHUNK, CARLA_URI_MAP_ID_NULL);
else else
lv2_atom_forge_literal(&forge, cdata->value, strlen(cdata->value), getCustomURID(cdata->key), CARLA_URI_MAP_ID_NULL); lv2_atom_forge_literal(&forge, cdata->value, strlen(cdata->value), getCustomURID(cdata->key), CARLA_URI_MAP_ID_NULL);
@@ -4608,6 +4592,7 @@ 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()");
@@ -4649,6 +4634,7 @@ int CarlaEngineOsc::handleMsgLv2EventTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2)


return 0; return 0;
} }
#endif


CARLA_BACKEND_END_NAMESPACE CARLA_BACKEND_END_NAMESPACE




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

@@ -363,7 +363,7 @@ public:
{ {
container->setFixedSize(width, height); container->setFixedSize(width, height);
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
x_engine->callback(CALLBACK_RESIZE_GUI, m_id, width, height, 1.0);
x_engine->callback(CALLBACK_RESIZE_GUI, m_id, width, height, 1.0, nullptr);
#endif #endif
} }
} }
@@ -401,7 +401,7 @@ public:
qWarning("VstPlugin::setGuiContainer(%p) - failed to open UI", container); qWarning("VstPlugin::setGuiContainer(%p) - failed to open UI", container);


m_hints &= ~PLUGIN_HAS_GUI; m_hints &= ~PLUGIN_HAS_GUI;
x_engine->callback(CALLBACK_SHOW_GUI, m_id, -1, 0, 0.0);
x_engine->callback(CALLBACK_SHOW_GUI, m_id, -1, 0, 0.0, nullptr);


effect->dispatcher(effect, effEditClose, 0, 0, nullptr, 0.0f); effect->dispatcher(effect, effEditClose, 0, 0, nullptr, 0.0f);
} }
@@ -441,7 +441,7 @@ public:
else else
{ {
if (yesNo && gui.width > 0 && gui.height > 0) if (yesNo && gui.width > 0 && gui.height > 0)
x_engine->callback(CALLBACK_RESIZE_GUI, m_id, gui.width, gui.height, 0.0);
x_engine->callback(CALLBACK_RESIZE_GUI, m_id, gui.width, gui.height, 0.0, nullptr);
} }


gui.visible = yesNo; gui.visible = yesNo;
@@ -848,7 +848,7 @@ public:
} }
else else
{ {
x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0);
x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0, nullptr);


// Check if current program is invalid // Check if current program is invalid
bool programChanged = false; bool programChanged = false;
@@ -1649,7 +1649,7 @@ public:
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f); effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);
} }


x_engine->callback(CALLBACK_RELOAD_ALL, m_id, 0, 0, 0.0);
x_engine->callback(CALLBACK_RELOAD_ALL, m_id, 0, 0, 0.0, nullptr);


return 1; return 1;
} }
@@ -1699,7 +1699,7 @@ public:
gui.width = width; gui.width = width;
gui.height = height; gui.height = height;


x_engine->callback(CALLBACK_RESIZE_GUI, m_id, width, height, 0.0);
x_engine->callback(CALLBACK_RESIZE_GUI, m_id, width, height, 0.0, nullptr);


return 1; return 1;
} }
@@ -1728,7 +1728,7 @@ public:
} }


// Tell backend to update // Tell backend to update
x_engine->callback(CALLBACK_UPDATE, m_id, 0, 0, 0.0);
x_engine->callback(CALLBACK_UPDATE, m_id, 0, 0, 0.0, nullptr);
} }


void handleAudioMasterWantMidi() void handleAudioMasterWantMidi()
@@ -1980,8 +1980,8 @@ public:
#endif #endif
if (effect && ret > effect->numParams) if (effect && ret > effect->numParams)
ret = effect->numParams; ret = effect->numParams;
// FIXME
//ret = carla_minPositiveI(effect->numParams, MAX_PARAMETERS);
// FIXME
//ret = carla_minPositiveI(effect->numParams, MAX_PARAMETERS);
break; break;


case audioMasterGetParameterQuantization: case audioMasterGetParameterQuantization:


Loading…
Cancel
Save