13
0

Clean up LADSPA preset path

* Allow to bundle presets
* Do not use /usr/[local] on Windows
(This may need further work, for Windows, since default user
presets are in `file://$HOME/.ladspa/rdf/`)
This commit is contained in:
Robin Gareus 2022-10-11 16:25:13 +02:00
parent 340a260b30
commit 5324c9092e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 19 additions and 9 deletions

View File

@ -44,6 +44,10 @@
class CAComponentDescription; class CAComponentDescription;
#endif #endif
namespace PBD {
class Searchpath;
}
namespace ARDOUR { namespace ARDOUR {
class Plugin; class Plugin;
@ -324,7 +328,7 @@ private:
void lxvst_refresh (bool cache_only); void lxvst_refresh (bool cache_only);
void vst3_refresh (bool cache_only); void vst3_refresh (bool cache_only);
void add_lrdf_data (const std::string &path); void add_lrdf_data (PBD::Searchpath const&);
void add_lrdf_presets (std::string domain); void add_lrdf_presets (std::string domain);
#ifdef AUDIOUNIT_SUPPORT #ifdef AUDIOUNIT_SUPPORT

View File

@ -720,6 +720,7 @@ LadspaPluginInfo::get_presets (bool /*user_only*/) const
if (set_uris) { if (set_uris) {
for (uint32_t i = 0; i < (uint32_t) set_uris->count; ++i) { for (uint32_t i = 0; i < (uint32_t) set_uris->count; ++i) {
// TODO somehow mark factory presets as such..
if (char* label = lrdf_get_label (set_uris->items[i])) { if (char* label = lrdf_get_label (set_uris->items[i])) {
p.push_back (Plugin::PresetRecord (set_uris->items[i], label)); p.push_back (Plugin::PresetRecord (set_uris->items[i], label));
} }

View File

@ -195,7 +195,6 @@ PluginManager::PluginManager ()
, _enable_scan_timeout (false) , _enable_scan_timeout (false)
{ {
char* s; char* s;
string lrdf_path;
#if defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT || defined MACVST_SUPPORT || defined VST3_SUPPORT #if defined WINDOWS_VST_SUPPORT || defined LXVST_SUPPORT || defined MACVST_SUPPORT || defined VST3_SUPPORT
// source-tree (ardev, etc) // source-tree (ardev, etc)
@ -262,15 +261,21 @@ PluginManager::PluginManager ()
load_tags (); load_tags ();
load_stats (); load_stats ();
Searchpath rdfs (ARDOUR::ardour_data_search_path());
if ((s = getenv ("LADSPA_RDF_PATH"))){ if ((s = getenv ("LADSPA_RDF_PATH"))){
lrdf_path = s; rdfs.add_subdirectory_to_paths ("rdf");
Searchpath t (s);
rdfs += t;
} else {
#ifndef PLATFORM_WINDOWS
rdfs += "usr/local/share/ladspa";
rdfs += "usr/share/ladspa";
#endif
rdfs.add_subdirectory_to_paths ("rdf");
} }
if (lrdf_path.length() == 0) { add_lrdf_data (rdfs);
lrdf_path = "/usr/local/share/ladspa/rdf:/usr/share/ladspa/rdf";
}
add_lrdf_data(lrdf_path);
add_lrdf_presets ("ladspa"); add_lrdf_presets ("ladspa");
@ -842,7 +847,7 @@ PluginManager::add_lrdf_presets(string domain)
} }
void void
PluginManager::add_lrdf_data (const string &path) PluginManager::add_lrdf_data (Searchpath const& path)
{ {
#ifdef HAVE_LRDF #ifdef HAVE_LRDF
vector<string> rdf_files; vector<string> rdf_files;