diff --git a/libs/ardour/ardour/ladspa_search_path.h b/libs/ardour/ardour/ladspa_search_path.h new file mode 100644 index 0000000000..791bba9188 --- /dev/null +++ b/libs/ardour/ardour/ladspa_search_path.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2011 Tim Mayberry + + 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_LADSPA_SEARCH_PATH_INCLUDED +#define ARDOUR_LADSPA_SEARCH_PATH_INCLUDED + +#include "pbd/search_path.h" + +namespace ARDOUR { + + /** + * return a SearchPath containing directories in which to look for + * LADSPA plugins. + * + * If LADSPA_PATH is defined then the SearchPath returned + * will contain the directories specified in it as well as the + * user and system directories. + */ + PBD::SearchPath ladspa_search_path (); + +} // namespace ARDOUR + +#endif diff --git a/libs/ardour/ladspa_search_path.cc b/libs/ardour/ladspa_search_path.cc new file mode 100644 index 0000000000..7b675d081d --- /dev/null +++ b/libs/ardour/ladspa_search_path.cc @@ -0,0 +1,55 @@ +/* + Copyright (C) 2011 Tim Mayberry + + 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 + +#include "ardour/ladspa_search_path.h" +#include "ardour/directory_names.h" +#include "ardour/filesystem_paths.h" + +namespace { + const char * const ladspa_env_variable_name = "LADSPA_PATH"; +} // anonymous + +using namespace PBD; + +namespace ARDOUR { + +SearchPath +ladspa_search_path () +{ + SearchPath spath_env (Glib::getenv(ladspa_env_variable_name)); + + SearchPath spath (user_config_directory ()); + + spath += ardour_dll_directory (); + spath.add_subdirectory_to_paths (ladspa_dir_name); + +#ifndef WIN32 + spath.push_back ("/usr/local/lib64/ladspa"); + spath.push_back ("/usr/local/lib/ladspa"); + spath.push_back ("/usr/lib64/ladspa"); + spath.push_back ("/usr/lib/ladspa"); + spath.push_back ("/Library/Audio/Plug-Ins/LADSPA"); +#endif + + return spath_env + spath; +} + +} // namespace ARDOUR diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 4e7e23aa1a..94f2445859 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -101,6 +101,7 @@ libardour_sources = [ 'jack_slave.cc', 'kmeterdsp.cc', 'ladspa_plugin.cc', + 'ladspa_search_path.cc', 'location.cc', 'location_importer.cc', 'ltc_slave.cc',