diff options
Diffstat (limited to 'libs/ardour/ladspa_plugin.cc')
-rw-r--r-- | libs/ardour/ladspa_plugin.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index fa19a682e7..6b773b9e0b 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2002 Paul Davis + Copyright (C) 2000-2006 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 @@ -641,3 +641,26 @@ LadspaPlugin::latency_compute_run () run (bufsize); deactivate (); } + +PluginPtr +LadspaPluginInfo::load (Session& session) +{ + try { + PluginPtr plugin; + void *module; + + if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) { + error << string_compose(_("LADSPA: cannot load module from \"%1\""), path) << endmsg; + error << dlerror() << endmsg; + } else { + plugin.reset (new LadspaPlugin (module, session.engine(), session, index, session.frame_rate())); + } + + plugin->set_info(PluginInfoPtr(new LadspaPluginInfo(*this))); + return plugin; + } + + catch (failed_constructor &err) { + return PluginPtr ((Plugin*) 0); + } +} |