Expose a new lua hook for resetting a plugin processor ( convenience func only: this avoids the necessity of an extra cast to PlugInsert )

This commit is contained in:
Ben Loftis 2017-01-31 10:35:37 -06:00
parent 0d7f88afbd
commit bfebad3dce
3 changed files with 21 additions and 0 deletions

View File

@ -99,6 +99,15 @@ namespace ARDOUR { namespace LuaAPI {
*/
float get_processor_param (boost::shared_ptr<Processor> proc, uint32_t which, bool &ok);
/** reset a processor to its default values (only works for plugins )
*
* This is a wrapper which looks up the Processor by plugin-insert.
*
* @param proc Plugin-Insert
* @returns true on success, false when the processor is not a plugin
*/
bool reset_processor_to_default (boost::shared_ptr<Processor> proc);
/** set a plugin control-input parameter value
*
* This is a wrapper around set_processor_param which looks up the Processor by plugin-insert.

View File

@ -207,6 +207,17 @@ ARDOUR::LuaAPI::get_processor_param (boost::shared_ptr<Processor> proc, uint32_t
return get_plugin_insert_param (pi, which, ok);
}
bool
ARDOUR::LuaAPI::reset_processor_to_default ( boost::shared_ptr<Processor> proc )
{
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (proc);
if (pi) {
pi->reset_parameters_to_default();
return true;
}
return false;
}
int
ARDOUR::LuaAPI::plugin_automation (lua_State *L)
{

View File

@ -1888,6 +1888,7 @@ LuaBindings::common (lua_State* L)
.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)
.addFunction ("reset_processor_to_default", ARDOUR::LuaAPI::reset_processor_to_default)
.addRefFunction ("get_processor_param", ARDOUR::LuaAPI::get_processor_param)
.addRefFunction ("get_plugin_insert_param", ARDOUR::LuaAPI::get_plugin_insert_param)
.addCFunction ("plugin_automation", ARDOUR::LuaAPI::plugin_automation)