#include <cstring>
#include <glib/gstdio.h>
-#include <giomm/file.h>
#include <glib/gprintf.h>
#include <glibmm.h>
#include <boost/utility.hpp>
-#include "pbd/pathscanner.h"
+#include "pbd/file_utils.h"
+#include "pbd/stl_delete.h"
#include "pbd/compose.h"
#include "pbd/error.h"
#include "pbd/xml++.h"
#include "ardour/types.h"
#include "ardour/utils.h"
#include "ardour/worker.h"
-#include "ardour/lv2_bundled_search_path.h"
+#include "ardour/search_paths.h"
#include "i18n.h"
#include <locale.h>
throw failed_constructor();
}
-#ifdef HAVE_NEW_LILV
+#ifdef HAVE_LILV_0_16_0
// Load default state
LilvState* state = lilv_state_new_from_world(
_world.world, _uri_map.urid_map(), lilv_plugin_get_uri(_impl->plugin));
return g_strndup(abs_path.c_str(), abs_path.length());
}
-static void
-remove_directory(const std::string& path)
-{
- if (!Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) {
- warning << string_compose("\"%1\" is not a directory", path) << endmsg;
- return;
- }
-
- Glib::RefPtr<Gio::File> dir = Gio::File::create_for_path(path);
- Glib::RefPtr<Gio::FileEnumerator> e = dir->enumerate_children();
- Glib::RefPtr<Gio::FileInfo> fi;
- while ((fi = e->next_file())) {
- if (fi->get_type() == Gio::FILE_TYPE_DIRECTORY) {
- remove_directory(fi->get_name());
- } else {
- dir->get_child(fi->get_name())->remove();
- }
- }
- dir->remove();
-}
-
void
LV2Plugin::add_state(XMLNode* root) const
{
} else {
// State is identical, decrement version and nuke directory
lilv_state_free(state);
- remove_directory(new_dir);
+ PBD::remove_directory(new_dir);
--_state_version;
}
std::string uri = Glib::filename_to_uri(Glib::build_filename(bundle, file_name));
LilvNode *node_bundle = lilv_new_uri(_world.world, Glib::filename_to_uri(Glib::build_filename(bundle, "/")).c_str());
LilvNode *node_preset = lilv_new_uri(_world.world, uri.c_str());
+#ifdef HAVE_LILV_0_19_2
+ lilv_world_unload_resource(_world.world, node_preset);
+ lilv_world_unload_bundle(_world.world, node_bundle);
+#endif
lilv_world_load_bundle(_world.world, node_bundle);
lilv_world_load_resource(_world.world, node_preset);
lilv_node_free(node_bundle);
// Run the plugin so that it can set its latency parameter
+ bool was_activated = _was_activated;
activate();
uint32_t port_index = 0;
run(bufsize);
deactivate();
+ if (was_activated) {
+ activate();
+ }
}
const LilvPort*
{
if (!_bundle_checked) {
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) {
+
+ vector<string> plugin_objects;
+ find_paths_matching_filter (plugin_objects, ARDOUR::lv2_bundled_search_path(), lv2_filter, 0, true, true, true);
+ for ( vector<string>::iterator x = plugin_objects.begin(); x != plugin_objects.end (); ++x) {
#ifdef PLATFORM_WINDOWS
- string uri = "file:///" + **x + "/";
+ string uri = "file:///" + *x + "/";
#else
- string uri = "file://" + **x + "/";
+ string uri = "file://" + *x + "/";
#endif
- LilvNode *node = lilv_new_uri(world, uri.c_str());
- lilv_world_load_bundle(world, node);
- lilv_node_free(node);
- }
+ LilvNode *node = lilv_new_uri(world, uri.c_str());
+ lilv_world_load_bundle(world, node);
+ lilv_node_free(node);
}
- delete (plugin_objects);
_bundle_checked = true;
}
PluginInfoList* plugs = new PluginInfoList;
const LilvPlugins* plugins = lilv_world_get_all_plugins(_world.world);
- info << "LV2: Discovering " << lilv_plugins_size(plugins) << " plugins" << endmsg;
+ if (!Config->get_show_plugin_scan_window()) {
+ info << "LV2: Discovering " << lilv_plugins_size(plugins) << " plugins" << endmsg;
+ }
LILV_FOREACH(plugins, i, plugins) {
const LilvPlugin* p = lilv_plugins_get(plugins, i);
info->name = string(lilv_node_as_string(name));
lilv_node_free(name);
+ ARDOUR::PluginScanMessage(_("LV2"), info->name, false);
const LilvPluginClass* pclass = lilv_plugin_get_class(p);
const LilvNode* label = lilv_plugin_class_get_label(pclass);