add lib/LV2 path akin to lib/surfaces, to allow bundling of LV2 plugins in an ardour release. My first attempt to push...
This commit is contained in:
35
libs/ardour/ardour/lv2_bundled_search_path.h
Normal file
35
libs/ardour/ardour/lv2_bundled_search_path.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Copyright (C) 2013 Paul Davis
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef ARDOUR_LV2_BUNDLED_SEARCH_PATH_INCLUDED
|
||||
#define ARDOUR_LV2_BUNDLED_SEARCH_PATH_INCLUDED
|
||||
|
||||
#include "pbd/search_path.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
/**
|
||||
* return a SearchPath containing directories in which to look for
|
||||
* lv2 plugins.
|
||||
*/
|
||||
PBD::SearchPath lv2_bundled_search_path ();
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
||||
#endif
|
||||
41
libs/ardour/lv2_bundled_search_path.cc
Normal file
41
libs/ardour/lv2_bundled_search_path.cc
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright (C) 2013 Paul Davis
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <glibmm/miscutils.h>
|
||||
|
||||
#include "ardour/lv2_bundled_search_path.h"
|
||||
#include "ardour/directory_names.h"
|
||||
#include "ardour/filesystem_paths.h"
|
||||
|
||||
using namespace PBD;
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
SearchPath
|
||||
lv2_bundled_search_path ()
|
||||
{
|
||||
SearchPath spath( ardour_dll_directory () );
|
||||
spath.add_subdirectory_to_paths ("LV2");
|
||||
|
||||
return spath;
|
||||
}
|
||||
|
||||
} // namespace ARDOUR
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include "pbd/pathscanner.h"
|
||||
#include "pbd/compose.h"
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/xml++.h"
|
||||
@@ -46,6 +47,7 @@
|
||||
#include "ardour/types.h"
|
||||
#include "ardour/utils.h"
|
||||
#include "ardour/worker.h"
|
||||
#include "ardour/lv2_bundled_search_path.h"
|
||||
|
||||
#include "i18n.h"
|
||||
#include <locale.h>
|
||||
@@ -1891,10 +1893,37 @@ LV2Plugin::Impl::designated_input (const char* uri, void** bufptrs[], void** buf
|
||||
return port;
|
||||
}
|
||||
|
||||
static bool lv2_filter (const string& str, void *arg)
|
||||
{
|
||||
/* Not a dotfile, has a prefix before a period, suffix is "lv2" */
|
||||
|
||||
return str[0] != '.' && (str.length() > 3 && str.find (".lv2") == (str.length() - 4));
|
||||
}
|
||||
|
||||
|
||||
LV2World::LV2World()
|
||||
: world(lilv_world_new())
|
||||
{
|
||||
lilv_world_load_all(world);
|
||||
|
||||
cout << "Scanning folders for bundled LV2s: " << ARDOUR::lv2_bundled_search_path().to_string() << endl;
|
||||
PathScanner scanner;
|
||||
vector<string *> *plugin_objects = scanner (ARDOUR::lv2_bundled_search_path().to_string(), lv2_filter, 0, true, true);
|
||||
if (plugin_objects) {
|
||||
for ( vector<string *>::iterator x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
|
||||
#ifdef WINDOWS
|
||||
string uri = "file:///" + **x + "/";
|
||||
#else
|
||||
string uri = "file://" + **x + "/";
|
||||
#endif
|
||||
LilvNode *node = lilv_new_uri(world, uri.c_str());
|
||||
lilv_world_load_bundle(world, node);
|
||||
lilv_node_free(node);
|
||||
}
|
||||
}
|
||||
delete (plugin_objects);
|
||||
|
||||
|
||||
atom_AtomPort = lilv_new_uri(world, LV2_ATOM__AtomPort);
|
||||
atom_Chunk = lilv_new_uri(world, LV2_ATOM__Chunk);
|
||||
atom_Sequence = lilv_new_uri(world, LV2_ATOM__Sequence);
|
||||
|
||||
@@ -103,6 +103,7 @@ libardour_sources = [
|
||||
'location.cc',
|
||||
'location_importer.cc',
|
||||
'ltc_slave.cc',
|
||||
'lv2_bundled_search_path.cc',
|
||||
'meter.cc',
|
||||
'midi_automation_list_binder.cc',
|
||||
'midi_buffer.cc',
|
||||
|
||||
Reference in New Issue
Block a user