Browse Source

Fix loading LV2 states (partially closes #38)

tags/1.9.4
falkTX 11 years ago
parent
commit
207fd900cc
4 changed files with 11 additions and 7 deletions
  1. +1
    -1
      source/backend/engine/CarlaEngine.cpp
  2. +2
    -2
      source/backend/plugin/CarlaPlugin.cpp
  3. +7
    -3
      source/backend/plugin/Lv2Plugin.cpp
  4. +1
    -1
      source/utils/CarlaStateUtils.hpp

+ 1
- 1
source/backend/engine/CarlaEngine.cpp View File

@@ -1171,7 +1171,7 @@ bool CarlaEngine::loadProject(const char* const filename)
{
if (isPreset || node.toElement().tagName() == "Plugin")
{
const SaveState& saveState = getSaveStateDictFromXML(isPreset ? xmlNode : node);
const SaveState& saveState(getSaveStateDictFromXML(isPreset ? xmlNode : node));
CARLA_ASSERT(saveState.type != nullptr);

if (saveState.type == nullptr)


+ 2
- 2
source/backend/plugin/CarlaPlugin.cpp View File

@@ -686,8 +686,8 @@ const SaveState& CarlaPlugin::getSaveState()
{
const MidiProgramData& mpData(kData->midiprog.getCurrent());

saveState.currentMidiBank = mpData.bank;
saveState.currentMidiProgram = mpData.program;
saveState.currentMidiBank = mpData.bank;
saveState.currentMidiProgram = mpData.program;
}

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


+ 7
- 3
source/backend/plugin/Lv2Plugin.cpp View File

@@ -20,9 +20,8 @@
#ifdef WANT_LV2

#include "CarlaPluginGui.hpp"
#include "CarlaLv2Utils.hpp"

#include "CarlaEngineOsc.hpp"
#include "CarlaLv2Utils.hpp"
#include "Lv2AtomQueue.hpp"

#include <QtCore/QDir>
@@ -3202,6 +3201,9 @@ protected:

void handleProgramChanged(const int32_t index)
{
CARLA_ASSERT_INT(index >= -1, index);
carla_debug("Lv2Plugin::handleProgramChanged(%i)", index);

if (index == -1)
{
const CarlaPlugin::ScopedDisabler m(this);
@@ -3234,6 +3236,7 @@ protected:
CARLA_ASSERT(key != CARLA_URI_MAP_ID_NULL);
CARLA_ASSERT(value != nullptr);
CARLA_ASSERT(size > 0);
carla_debug("Lv2Plugin::handleStateStore(%i, %p, " P_SIZE ", %i, %i)", key, value, size, type, flags);

// basic checks
if (key == CARLA_URI_MAP_ID_NULL)
@@ -3307,6 +3310,7 @@ protected:
const void* handleStateRetrieve(const uint32_t key, size_t* const size, uint32_t* const type, uint32_t* const flags)
{
CARLA_ASSERT(key != CARLA_URI_MAP_ID_NULL);
carla_debug("Lv2Plugin::handleStateRetrieve(%i, %p, %p, %p)", key, size, type, flags);

// basic checks
if (key == CARLA_URI_MAP_ID_NULL)
@@ -3350,7 +3354,7 @@ protected:
return nullptr;
}

*type = key;
*type = carla_lv2_urid_map(this, stype);
*flags = LV2_STATE_IS_POD;

if (std::strcmp(stype, LV2_ATOM__String) == 0 || std::strcmp(stype, LV2_ATOM__Path) == 0)


+ 1
- 1
source/utils/CarlaStateUtils.hpp View File

@@ -590,7 +590,7 @@ const QString& getXMLFromSaveState(const SaveState& saveState)
customData += QString(" <Type>%1</Type>\n").arg(xmlSafeString(stateCustomData->type, true));
customData += QString(" <Key>%1</Key>\n").arg(xmlSafeString(stateCustomData->key, true));

if (std::strcmp(stateCustomData->type, CUSTOM_DATA_CHUNK) == 0)
if (std::strcmp(stateCustomData->type, CUSTOM_DATA_CHUNK) == 0 || std::strlen(stateCustomData->value) >= 128)
{
customData += " <Value>\n";
customData += QString("%1\n").arg(xmlSafeString(stateCustomData->value, true));


Loading…
Cancel
Save