Browse Source

Internally set LV2_PATH for lilv when needed

tags/1.9.5
falkTX 10 years ago
parent
commit
b61be7eaba
3 changed files with 19 additions and 7 deletions
  1. +1
    -1
      source/backend/engine/CarlaEngine.cpp
  2. +6
    -0
      source/backend/plugin/Lv2Plugin.cpp
  3. +12
    -6
      source/utils/CarlaLv2Utils.hpp

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

@@ -430,7 +430,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons
uniqueId uniqueId
}; };


char* const oldVstPath(getenv("VST_PATH"));
char* const oldVstPath(std::getenv("VST_PATH"));
carla_setenv("VST_PATH", file.getParentDirectory().getFullPathName().toRawUTF8()); carla_setenv("VST_PATH", file.getParentDirectory().getFullPathName().toRawUTF8());


plugin = CarlaPlugin::newDSSI(init2); plugin = CarlaPlugin::newDSSI(init2);


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

@@ -4486,6 +4486,12 @@ public:
return false; return false;
} }


// ---------------------------------------------------------------
// Init LV2 World if needed, sets LV2_PATH for lilv

Lv2WorldClass& lv2World(Lv2WorldClass::getInstance());
lv2World.initIfNeeded(pData->engine->getOptions().pathLV2);

// --------------------------------------------------------------- // ---------------------------------------------------------------
// get plugin from lv2_rdf (lilv) // get plugin from lv2_rdf (lilv)




+ 12
- 6
source/utils/CarlaLv2Utils.hpp View File

@@ -364,13 +364,22 @@ public:
return lv2World; return lv2World;
} }


void initIfNeeded()
void initIfNeeded(const char* const LV2_PATH)
{ {
CARLA_SAFE_ASSERT_RETURN(LV2_PATH != nullptr && LV2_PATH[0] != '\0',);

if (! needsInit) if (! needsInit)
return; return;


needsInit = false; needsInit = false;

char* const oldLv2Path(std::getenv("LV2_PATH"));
carla_setenv("LV2_PATH", LV2_PATH);

Lilv::World::load_all(); Lilv::World::load_all();

if (oldLv2Path != nullptr)
carla_setenv("LV2_PATH", oldLv2Path);
} }


void load_bundle(const char* const bundle) void load_bundle(const char* const bundle)
@@ -447,15 +456,12 @@ public:
// Create new RDF object (using lilv) // Create new RDF object (using lilv)


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


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


if (doInit)
lv2World.initIfNeeded();

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


if (cPlugin == nullptr) if (cPlugin == nullptr)
@@ -1095,7 +1101,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri, const bool doInit)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Set Plugin Presets // Set Plugin Presets


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




Loading…
Cancel
Save