Browse Source

Part 2, modify lilv API as needed

tags/1.9.4
falkTX 11 years ago
parent
commit
71fb1f1858
3 changed files with 15 additions and 19 deletions
  1. +8
    -2
      source/backend/plugin/Lv2Plugin.cpp
  2. +3
    -1
      source/libs/lilv/lilv-0.16.0/lilv/lilv.h
  3. +4
    -16
      source/libs/lilv/lilv-0.16.0/src/state.c

+ 8
- 2
source/backend/plugin/Lv2Plugin.cpp View File

@@ -1010,6 +1010,7 @@ public:
{
CARLA_ASSERT(fRdfDescriptor != nullptr);
CARLA_ASSERT(index >= -1 && index < static_cast<int32_t>(fRdfDescriptor->PresetCount));
CARLA_ASSERT(sendGui || sendOsc || sendCallback); // never call this from RT

if (index < -1)
index = -1;
@@ -1018,10 +1019,15 @@ public:

if (index >= 0 && index < static_cast<int32_t>(fRdfDescriptor->PresetCount))
{
const ScopedSingleProcessLocker spl(this, (sendGui || sendOsc || sendCallback));
const ScopedDisabler sd(this);

if (const LilvState* state = gLv2World.getState(fRdfDescriptor->Presets[index].URI, (LV2_URID_Map*)fFeatures[kFeatureIdUridMap]->data))
lilv_state_restore(state, nullptr, carla_lilv_set_port_value, this, 0, fFeatures);
{
lilv_state_restore(state, fExt.state, fHandle, carla_lilv_set_port_value, this, 0, fFeatures);

if (fHandle2 != nullptr)
lilv_state_restore(state, fExt.state, fHandle2, carla_lilv_set_port_value, this, 0, fFeatures);
}
}

CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback);


+ 3
- 1
source/libs/lilv/lilv-0.16.0/lilv/lilv.h View File

@@ -27,6 +27,7 @@
#include <stdio.h>

#include "lv2/lv2.h"
#include "lv2/state.h"
#include "lv2/urid.h"

#ifdef LILV_SHARED
@@ -1415,7 +1416,8 @@ typedef void (*LilvSetPortValueFunc)(const char* port_symbol,
LILV_API
void
lilv_state_restore(const LilvState* state,
LilvInstance* instance,
const LV2_State_Interface* iface,
LV2_Handle handle,
LilvSetPortValueFunc set_value,
void* user_data,
uint32_t flags,


+ 4
- 16
source/libs/lilv/lilv-0.16.0/src/state.c View File

@@ -399,30 +399,18 @@ lilv_state_new_from_instance(const LilvPlugin* plugin,
LILV_API
void
lilv_state_restore(const LilvState* state,
LilvInstance* instance,
const LV2_State_Interface* iface,
LV2_Handle handle,
LilvSetPortValueFunc set_value,
void* user_data,
uint32_t flags,
const LV2_Feature *const * features)
{
LV2_State_Map_Path map_path = {
(LilvState*)state, abstract_path, absolute_path };
LV2_Feature map_feature = { LV2_STATE__mapPath, &map_path };

const LV2_Feature** sfeatures = add_features(features, &map_feature, NULL);

const LV2_Descriptor* desc = instance->lv2_descriptor;
const LV2_State_Interface* iface = (desc->extension_data)
? (LV2_State_Interface*)desc->extension_data(LV2_STATE__interface)
: NULL;

if (iface) {
iface->restore(instance->lv2_handle, retrieve_callback,
(LV2_State_Handle)state, flags, sfeatures);
iface->restore(handle, retrieve_callback,
(LV2_State_Handle)state, flags, features);
}

free(sfeatures);

if (set_value) {
for (uint32_t i = 0; i < state->num_values; ++i) {
const PortValue* val = &state->values[i];


Loading…
Cancel
Save