Browse Source

Load full lv2 world when using first lv2 plugin

tags/1.9.4
falkTX 11 years ago
parent
commit
b77b552711
4 changed files with 59 additions and 24 deletions
  1. +37
    -4
      resources/ui/carla_settings.ui
  2. +0
    -11
      source/backend/plugin/Lv2Plugin.cpp
  3. +1
    -4
      source/bridges/CarlaBridgeUI-LV2.cpp
  4. +21
    -5
      source/utils/CarlaLv2Utils.hpp

+ 37
- 4
resources/ui/carla_settings.ui View File

@@ -1177,16 +1177,48 @@ This mode is not available for VST plugins.</string>
</layout>
</widget>
<widget class="QWidget" name="tw_paths_lv2">
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="margin">
<property name="topMargin">
<number>0</number>
</property>
<item>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QListWidget" name="lw_lv2"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../resources.qrc">:/16x16/dialog-information.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Restart Carla to be able to load new found plugins</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tw_paths_vst">
@@ -1361,6 +1393,7 @@ This mode is not available for VST plugins.</string>
<include location="../resources.qrc"/>
<include location="../resources.qrc"/>
<include location="../resources.qrc"/>
<include location="../../../Carla-stable/resources/resources.qrc"/>
</resources>
<connections>
<connection>


+ 0
- 11
source/backend/plugin/Lv2Plugin.cpp View File

@@ -4245,17 +4245,6 @@ public:
// ---------------------------------------------------------------
// get plugin from lv2_rdf (lilv)

Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());

// Convert bundle filename to URI
QString qBundle(QUrl::fromLocalFile(bundle).toString());
if (! qBundle.endsWith(OS_SEP_STR))
qBundle += OS_SEP_STR;

// Load bundle
Lilv::Node lilvBundle(lv2World.new_uri(qBundle.toUtf8().constData()));
lv2World.load_bundle(lilvBundle);

fRdfDescriptor = lv2_rdf_new(uri, true);

if (fRdfDescriptor == nullptr)


+ 1
- 4
source/bridges/CarlaBridgeUI-LV2.cpp View File

@@ -349,10 +349,7 @@ public:
// -----------------------------------------------------------------
// get plugin from lv2_rdf (lilv)

Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());

lv2World.load_all(); // FIXME
fRdfDescriptor = lv2_rdf_new(pluginURI, false);
fRdfDescriptor = lv2_rdf_new(pluginURI, true);

if (fRdfDescriptor == nullptr)
return false;


+ 21
- 5
source/utils/CarlaLv2Utils.hpp View File

@@ -216,6 +216,8 @@ public:
Lilv::Node rdf_type;
Lilv::Node rdfs_label;

bool needsInit;

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

Lv2WorldClass()
@@ -330,7 +332,11 @@ public:
dct_replaces (new_uri(NS_dct "replaces")),
doap_license (new_uri(NS_doap "license")),
rdf_type (new_uri(NS_rdf "type")),
rdfs_label (new_uri(NS_rdfs "label")) {}
rdfs_label (new_uri(NS_rdfs "label")),

needsInit(true)
{
}

static Lv2WorldClass& getInstance()
{
@@ -338,6 +344,15 @@ public:
return lv2World;
}

void init()
{
if (! needsInit)
return;

needsInit = false;
Lilv::World::load_all();
}

const LilvPlugin* getPlugin(const LV2_URI uri) const
{
CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', nullptr);
@@ -402,12 +417,15 @@ public:
// Create new RDF object (using lilv)

static inline
const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool fillPresets)
const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool doInit)
{
CARLA_SAFE_ASSERT_RETURN(uri != nullptr && uri[0] != '\0', nullptr);

Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());

if (doInit)
lv2World.init();

const LilvPlugin* const cPlugin(lv2World.getPlugin(uri));

if (cPlugin == nullptr)
@@ -1019,11 +1037,10 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool fillPresets)
}
}

#if 1
// -------------------------------------------------------------------
// Set Plugin Presets

if (fillPresets)
if (doInit)
{
Lilv::Nodes presetNodes(lilvPlugin.get_related(lv2World.preset_preset));

@@ -1081,7 +1098,6 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool fillPresets)
}
}
}
#endif

// -------------------------------------------------------------------
// Set Plugin Features


Loading…
Cancel
Save