diff options
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/lua_api.h | 1 | ||||
-rw-r--r-- | libs/ardour/lua_api.cc | 25 | ||||
-rw-r--r-- | libs/ardour/luabindings.cc | 1 |
3 files changed, 17 insertions, 10 deletions
diff --git a/libs/ardour/ardour/lua_api.h b/libs/ardour/ardour/lua_api.h index 690957f47a..997e0036df 100644 --- a/libs/ardour/ardour/lua_api.h +++ b/libs/ardour/ardour/lua_api.h @@ -31,6 +31,7 @@ namespace ARDOUR { namespace LuaAPI { boost::shared_ptr<ARDOUR::Processor> new_luaproc (ARDOUR::Session *s, const std::string&); + boost::shared_ptr<ARDOUR::PluginInfo> new_plugin_info (const std::string&, ARDOUR::PluginType); boost::shared_ptr<ARDOUR::Processor> new_plugin (ARDOUR::Session *s, const std::string&, ARDOUR::PluginType, const std::string& preset = ""); bool set_processor_param (boost::shared_ptr<Processor> proc, uint32_t which, float val); bool set_plugin_insert_param (boost::shared_ptr<PluginInsert> pi, uint32_t which, float val); 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> (); } diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 0ad43ddad3..92a05dc407 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -587,6 +587,7 @@ LuaBindings::common (lua_State* L) .beginNamespace ("LuaAPI") .addFunction ("new_luaproc", ARDOUR::LuaAPI::new_luaproc) + .addFunction ("new_plugin_info", ARDOUR::LuaAPI::new_plugin_info) .addFunction ("new_plugin", ARDOUR::LuaAPI::new_plugin) .addFunction ("set_processor_param", ARDOUR::LuaAPI::set_processor_param) .addFunction ("set_plugin_insert_param", ARDOUR::LuaAPI::set_plugin_insert_param) |