diff options
author | Robin Gareus <robin@gareus.org> | 2016-03-20 21:16:18 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-03-20 21:16:18 +0100 |
commit | 6741679a98154258d9a6c0aa19dad1fbfa5ebf93 (patch) | |
tree | 9aa2d12a9d55e63bea271afd9ea33bde175bd21f /libs/ardour/lua_api.cc | |
parent | 6ecc8e9b3da8121ecb7d370598205ab86a13a294 (diff) |
add convenience lua API for looking up Plugins
Diffstat (limited to 'libs/ardour/lua_api.cc')
-rw-r--r-- | libs/ardour/lua_api.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/libs/ardour/lua_api.cc b/libs/ardour/lua_api.cc index 176a620052..c8c1217bc2 100644 --- a/libs/ardour/lua_api.cc +++ b/libs/ardour/lua_api.cc @@ -67,14 +67,9 @@ ARDOUR::LuaAPI::new_luaproc (Session *s, const string& name) return boost::shared_ptr<Processor> (new PluginInsert (*s, p)); } - -boost::shared_ptr<Processor> -ARDOUR::LuaAPI::new_plugin (Session *s, const string& name, ARDOUR::PluginType type, const string& preset) +PluginInfoPtr +ARDOUR::LuaAPI::new_plugin_info (const string& name, ARDOUR::PluginType type) { - if (!s) { - return boost::shared_ptr<Processor> (); - } - PluginManager& manager = PluginManager::instance(); PluginInfoList all_plugs; all_plugs.insert(all_plugs.end(), manager.ladspa_plugin_info().begin(), manager.ladspa_plugin_info().end()); @@ -91,13 +86,23 @@ ARDOUR::LuaAPI::new_plugin (Session *s, const string& name, ARDOUR::PluginType t all_plugs.insert(all_plugs.end(), manager.lv2_plugin_info().begin(), manager.lv2_plugin_info().end()); #endif - PluginInfoPtr pip; for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) { if (((*i)->name == name || (*i)->unique_id == name) && (*i)->type == type) { - pip = *i; - break; + return *i; } } + return PluginInfoPtr (); +} + +boost::shared_ptr<Processor> +ARDOUR::LuaAPI::new_plugin (Session *s, const string& name, ARDOUR::PluginType type, const string& preset) +{ + if (!s) { + return boost::shared_ptr<Processor> (); + } + + PluginInfoPtr pip = new_plugin_info (name, type); + if (!pip) { return boost::shared_ptr<Processor> (); } |