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_END_NAMESPACE }
#define CARLA_BRIDGE_USE_NAMESPACE using namespace CarlaBridge;

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
{
public:
public:
CarlaClient(CarlaToolkit* const toolkit)
#ifdef BUILD_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

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

#include <set>
@@ -464,7 +465,7 @@ public:
for (uint32_t i=0; i < plugin->customDataCount(); 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)
@@ -506,7 +507,7 @@ public:
if (! plugin)
return;

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

void setChunkData(const char* const filePath)
@@ -543,9 +544,9 @@ public:
// ---------------------------------------------------------------------
// 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)
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);

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

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

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

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];
strcpy(target_path, m_oscData->path);
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
#define CARLA_ENGINE_HPP

#include "carla_engine_osc.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

#ifdef BUILD_BRIDGE
class CarlaPlugin;
#endif

/*!
* @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_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_inpeak(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;
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

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
else if (m_hints & PLUGIN_IS_BRIDGE)
osc_send_control(&osc.data, PARAMETER_ACTIVE, value);
@@ -482,7 +482,7 @@ void CarlaPlugin::setDryWet(double value, const bool sendOsc, const bool sendCal
#endif

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
else if (m_hints & PLUGIN_IS_BRIDGE)
osc_send_control(&osc.data, PARAMETER_DRYWET, value);
@@ -508,7 +508,7 @@ void CarlaPlugin::setVolume(double value, const bool sendOsc, const bool sendCal
#endif

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
else if (m_hints & PLUGIN_IS_BRIDGE)
osc_send_control(&osc.data, PARAMETER_VOLUME, value);
@@ -534,7 +534,7 @@ void CarlaPlugin::setBalanceLeft(double value, const bool sendOsc, const bool se
#endif

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
else if (m_hints & PLUGIN_IS_BRIDGE)
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

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
else if (m_hints & PLUGIN_IS_BRIDGE)
osc_send_control(&osc.data, PARAMETER_BALANCE_RIGHT, value);
@@ -596,7 +596,7 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, double value, co
#endif

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)
@@ -639,7 +639,7 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, uint8_t ch
#endif

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)
@@ -660,40 +660,33 @@ void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, int16_t cc, con
#endif

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(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)
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)
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;

switch (type)
if (strcmp(type, CUSTOM_DATA_STRING) == 0)
{
case CUSTOM_DATA_INVALID:
saveData = false;
break;
case CUSTOM_DATA_STRING:
// Ignore some keys
if (strncmp(key, "OSC:", 4) == 0 || strcmp(key, "guiVisible") == 0)
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)
saveData = false;
break;
default:
break;
}

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

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

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);
}
@@ -808,7 +801,7 @@ void CarlaPlugin::setMidiProgram(int32_t index, const bool sendGui, const bool s
#endif

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);
}
@@ -1168,7 +1161,7 @@ void CarlaPlugin::sendMidiSingleNote(const uint8_t channel, const uint8_t note,
#endif

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()
@@ -1252,7 +1245,7 @@ void CarlaPlugin::postEventsRun()
break;

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;

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

// 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;

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

// 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;

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

// 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;

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

// 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;

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

// 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;

case PluginPostEventCustom:


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

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

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

// 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_POST_EVENTS = 152;


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

@@ -214,20 +214,23 @@ public:
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(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)
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)
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);
if (h2) descriptor->configure(h2, key, value);
@@ -826,7 +829,7 @@ public:
}
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
bool programChanged = false;


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

@@ -823,26 +823,25 @@ public:
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(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)
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)
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);

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

if (x_engine->isOffline())
@@ -861,22 +860,22 @@ public:
switch (status)
{
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;
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;
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;
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;
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;
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;
}
}
@@ -978,7 +977,7 @@ public:
case GUI_INTERNAL_HWND:
case GUI_INTERNAL_X11:
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;

case GUI_EXTERNAL_LV2:
@@ -1008,7 +1007,7 @@ public:
}
else
// 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;

@@ -1882,7 +1881,7 @@ public:
}
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
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)
@@ -3148,20 +3147,9 @@ public:
CARLA_ASSERT(key > 0);
CARLA_ASSERT(value);

CustomDataType dtype;
const char* const stype = getCustomURIString(type);
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
if (! uriKey)
{
@@ -3175,9 +3163,9 @@ public:
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;
}

@@ -3188,7 +3176,7 @@ public:
{
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);
else
custom[i].value = strdup(QByteArray((const char*)value, size).toBase64().constData());
@@ -3199,10 +3187,10 @@ public:

// Otherwise store it
CustomData newData;
newData.type = dtype;
newData.type = strdup(stype);
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);
else
newData.value = strdup(QByteArray((const char*)value, size).toBase64().constData());
@@ -3224,14 +3212,14 @@ public:
return nullptr;
}

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

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

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

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

*size = chunk.size();
*type = (dtype == CUSTOM_DATA_CHUNK) ? CARLA_URI_MAP_ID_ATOM_CHUNK : key;
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;
}

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

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)
@@ -3337,7 +3321,7 @@ public:

gui.width = width;
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;
}
@@ -3454,13 +3438,13 @@ public:
qWarning("Lv2Plugin::initExternalUi() - failed to instantiate UI");
ui.handle = 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)
{
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;

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

if (cdata->type == CUSTOM_DATA_STRING)
if (strcmp(cdata->type, LV2_ATOM__String) == 0)
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));
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);
else
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)
{
qDebug("CarlaOsc::handleMsgLv2AtomTransfer()");
@@ -4649,6 +4634,7 @@ int CarlaEngineOsc::handleMsgLv2EventTransfer(CARLA_ENGINE_OSC_HANDLE_ARGS2)

return 0;
}
#endif

CARLA_BACKEND_END_NAMESPACE



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

@@ -363,7 +363,7 @@ public:
{
container->setFixedSize(width, height);
#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
}
}
@@ -401,7 +401,7 @@ public:
qWarning("VstPlugin::setGuiContainer(%p) - failed to open UI", container);

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);
}
@@ -441,7 +441,7 @@ public:
else
{
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;
@@ -848,7 +848,7 @@ public:
}
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
bool programChanged = false;
@@ -1649,7 +1649,7 @@ public:
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;
}
@@ -1699,7 +1699,7 @@ public:
gui.width = width;
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;
}
@@ -1728,7 +1728,7 @@ public:
}

// 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()
@@ -1980,8 +1980,8 @@ public:
#endif
if (effect && ret > effect->numParams)
ret = effect->numParams;
// FIXME
//ret = carla_minPositiveI(effect->numParams, MAX_PARAMETERS);
// FIXME
//ret = carla_minPositiveI(effect->numParams, MAX_PARAMETERS);
break;

case audioMasterGetParameterQuantization:


Loading…
Cancel
Save